effective_events 2.30.1 → 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: cd0b6bb02134427002f39566497b8f27a3926cbf42b8569c1ca7a549a3dc1339
4
- data.tar.gz: 610c6470114b3d6776ec40632902cc6dbc78c7a00125eb259b3ca13741a0b8f5
3
+ metadata.gz: 91109a7761fa4e8cbc16e6ac9b9f8154da0f82e0137c2ffaa5988d6574608fd5
4
+ data.tar.gz: 4b69f5c89699e704194adf9c8c9f2e8f8b70eb5e4a1af6a176709798e1aab8d7
5
5
  SHA512:
6
- metadata.gz: 83b1c76fdd353b033ce990ac11089e179f415070224e02b91c7ed5e47f48d6ef6d9fb2f2d4b49a5c697ff271809e1b5d98b654a8c635407d547771a32aae9a05
7
- data.tar.gz: 35ecf10066ac4c3364fb5b0a6373aa90c1cde891f411c1e8029d639a5ec25eeab2b75ccf02fba8f54f32a8d7308b1ae3da401263ca087e273c791e0e36909ec4
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,54 +1,76 @@
1
1
  module Admin
2
2
  class EffectiveEventTicketsDatatable < Effective::Datatable
3
- filters do
4
- scope :unarchived, label: "All"
5
- scope :archived
6
- end
7
-
8
3
  datatable do
9
- reorder :position
4
+ order :title
10
5
 
11
6
  col :updated_at, visible: false
12
7
  col :created_at, visible: false
13
8
  col :id, visible: false
14
- col :archived, visible: false
9
+ col :archived
15
10
 
16
11
  col :event
17
-
18
12
  col :title
19
13
  col :category, visible: false
14
+ col :waitlist, visible: false
20
15
 
21
- col :early_bird_price, as: :price, visible: event&.early_bird_end_at.present?
22
- col :regular_price, as: :price
23
- col :member_price, as: :price
16
+ col :early_bird_price, as: :price, visible: false
17
+ col :regular_price, as: :price, visible: false
18
+ col :member_price, as: :price, visible: false
24
19
 
25
- col :waitlist
26
- col :capacity_available, visible: false
27
- col :capacity, label: 'Capacity Total', visible: false
20
+ col :prices do |ticket|
21
+ prices = ""
22
+
23
+ if event&.early_bird_end_at.present?
24
+ prices += "#{price_to_currency(ticket.early_bird_price || 0)} early<br />"
25
+ end
28
26
 
29
- col :capacity_to_s, label: 'Capacity' do |ticket|
30
- if ticket.capacity.present? && ticket.waitlist?
31
- "#{ticket.capacity_available} remaining / #{ticket.capacity} total. #{ticket.waitlisted_event_registrants_count} waitlisted."
32
- elsif ticket.capacity.present?
33
- "#{ticket.capacity_available} remaining / #{ticket.capacity} total"
27
+ if ticket.category == "Member Only"
28
+ prices += "#{price_to_currency(ticket.member_price)} member"
29
+ elsif ticket.category == "Regular"
30
+ prices += "#{price_to_currency(ticket.regular_price)} regular"
31
+ elsif ticket.category == ("Member or Non-Member" || "Regular")
32
+ prices +=
33
+ "
34
+ #{price_to_currency(ticket.regular_price)} regular<br />
35
+ #{price_to_currency(ticket.member_price)} member
36
+ "
37
+ else
38
+ "Invalid ticket category"
39
+ end
40
+
41
+ prices
42
+ end
43
+
44
+ col :capacity_available, visible: false
45
+ col :capacity, label: 'Capacity total', visible: false
46
+
47
+ col :registrations, label: 'Registrations' do |ticket|
48
+ if ticket.capacity.present?
49
+ "
50
+ #{ticket.capacity} capacity<br />
51
+ #{ticket.registered_non_waitlisted_count} registered<br />
52
+ #{ticket.registered_available_count} available<br />
53
+ #{ticket.registered_waitlisted_count} waitlisted
54
+ "
55
+ else
56
+ "#{ticket.registered_count} registered"
34
57
  end
35
58
  end
36
59
 
37
60
  col :category, visible: false
38
61
 
39
- col :registered_event_registrants_count, label: 'Registered' do |event|
62
+ col :registered_event_registrants_count, label: 'Registered', visible: false, as: :integer do |event|
40
63
  event.event_registrants.registered.count
41
64
  end
42
65
 
43
- col :purchased_event_registrants_count, label: 'Deferred', visible: false do |event|
66
+ col :deferred_event_registrants_count, label: 'Deferred', visible: false, as: :integer do |event|
44
67
  event.event_registrants.deferred.count
45
68
  end
46
69
 
47
- col :purchased_event_registrants_count, label: 'Purchased', visible: false do |event|
70
+ col :purchased_event_registrants_count, label: 'Purchased', visible: false, as: :integer do |event|
48
71
  event.event_registrants.purchased.count
49
72
  end
50
73
 
51
-
52
74
  col :question1, visible: false
53
75
  col :question2, visible: false
54
76
  col :question3, visible: false
@@ -22,8 +22,8 @@ module Admin
22
22
 
23
23
  col :draft?, as: :boolean, visible: false
24
24
  col :published?, as: :boolean
25
- col :published_start_at, as: "Published start"
26
- col :published_end_at, as: "Published end"
25
+ col :published_start_at, label: "Published start", as: :datetime
26
+ col :published_end_at, label: "Published end", as: :datetime
27
27
 
28
28
  col :start_at, label: 'Start', visible: false
29
29
  col :end_at, label: 'End', visible: false
@@ -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.1'.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.1
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-19 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