effective_events 2.30.2 → 2.30.3

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: 32f5674dd0103143460a411264938785c8b8fe264caf401aa3ac7c39c4118be6
4
- data.tar.gz: a0298a712e199e4b3e6fcef70aa1f11e9feb3d27d75266cdabb6d418b36e5518
3
+ metadata.gz: 91109a7761fa4e8cbc16e6ac9b9f8154da0f82e0137c2ffaa5988d6574608fd5
4
+ data.tar.gz: 4b69f5c89699e704194adf9c8c9f2e8f8b70eb5e4a1af6a176709798e1aab8d7
5
5
  SHA512:
6
- metadata.gz: 7631eec53e65b21d0546a009fe233989eefe5e448f34fe50c83562993ea2e01ea405c5b0f6f9dee9de5e4c5e3ca41c6e30aad6e640d5fab904fecc454bf7cdc8
7
- data.tar.gz: b972ba664a0d9312a5fd66d04bd4442b521badb1ce34aabff9f8933e5c2b1e51b8235c37cc2d8999c4e8778769ca47cc58fcb1610e8db14675569e2bfac5e974
6
+ metadata.gz: c0535e852a75453384146d633c341c18bbfc34c217033b0eb8c59175c6897913fbd65829ce4a8068fb13d54191e4f4435680e58c47e5cacbe35dd8fd089beac2
7
+ data.tar.gz: '09ca6a32572b6821ab732ac68d25e4d2856fc28fbfe413885f0b69f1d228c21e6304c742a087c1f6e10f00e3201f10f7be5d4e4d3a7f682657580ecca3d899ac'
@@ -16,7 +16,6 @@ module Admin
16
16
  col :updated_at, visible: false
17
17
  col :created_at, visible: false
18
18
  col :id, visible: false
19
- col :archived, visible: false
20
19
 
21
20
  col :registered_at
22
21
 
@@ -45,9 +44,12 @@ module Admin
45
44
  else
46
45
  '-'
47
46
  end
47
+ end.search do |collection, term|
48
+ EffectiveResources.truthy?(term) ? collection.waitlisted : collection.non_waitlisted
48
49
  end
49
50
 
50
51
  col :promoted, visible: false
52
+ col :archived, visible: false
51
53
 
52
54
  col :name do |er|
53
55
  if er.user.present?
@@ -1,14 +1,13 @@
1
1
  module Admin
2
2
  class EffectiveEventTicketsDatatable < Effective::Datatable
3
3
  datatable do
4
- reorder :position
4
+ order :title
5
5
 
6
6
  col :updated_at, visible: false
7
7
  col :created_at, visible: false
8
8
  col :id, visible: false
9
9
  col :archived
10
10
 
11
-
12
11
  col :event
13
12
  col :title
14
13
  col :category, visible: false
@@ -49,12 +48,12 @@ module Admin
49
48
  if ticket.capacity.present?
50
49
  "
51
50
  #{ticket.capacity} capacity<br />
52
- #{ticket.non_waitlisted_event_registrants_count.count} registered<br />
53
- #{ticket.capacity_available} available<br />
54
- #{ticket.waitlisted_event_registrants_count} waitlisted
51
+ #{ticket.registered_non_waitlisted_count} registered<br />
52
+ #{ticket.registered_available_count} available<br />
53
+ #{ticket.registered_waitlisted_count} waitlisted
55
54
  "
56
55
  else
57
- "#{ticket.non_waitlisted_event_registrants_count.count} registered"
56
+ "#{ticket.registered_count} registered"
58
57
  end
59
58
  end
60
59
 
@@ -64,7 +63,7 @@ module Admin
64
63
  event.event_registrants.registered.count
65
64
  end
66
65
 
67
- col :purchased_event_registrants_count, label: 'Deferred', visible: false, as: :integer do |event|
66
+ col :deferred_event_registrants_count, label: 'Deferred', visible: false, as: :integer do |event|
68
67
  event.event_registrants.deferred.count
69
68
  end
70
69
 
@@ -76,6 +76,9 @@ module Effective
76
76
  scope :purchased_or_created_by_admin, -> { purchased.or(unarchived.where(created_by_admin: true)) }
77
77
  scope :not_purchased_not_created_by_admin, -> { not_purchased.where(created_by_admin: false) }
78
78
 
79
+ scope :waitlisted, -> { where(waitlisted: true, promoted: false) }
80
+ scope :non_waitlisted, -> { where(waitlisted: false).or(where(waitlisted: true, promoted: true)) }
81
+
79
82
  before_validation(if: -> { event_registration.present? }) do
80
83
  self.event ||= event_registration.event
81
84
  self.owner ||= event_registration.owner
@@ -48,7 +48,7 @@ module Effective
48
48
  timestamps
49
49
  end
50
50
 
51
- scope :sorted, -> { order(:position) }
51
+ scope :sorted, -> { order(:title) }
52
52
  scope :deep, -> { with_rich_text_body.includes(:event, :purchased_event_registrants) }
53
53
 
54
54
  before_validation(if: -> { event.present? }) do
@@ -75,6 +75,7 @@ module Effective
75
75
  title.presence || 'New Event Ticket'
76
76
  end
77
77
 
78
+ # These capacity methods are used by the front end EventRegistrations screens
78
79
  def capacity_selectable(except: nil)
79
80
  return nil if capacity.blank?
80
81
  return nil if waitlist?
@@ -88,7 +89,7 @@ module Effective
88
89
  end
89
90
 
90
91
  def capacity_taken(except: nil)
91
- registered_or_selected_event_registrants(except: except).reject(&:waitlisted?).length
92
+ registered_or_selected_event_registrants(except: except).reject { |er| er.waitlisted? && !er.promoted? }.length
92
93
  end
93
94
 
94
95
  def registered_or_selected_event_registrants(except: nil)
@@ -99,24 +100,31 @@ module Effective
99
100
  end
100
101
  end
101
102
 
102
- def registered_or_selected_event_registrants_count
103
- registered_or_selected_event_registrants.count
104
- end
103
+ # These registered methods are for the admin registrations screens
105
104
 
106
- def registered_event_registrants_count
105
+ # Total registered count, including waitlisted and non waitlisted
106
+ def registered_count
107
107
  registered_event_registrants.length
108
108
  end
109
109
 
110
- def purchased_event_registrants_count
111
- purchased_event_registrants.length
110
+ # Registered and not waitlisted count
111
+ def registered_non_waitlisted_count
112
+ registered_event_registrants.non_waitlisted.length
112
113
  end
113
114
 
114
- def non_waitlisted_event_registrants_count
115
- registered_event_registrants.where(waitlisted: false).or(registered_event_registrants.where(waitlisted: true, promoted: true))
115
+ # Registered and waitlisted count
116
+ def registered_waitlisted_count
117
+ registered_event_registrants.waitlisted.length
116
118
  end
117
119
 
118
- def waitlisted_event_registrants_count
119
- registered_event_registrants.where(waitlisted: true, promoted: false).length
120
+ # Registered and available count
121
+ def registered_available_count
122
+ return nil if capacity.blank?
123
+ [capacity - registered_non_waitlisted_count, 0].max
124
+ end
125
+
126
+ def purchased_event_registrants_count
127
+ purchased_event_registrants.length
120
128
  end
121
129
 
122
130
  def questions
@@ -134,6 +142,5 @@ module Effective
134
142
  def member_or_non_member?
135
143
  category == 'Member or Non-Member'
136
144
  end
137
-
138
145
  end
139
146
  end
@@ -1,3 +1,3 @@
1
1
  module EffectiveEvents
2
- VERSION = '2.30.2'.freeze
2
+ VERSION = '2.30.3'.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: 2.30.2
4
+ version: 2.30.3
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-02-25 00:00:00.000000000 Z
11
+ date: 2025-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails