Skip to content

Commit

Permalink
finally have the BOGO logic right??
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Dec 6, 2023
1 parent cef25ed commit 38b2e5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/valid_voucher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def adjust_for_advance_reservations
def adjust_for_capacity
self.max_sales_for_this_patron = seats_of_type_remaining()
min_max = display_min_and_max_sales_per_txn
self.explanation =
self.explanation =
case max_sales_for_this_patron
when 0 then "No seats remaining for tickets of this type"
when INFINITE then "No performance-specific limit applies #{min_max}".strip
Expand Down
10 changes: 7 additions & 3 deletions app/views/store/_ticket_menus.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@
%label.col-form-label.form-control-sm.alert-warning.s-explain= v.explanation
- else
- num_allowed = v.min_and_max_sales_for_this_txn(max_choices = 20)
= select_tag(fieldname, options_for_select(num_allowed), 'data-price' => v.price, 'data-zone' => v.zone_short_name, :class => "itemQty #{ticket_class} form-control form-control-sm col-sm-1")
-# override: if cannot buy just because min_per_txn exceeds availability...
- if num_allowed.last.zero?
%span.text-info.col-sm-4.border.border-danger.s-explain No seats remaining for tickets of this type
- else
= select_tag(fieldname, options_for_select(num_allowed), 'data-price' => v.price, 'data-zone' => v.zone_short_name, :class => "itemQty #{ticket_class} form-control form-control-sm col-sm-1")
%span.text-info.col-sm-4.border.border-danger.s-explain
- if v.max_sales_for_this_patron > 0
= "Insufficient tickets available for offer #{v.display_min_and_max_sales_per_txn}"
- else
= v.explanation
= hidden_field_tag "price[#{v.id}]", v.price, {:id => "valid_voucher_#{v.id}_price"}

- if ! @store.valid_vouchers.empty? && [email protected]?
Expand Down

0 comments on commit 38b2e5d

Please sign in to comment.