Skip to content

Commit

Permalink
fix for active event addons count
Browse files Browse the repository at this point in the history
  • Loading branch information
beingmattlevy committed Jul 31, 2024
1 parent 933136c commit 6fad354
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ def active_event_addons?
event_addons.where('price > ?', 0).count.positive?
end

def active_event_addons_passes?
@active_event_addons_passes ||= active_event_addons_by_category(Addon::CATEGORY_PASS).count
def active_event_addons_passes_count
active_event_addons_by_category(Addon::CATEGORY_PASS).count
end

def active_event_addons_camping?
@active_event_addons_camping ||= active_event_addons_by_category(Addon::CATEGORY_CAMP).count
def active_event_addons_camping_count
active_event_addons_by_category(Addon::CATEGORY_CAMP).count
end

def active_event_addons_by_category(category)
Expand Down
20 changes: 10 additions & 10 deletions app/views/ticket_requests/_table_ticket_request_statuses.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
%th.bg-dark-subtle.text-end Tickets
- if event.kid_ticket_price
%th.bg-dark-subtle.text-end Kids
- if event.active_event_addons_passes?
- if event.active_event_addons_passes_count > 0
%th.bg-dark-subtle.text-end
=Addon::HUMANIZED_CATEGORIES[Addon::CATEGORY_PASS]
- if event.active_event_addons_camping?
- if event.active_event_addons_camping_count > 0
%th.bg-dark-subtle.text-end
=Addon::HUMANIZED_CATEGORIES[Addon::CATEGORY_CAMP]
%th.bg-dark-subtle.text-end Earn
Expand All @@ -41,10 +41,10 @@
- if event.kid_ticket_price
%td.text-end.bg-success-subtle
%span= stats[:completed][:kids]
- if event.active_event_addons_passes?
- if event.active_event_addons_passes_count > 0
%td.text-end.bg-success-subtle
%span= stats[:completed][:addon_passes]
- if event.active_event_addons_camping?
- if event.active_event_addons_camping_count > 0
%td.text-end.bg-success-subtle
%span= stats[:completed][:addon_camping]
%td.text-end.bg-success-subtle
Expand All @@ -58,9 +58,9 @@
%td.text-end.bg-warning= stats[:pending][:adults]
- if event.kid_ticket_price
%td.text-end.bg-warning= stats[:pending][:kids]
- if event.active_event_addons_passes?
- if event.active_event_addons_passes_count > 0
%td.text-end.bg-warning= stats[:pending][:addon_passes]
- if event.active_event_addons_camping?
- if event.active_event_addons_camping_count > 0
%td.text-end.bg-warning= stats[:pending][:addon_camping]
%td.text-end.bg-warning.fs-6
= number_to_currency(stats[:pending][:raised], precision: 0)
Expand All @@ -72,9 +72,9 @@
%td.text-end.bg-warning-subtle= stats[:awaiting_payment][:adults]
- if event.kid_ticket_price
%td.text-end.bg-warning-subtle= stats[:awaiting_payment][:kids]
- if event.active_event_addons_passes?
- if event.active_event_addons_passes_count > 0
%td.text-end.bg-warning-subtle= stats[:awaiting_payment][:addon_passes]
- if event.active_event_addons_camping?
- if event.active_event_addons_camping_count > 0
%td.text-end.bg-warning-subtle= stats[:awaiting_payment][:addon_camping]
%td.text-end.bg-warning-subtle.fs-6
= number_to_currency(stats[:awaiting_payment][:raised], precision: 0)
Expand All @@ -87,8 +87,8 @@
%td.bg-dark-subtle.text-end= stats[:total][:adults]
- if event.kid_ticket_price
%td.bg-dark-subtle.text-end= stats[:total][:kids]
- if event.active_event_addons_passes?
- if event.active_event_addons_passes_count > 0
%td.bg-dark-subtle.text-end= stats[:total][:addon_passes]
- if event.active_event_addons_camping?
- if event.active_event_addons_camping_count > 0
%td.bg-dark-subtle.text-end= stats[:total][:addon_camping]
%td.bg-dark-subtle.text-end.fs-5= number_to_currency(stats[:total][:raised], precision: 0)

0 comments on commit 6fad354

Please sign in to comment.