Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
beingmattlevy committed Jul 30, 2024
1 parent 364ba22 commit 6f9a844
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
12 changes: 6 additions & 6 deletions app/controllers/ticket_requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ def index
requests = @ticket_requests.select { |tr| tr.send("#{status}?") }

stats[status] = {
requests: requests.count,
adults: requests.sum(&:adults),
kids: requests.sum(&:kids),
addon_passes: requests.sum(&:active_addon_pass_count),
addon_camping: requests.sum(&:active_addon_camp_count),
raised: requests.sum(&:price)
requests: requests.count,
adults: requests.sum(&:adults),
kids: requests.sum(&:kids),
addon_passes: requests.sum(&:active_addon_pass_count),
addon_camping: requests.sum(&:active_addon_camp_count),
raised: requests.sum(&:price)
}
end

Expand Down
4 changes: 2 additions & 2 deletions app/helpers/ticket_requests_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def help_text_for(sym)
# HACK: This copy is specific for TicketBooth--we'll have to add a
# customization so that this can be set on a per-event basis
<<-HELP
Babes in arms are free.
Kids need to be registered with name and age on the ticket request form.
Babes in arms are free.
Kids need to be registered with name and age on the ticket request form.
Reach out to [email protected] if you have any questions.
HELP
when :address
Expand Down
5 changes: 2 additions & 3 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ def active_event_addons?
end

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

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

def active_event_addons_by_category(category)
Expand All @@ -239,7 +239,6 @@ def active_event_addons_by_category(category)
.where('price > ?', 0)
end


def active_sorted_event_addons
event_addons.where('price > ?', 0).sort_by { |e| [e.category, e.price, e.name] }
end
Expand Down
9 changes: 2 additions & 7 deletions app/models/ticket_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,12 @@ def active_sorted_addons
active_addons.sort_by { |e| [e.category, e.price, e.name] }
end

# active_ticket_request_event_addons_count
def active_ticket_request_event_addons_count
active_sorted_addons.count
end

def active_addon_pass_count
@addon_pass_count ||= active_addon_by_category(Addon::CATEGORY_PASS).count
@active_addon_pass_count ||= active_addon_by_category(Addon::CATEGORY_PASS).count
end

def active_addon_camp_count
@addon_camp_count ||= active_addon_by_category(Addon::CATEGORY_CAMP).count
@active_addon_camp_count ||= active_addon_by_category(Addon::CATEGORY_CAMP).count
end

def active_addon_by_category(category)
Expand Down
2 changes: 1 addition & 1 deletion app/views/ticket_requests/_table_ticket_requests.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
%td.align-content-center.text-end.optional-medium= ticket_request.kids
- if event.active_event_addons?
%td.align-content-center.text-end.optional-medium= ticket_request.active_ticket_request_event_addons_count
%td.align-content-center.text-end.optional-medium= ticket_request.active_addons.count
%td.align-content-center.text-end
%span{ class: ('label label-info' if ticket_request.special_price) }
Expand Down

0 comments on commit 6f9a844

Please sign in to comment.