effective_events 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fb19076318d87fbdd9bb360120fa518c4370cbf77abd5f7c171fd7b812c0247
|
4
|
+
data.tar.gz: '0538fd20c3774db63cf9457dc7a732c99621e7ca1e02b0c925d552b51178d528'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff974d54488a14ddaa68fafe7bc8c63698004b4134a1a560726808585cf3c3bf90e3ec846f1e6e5b50323b97211fbe7de54343e078469c4e9a836ce2120e4d5c
|
7
|
+
data.tar.gz: ef8c11393e22f4bacfbf2c094f4918700cd2f17a59e0fbcf2e4de724d6d7f6503868ed892f0a360cf3e232787d2fd60e64cec0cbbc2dfe15cbe2d0141b7f31c9
|
@@ -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.2
|
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-10-
|
11
|
+
date: 2023-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|