effective_events 3.2.1 → 3.2.2

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: e2e8b2075c3a62780ebfd753367b373b54cc4befa4ef803823ed33da55176faa
4
- data.tar.gz: 3699b0717b734a7572c6fd948d600844f83c8c778eece9065601d86a16906f78
3
+ metadata.gz: 9e65fb69fbdee359ef2e55c541768734cf71e8a3eba3b94bf5fe89a12a7592b4
4
+ data.tar.gz: 6959d79ecc46436a0a94489bfce1164df4ce4eef7d34784f5f2d798400ab889b
5
5
  SHA512:
6
- metadata.gz: a2dfceed0785cb5248a19e3d5609b11f22e6143874f00153c6e615f88a62955c9aeb18b3a52c9e3862fdff2c19474af7115d6510e785a569e9c189c649ce0cf4
7
- data.tar.gz: 49c680f8d7f1431e4ab910c48bc3945e2e8c62df1ec4c60432af97322e48b6f889e371ea5a9569430b73912a4fa1782979219cb14f125be1174a1f2472972890
6
+ metadata.gz: 3f3eb8e6fd41f64477e5a309104b9e9cf42f6c331a5e621e4acea86041501667fc25cf13d16d39b5361a1f8af3c5c9458a20945cb1fb94feeb1097b418dc90bd
7
+ data.tar.gz: c0524bff10171f0ea21e10f0dd7c5ff096f92f8b8475dd3f10abff5192622c752698926f096f618d811fe6b737da600260d9f3a6b31d328cc20a7ca1aff4c149
@@ -9,6 +9,17 @@ module Effective
9
9
 
10
10
  # We do not send email from this gem, and instead use the effective_orders gem to send the email.
11
11
 
12
+ def event_capacity_released(resource, opts = {})
13
+ raise('expected an event_registration') unless resource.class.try(:effective_events_event_registration?)
14
+
15
+ @assigns = assigns_for(resource)
16
+
17
+ @event_registration = resource
18
+ @event = @event_registration.event
19
+
20
+ mail(to: mailer_admin, **headers_for(resource, opts))
21
+ end
22
+
12
23
  # For the notifications. No longer used.
13
24
  # def event_registrant_purchased(resource, opts = {})
14
25
  # raise('expected an Effective::EventRegistrant') unless resource.kind_of?(Effective::EventRegistrant)
@@ -77,6 +77,9 @@ module EffectiveEventsEventRegistration
77
77
  # Code of Conduct Step
78
78
  attr_accessor :declare_code_of_conduct
79
79
 
80
+ # For email notification to admin
81
+ attr_accessor :send_event_capacity_released_email
82
+
80
83
  effective_resource do
81
84
  # Acts as Statused
82
85
  status :string, permitted: false
@@ -401,11 +404,14 @@ module EffectiveEventsEventRegistration
401
404
  end
402
405
 
403
406
  # Looks at any unselected event registrants and assigns a waitlist value
407
+ # If a single non-promoted waitlisted registrant exists, then all tickets purchased must also be waitlisted tickets.
404
408
  def waitlist_event_registrants
405
409
  present_event_registrants.group_by { |er| er.event_ticket }.each do |event_ticket, event_registrants|
406
410
  if event_ticket.waitlist?
411
+ existing = event_registrants.find { |er| er.persisted? && er.waitlisted_not_promoted? }
407
412
  capacity = event.capacity_available(event_ticket: event_ticket, event_registration: self)
408
- event_registrants.each_with_index { |er, index| er.assign_attributes(waitlisted: index >= capacity) }
413
+
414
+ event_registrants.each_with_index { |er, index| er.assign_attributes(waitlisted: (existing || index >= capacity)) }
409
415
  else
410
416
  event_registrants.each { |er| er.assign_attributes(waitlisted: false) }
411
417
  end
@@ -419,11 +425,17 @@ module EffectiveEventsEventRegistration
419
425
 
420
426
  update_event_registrants
421
427
  select_event_registrants
428
+
429
+ if event_registrants.any? { |er| er.marked_for_destruction? && !er.waitlisted_not_promoted? && er.event_ticket.capacity_available == 0 }
430
+ assign_attributes(send_event_capacity_released_email: true)
431
+ end
432
+
422
433
  waitlist_event_registrants
423
434
 
424
435
  after_commit do
425
436
  update_submit_fees_and_order! if submit_order.present?
426
437
  update_deferred_event_registration! if submit_order&.deferred?
438
+ send_event_capacity_released_email! if send_event_capacity_released_email
427
439
  end
428
440
 
429
441
  save!
@@ -564,6 +576,10 @@ module EffectiveEventsEventRegistration
564
576
  submit_order.send_event_registrants_cancelled_email!
565
577
  end
566
578
 
579
+ def send_event_capacity_released_email!
580
+ EffectiveEvents.send_email(:event_capacity_released, self)
581
+ end
582
+
567
583
  def just_let_them_edit_tickets_and_register_anyway?
568
584
  false
569
585
  end
@@ -310,6 +310,10 @@ module Effective
310
310
  event_tickets.sum { |et| et.registered_count }
311
311
  end
312
312
 
313
+ def total_capacity_available
314
+ total_capacity - total_registered_non_waitlisted_count
315
+ end
316
+
313
317
  # The amount of tickets that can be purchased except ones from an event registration
314
318
  def capacity_selectable(event_ticket:, event_registration: nil)
315
319
  return 0 if event_ticket.archived?
@@ -0,0 +1,12 @@
1
+ %p Hi Admin,
2
+
3
+ %p
4
+ The
5
+ = @event
6
+ was at capacity and had its order changed by
7
+ = @event_registration.owner
8
+ which freed up one or more ticket.
9
+
10
+ %p For more information, please visit:
11
+
12
+ %p= link_to 'View the event', effective_events.edit_admin_event_url(@event)
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '3.2.1'.freeze
2
+ VERSION = '3.2.2'.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.2.1
4
+ version: 3.2.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: 2025-10-10 00:00:00.000000000 Z
11
+ date: 2025-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -300,6 +300,7 @@ files:
300
300
  - app/views/effective/events/_sidebar.html.haml
301
301
  - app/views/effective/events/index.html.haml
302
302
  - app/views/effective/events/show.html.haml
303
+ - app/views/effective/events_mailer/event_capacity_released.html.haml
303
304
  - app/views/simple_calendar/_month_calendar.html.haml
304
305
  - config/effective_events.rb
305
306
  - config/locales/effective_events.en.yml