effective_events 0.22.1 → 0.22.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: f3b9faa624904b433109451d6e7a064141af823256bc6482091e3edfe5cfe877
|
4
|
+
data.tar.gz: a55f320e5007311f0c53ab662642b5192b6f9310fdb40e8171f6f6119d0546e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e26a9f437b4f21a3a74f6fa666cb602927ecdd22334ea1151761cbc750b6fafa0aefc6f6fc4b616b8b84742aa62359eeb351d79b74656c5bdaea9db4bf423608
|
7
|
+
data.tar.gz: c7e80b197ccb38b79f9f5f21c5c63247b259a0e728aea20dd148d6b78cee077983f764f9740d8aaf7fa04a4363836009ded9f764a970f64ec53c615640d2f0c2
|
@@ -141,6 +141,18 @@ module EffectiveEventsEventRegistration
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
# Validate the same registrant user isn't registered on another registration
|
145
|
+
validate(if: -> { current_step == :details }) do
|
146
|
+
present_event_registrants.select { |er| er.user.present? }.each do |er|
|
147
|
+
existing = Effective::EventRegistrant.unarchived.registered.where(event_ticket: er.event_ticket, user: er.user).where.not(id: er)
|
148
|
+
|
149
|
+
if existing.present?
|
150
|
+
errors.add(:base, "Unable to register #{er.user} for #{er.event_ticket}. They've already been registered")
|
151
|
+
er.errors.add(:user_id, "Unable to register #{er.user} for #{er.event_ticket}. They've already been registered")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
144
156
|
# Validate all products are available for registration
|
145
157
|
validate(if: -> { current_step == :addons }) do
|
146
158
|
unavailable_event_products.each do |event_product|
|
@@ -114,9 +114,6 @@ module Effective
|
|
114
114
|
validates :price, presence: true, numericality: { greater_than_or_equal_to: 0 }
|
115
115
|
validates :email, email: true
|
116
116
|
|
117
|
-
# This works for persisted and adding a new one. But not adding two at same time in a registration
|
118
|
-
validates :user_id, uniqueness: { scope: [:event_ticket_id], allow_blank: true, message: 'is already registered for this event ticket' }
|
119
|
-
|
120
117
|
# First name, last name and email are always required fields on details
|
121
118
|
validates :first_name, presence: true, if: -> { registrant_validations_enabled? }
|
122
119
|
validates :last_name, presence: true, if: -> { registrant_validations_enabled? }
|