effective_events 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/effective/event_registrations_controller.rb +14 -0
- data/app/datatables/admin/effective_event_addons_datatable.rb +1 -0
- data/app/datatables/admin/effective_event_products_datatable.rb +1 -0
- data/app/datatables/admin/effective_event_registrants_datatable.rb +1 -0
- data/app/datatables/admin/effective_event_tickets_datatable.rb +1 -0
- data/app/models/concerns/effective_events_event_registration.rb +10 -2
- data/lib/effective_events/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82816ca9bcbe094f896c1ed69dc9ed52e73eeb96e496c8a92b53f3b17478b183
|
4
|
+
data.tar.gz: a508d7f01b1a9dda0d79ba93690b129444e3acf6c1feddf1a3b0de7ad8e043fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bad7ad39adc838a4e65ec253261472dcae6bc4d646821e450e3d2b3023d608847a158952bbfde0b1368604fb5fb761f277cec1c608718788b591c7bdb0034de0
|
7
|
+
data.tar.gz: b9479522e0ef4962da64ed39ca391a23b18cf4fe1c0d8ceb2d3084d8d8c7fb7bd04c5ae68ba8cf08411fda0feed2664040fee86876315deed7a7c597bb75bc94
|
@@ -12,5 +12,19 @@ module Effective
|
|
12
12
|
EffectiveEvents.EventRegistration.deep.where(owner: current_user, event: event)
|
13
13
|
}
|
14
14
|
|
15
|
+
# Override ready_checkout to also check for any currently sold out tickets or addons
|
16
|
+
# Prevents people from coming back and purchasing them
|
17
|
+
def ready_checkout
|
18
|
+
return unless step == :checkout
|
19
|
+
return unless resource.class.try(:acts_as_purchasable_wizard?)
|
20
|
+
|
21
|
+
if resource.sold_out_event_registrants.present? || resource.sold_out_event_addons.present?
|
22
|
+
flash[:danger] = "Your selected event tickets are sold out. This event registration is no longer available."
|
23
|
+
return redirect_to('/dashboard')
|
24
|
+
end
|
25
|
+
|
26
|
+
resource.ready!
|
27
|
+
end
|
28
|
+
|
15
29
|
end
|
16
30
|
end
|
@@ -94,12 +94,12 @@ module EffectiveEventsEventRegistration
|
|
94
94
|
|
95
95
|
# Validate all items are available
|
96
96
|
validate(unless: -> { current_step == :checkout || done? }) do
|
97
|
-
|
97
|
+
sold_out_event_registrants.each do |item|
|
98
98
|
errors.add(:base, "The #{item.event_ticket} ticket is sold out and no longer available for purchase")
|
99
99
|
item.errors.add(:event_ticket_id, "#{item.event_ticket} is unavailable for purchase")
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
sold_out_event_addons.each do |item|
|
103
103
|
errors.add(:base, "The #{item.event_product} product is sold out and no longer available for purchase")
|
104
104
|
item.errors.add(:event_product_id, "#{item.event_product} is unavailable for purchase")
|
105
105
|
end
|
@@ -120,6 +120,14 @@ module EffectiveEventsEventRegistration
|
|
120
120
|
notifications.each { |notification| notification.notify!(event_registrants: event_registrants) }
|
121
121
|
end
|
122
122
|
|
123
|
+
def sold_out_event_registrants
|
124
|
+
event_registrants.reject { |er| er.purchased? || er.event_ticket&.available? }
|
125
|
+
end
|
126
|
+
|
127
|
+
def sold_out_event_addons
|
128
|
+
event_addons.reject { |ep| ep.purchased? || ep.event_product&.available? }
|
129
|
+
end
|
130
|
+
|
123
131
|
end
|
124
132
|
|
125
133
|
# Instance Methods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|