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: af4ffee3a1a64a15a48d9e7ff3ce8eecd6b8f5759fccb0c886e9f943fd42f919
4
- data.tar.gz: c184b3851caea22f826b685c4fc2a0db174f1b99a218f59deeb1edaad7a90694
3
+ metadata.gz: f3b9faa624904b433109451d6e7a064141af823256bc6482091e3edfe5cfe877
4
+ data.tar.gz: a55f320e5007311f0c53ab662642b5192b6f9310fdb40e8171f6f6119d0546e7
5
5
  SHA512:
6
- metadata.gz: 729e826bfdbe9b0287a87b00f2168791c7b861feb2cbd10e678706ea83876d1bdd638f6e6e18c90b8795bf9058b65c8c2396dda7e47901bfe5962e4071678fe7
7
- data.tar.gz: acf5fc1714ad5b37e9ebf9b0aa56dc3eaf83129059d54a5a9cf16da2edb4f2127cb35ca317d521e14fb171717ba2d95851fb7ea7b17aa1df6c81ec041dbf0caf
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? }
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '0.22.1'.freeze
2
+ VERSION = '0.22.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.22.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect