-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
182 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,6 @@ | |
- @store.valid_vouchers.each do |v| | ||
%div{:id => "vouchertype_#{v.vouchertype_id}",:class => ['form-group', 'form-row', (v.promo_code.blank? ? 'no-promo' : 'promo')]} | ||
- fieldname = "valid_voucher[#{v.id}]" | ||
- max_sales = [30, v.max_sales_for_this_patron].min | ||
%label.col-form-label.text-right.col-sm-4{:for => "valid_voucher_#{v.id}"}= v.name_with_price | ||
- ticket_class = if v.vouchertype.reservable? then 'ticket' else '' end | ||
- if @gAdminDisplay | ||
|
@@ -42,9 +41,11 @@ | |
.col-sm-7 | ||
%label.col-form-label.form-control-sm.alert-warning.s-explain= v.explanation | ||
- else | ||
= select_tag(fieldname, options_for_select(0..max_sales), 'data-price' => v.price, 'data-zone' => v.zone_short_name, :class => "itemQty #{ticket_class} form-control form-control-sm col-sm-1") | ||
- if max_sales.zero? | ||
%span.text-info.col-sm-7.border.border-danger.s-explain= v.explanation | ||
- num_allowed = v.min_and_max_sales_for_this_txn(max_choices = 20) | ||
- 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") | ||
= hidden_field_tag "price[#{v.id}]", v.price, {:id => "valid_voucher_#{v.id}_price"} | ||
|
||
- if ! @store.valid_vouchers.empty? && [email protected]? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
db/migrate/20230803004141_add_min_max_purchase_to_valid_voucher.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
class AddMinMaxPurchaseToValidVoucher < ActiveRecord::Migration | ||
def change | ||
change_table :valid_vouchers do |t| | ||
t.integer :min_sales_per_txn, :default => 1, :allow_nil => false | ||
t.integer :max_sales_per_txn, :default => ValidVoucher::INFINITE, :allow_nil => false | ||
end | ||
end | ||
end |
10 changes: 10 additions & 0 deletions
10
db/migrate/20230925030503_adjust_infinity_in_max_sales_for_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class AdjustInfinityInMaxSalesForType < ActiveRecord::Migration | ||
# previous code used '999' as an upper bound on max_sales_for_type that means "infinity". | ||
# it should be 10_000 to be consistent with the value of ValidVoucher::INFINITE. | ||
def change | ||
ValidVoucher.where("max_sales_for_type=999"). | ||
update_all(:max_sales_for_type => ValidVoucher::INFINITE) | ||
ValidVoucher.where("max_sales_per_txn=999"). | ||
update_all(:max_sales_per_txn => ValidVoucher::INFINITE) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.