diff --git a/app/models/valid_voucher.rb b/app/models/valid_voucher.rb index 815a9197b..8fbe06f74 100644 --- a/app/models/valid_voucher.rb +++ b/app/models/valid_voucher.rb @@ -200,6 +200,7 @@ def adjust_for_capacity when INFINITE then "No performance-specific limit applies" else "#{max_sales_for_this_patron} remaining" end + self.explanation << " " << display_min_and_max_sales_per_txn self.visible = true end diff --git a/app/views/store/_ticket_menus.html.haml b/app/views/store/_ticket_menus.html.haml index b91d09175..b54906da3 100644 --- a/app/views/store/_ticket_menus.html.haml +++ b/app/views/store/_ticket_menus.html.haml @@ -44,7 +44,7 @@ - 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") - if num_allowed.last.zero? - %span.text-info.col-sm-7.border.border-danger.s-explain= v.explanation + %span.text-info.col-sm-7.border.border-danger.s-explain No seats remaining for tickets of this type = hidden_field_tag "price[#{v.id}]", v.price, {:id => "valid_voucher_#{v.id}_price"} - if ! @store.valid_vouchers.empty? && !@store.sd.stream? diff --git a/config/locales/en.yml b/config/locales/en.yml index 9acd15890..02de4eee2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3,6 +3,7 @@ en: attributes: valid_voucher: min_sales_per_txn: "Minimum purchase per transaction" + max_sales_per_txn: "Maximum purchase per transaction" reports: revenue_details: diff --git a/spec/models/valid_voucher_spec.rb b/spec/models/valid_voucher_spec.rb index 9bcd7d269..05d0735e0 100644 --- a/spec/models/valid_voucher_spec.rb +++ b/spec/models/valid_voucher_spec.rb @@ -10,16 +10,14 @@ end end - describe "has a friendly error message for min_sales_per_txn" do - specify "for min_sales_per_txn" do - @v = build(:valid_voucher) - @v.min_sales_per_txn = -1 - expect(@v).not_to be_valid - expect(@v.errors.full_messages).to include_match_for /^Minimum purchase per transaction must be blank, or greater than or equal to 1$/ - end + it "has a friendly error message for min/max_sales_per_txn" do + @v = build(:valid_voucher) + @v.min_sales_per_txn = @v.max_sales_per_txn = -1 + expect(@v).not_to be_valid + expect(@v.errors.full_messages).to include_match_for /^Minimum purchase per transaction must be blank, or greater than or equal to 1$/ + expect(@v.errors.full_messages).to include_match_for /^Maximum purchase per transaction must be blank, or greater than or equal to 1$/ end - describe "seats remaining" do subject do ValidVoucher.new(