effective_events 3.0.9 → 3.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1eb941a4d2f674462d040e0b05bf52347917044b3fd770e97401f7fbde823db5
4
- data.tar.gz: 6824262cb6e8dca0fcddfb19615da17a2ac15b394d5bfaf74dd466d3c4615b15
3
+ metadata.gz: 5d7fc9c9bc862742ce23d16f1da5346ec09dfc20898bc773d4062300e2908b9b
4
+ data.tar.gz: e1ffc22eaf468204bb6d1a1311b9be7b7630b05b83a63ac4a36467bb406bde34
5
5
  SHA512:
6
- metadata.gz: 68af9844bec221bbadb86095975c930cd408108294c4491c38ed9943da0f867ddfa4c60ad62f02a158251647322ff22cc817c6064454bf14c612b3ec84b3274d
7
- data.tar.gz: 15d8a426770fe83299ffb414ca6a39bf69a50bff002dc04373afad3744e38ebac8c3841e97051b3bf10126b09137b762cc967ac46c5457781fdb635e2d4ffc8b
6
+ metadata.gz: 2908eab393778019edb4a84ca383b5c829811a031349a5bc9b48e6d791a5136492d8d09b652adb33a1aa2dc2aa11b34f802191b6cd70e3db34707e7caf039e78
7
+ data.tar.gz: 80b4a3ad3aab17de75edc472c735f67982e4d9ea74028156b7f7d9d69de0ddc98a49ce83dd770f6c39259257f5a4a0dbfc0596197afc764beffa90b22fe15edc
@@ -80,6 +80,10 @@ module Admin
80
80
  col :question2, visible: false
81
81
  col :question3, visible: false
82
82
 
83
+ col :question1_required, visible: false
84
+ col :question2_required, visible: false
85
+ col :question3_required, visible: false
86
+
83
87
  actions_col
84
88
  end
85
89
 
@@ -30,12 +30,19 @@ module Admin
30
30
  col :published_start_at, label: "Published start", as: :datetime, visible: false
31
31
  col :published_end_at, label: "Published end", as: :datetime, visible: false
32
32
 
33
- # TODO
34
- # col :total_capacity, label: 'Capacity' do |event|
35
- # if event.event_tickets_with_capacity.present?
36
- # "#{event.total_capacity_taken}/#{event.total_capacity}"
37
- # end
38
- # end
33
+ col :total_registered do |event|
34
+ registered = if event.event_tickets_with_capacity.present?
35
+ "#{event.total_registered_non_waitlisted_count}/#{event.total_capacity}"
36
+ elsif event.event_tickets.present?
37
+ "#{event.total_registered}"
38
+ end
39
+
40
+ waitlisted = if event.event_tickets_with_waitlist.present?
41
+ "#{event.total_registered_waitlisted_count} waitlisted"
42
+ end
43
+
44
+ [registered, waitlisted].compact.join(" +")
45
+ end
39
46
 
40
47
  col :excerpt, visible: false
41
48
 
@@ -283,22 +283,33 @@ module Effective
283
283
  start_at
284
284
  end
285
285
 
286
+ # For Events#index column
286
287
  def event_tickets_with_capacity
287
- event_tickets.reject(&:archived?).select { |et| et.capacity.present? }
288
+ event_tickets.select { |et| et.capacity.present? }
288
289
  end
289
290
 
290
- def total_capacity_available
291
- event_tickets_with_capacity.sum { |et| et.capacity_available }
291
+ def event_tickets_with_waitlist
292
+ event_tickets_with_capacity.select { |et| et.waitlist? }
292
293
  end
293
294
 
294
- def total_capacity_taken
295
- event_tickets_with_capacity.sum { |et| et.capacity_taken }
295
+ # Total Registered and not waitlisted count
296
+ def total_registered_non_waitlisted_count
297
+ event_tickets_with_capacity.sum { |et| et.registered_non_waitlisted_count }
298
+ end
299
+
300
+ # Total Registered and waitlisted count
301
+ def total_registered_waitlisted_count
302
+ event_tickets_with_capacity.sum { |et| et.registered_waitlisted_count }
296
303
  end
297
304
 
298
305
  def total_capacity
299
306
  event_tickets_with_capacity.sum { |et| et.capacity }
300
307
  end
301
308
 
309
+ def total_registered
310
+ event_tickets.sum { |et| et.registered_count }
311
+ end
312
+
302
313
  # The amount of tickets that can be purchased except ones from an event registration
303
314
  def capacity_selectable(event_ticket:, event_registration: nil)
304
315
  return 0 if event_ticket.archived?
@@ -135,11 +135,16 @@ module Effective
135
135
  validates :last_name, presence: true, if: -> { registrant_validations_enabled? }
136
136
  validates :email, presence: true, if: -> { registrant_validations_enabled? }
137
137
 
138
- # User, company and organization conditionall required
138
+ # User, company and organization conditionally required
139
139
  validates :user, presence: true, if: -> { registrant_validations_enabled? && EffectiveEvents.create_users }
140
140
  validates :company, presence: true, if: -> { registrant_validations_enabled? && EffectiveEvents.company_or_organization_required }
141
141
  validates :organization, presence: true, if: -> { registrant_validations_enabled? && EffectiveEvents.company_or_organization_required && EffectiveEvents.organization_enabled? }
142
142
 
143
+ # Responses may or may not be required depending on the event ticket
144
+ validates :response1, presence: true, if: -> { registrant_validations_enabled? && event_ticket&.question1_required? }
145
+ validates :response2, presence: true, if: -> { registrant_validations_enabled? && event_ticket&.question2_required? }
146
+ validates :response3, presence: true, if: -> { registrant_validations_enabled? && event_ticket&.question3_required? }
147
+
143
148
  # Copy any user errors from build_user_and_organization() into the registrant
144
149
  after_validation(if: -> { user && user.new_record? && user.errors.present? }) do
145
150
  errors.add(:first_name, user.errors[:first_name].join(', ')) if user.errors[:first_name].present?
@@ -35,6 +35,10 @@ module Effective
35
35
  question2 :text
36
36
  question3 :text
37
37
 
38
+ question1_required :boolean
39
+ question2_required :boolean
40
+ question3_required :boolean
41
+
38
42
  # Pricing
39
43
  early_bird_price :integer
40
44
 
@@ -164,5 +168,17 @@ module Effective
164
168
  category == 'Members'
165
169
  end
166
170
 
171
+ def question1_required?
172
+ question1.present? && question1_required
173
+ end
174
+
175
+ def question2_required?
176
+ question2.present? && question2_required
177
+ end
178
+
179
+ def question3_required?
180
+ question3.present? && question3_required
181
+ end
182
+
167
183
  end
168
184
  end
@@ -49,7 +49,12 @@
49
49
  %small.text-muted Please add up to 3 questions to ask during registration. Each ticket will have their own unique answers. Leave a question blank to skip.
50
50
 
51
51
  = f.text_field :question1, label: 'Question 1'
52
+ = f.check_box :question1_required, label: 'Question 1 Required'
53
+
52
54
  = f.text_field :question2, label: 'Question 2'
55
+ = f.check_box :question2_required, label: 'Question 2 Required'
56
+
53
57
  = f.text_field :question3, label: 'Question 3'
58
+ = f.check_box :question3_required, label: 'Question 3 Required'
54
59
 
55
60
  = effective_submit(f)
@@ -41,11 +41,11 @@
41
41
 
42
42
  - if event_ticket.present?
43
43
  - if event_ticket.question1.present?
44
- = f.text_field :response1, label: event_ticket.question1
44
+ = f.text_field :response1, label: event_ticket.question1, required: event_ticket.question1_required?
45
45
 
46
46
  - if event_ticket.question2.present?
47
- = f.text_field :response2, label: event_ticket.question2
47
+ = f.text_field :response2, label: event_ticket.question2, required: event_ticket.question2_required?
48
48
 
49
49
  - if event_ticket.question3.present?
50
- = f.text_field :response3, label: event_ticket.question3
50
+ = f.text_field :response3, label: event_ticket.question3, required: event_ticket.question3_required?
51
51
 
@@ -58,6 +58,10 @@ class CreateEffectiveEvents < ActiveRecord::Migration[6.0]
58
58
  t.text :question2
59
59
  t.text :question3
60
60
 
61
+ t.boolean :question1_required, default: false
62
+ t.boolean :question2_required, default: false
63
+ t.boolean :question3_required, default: false
64
+
61
65
  t.string :qb_item_name
62
66
  t.boolean :tax_exempt, default: false
63
67
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '3.0.9'.freeze
2
+ VERSION = '3.1.1'.freeze
3
3
  end
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: 3.0.9
4
+ version: 3.1.1
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: 2025-10-07 00:00:00.000000000 Z
11
+ date: 2025-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails