Skip to content

Commit

Permalink
fix formatting errors in min/max explanations
Browse files Browse the repository at this point in the history
  • Loading branch information
armandofox committed Dec 5, 2023
1 parent 3f14b05 commit cef25ed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/models/valid_voucher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,13 @@ 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 =
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"
else "#{max_sales_for_this_patron} remaining"
when INFINITE then "No performance-specific limit applies #{min_max}".strip
else "#{max_sales_for_this_patron} remaining #{min_max}".strip
end
self.explanation << " " << display_min_and_max_sales_per_txn
self.visible = true
end

Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20231205042317_adjust_default_max_sales_per_txn.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AdjustDefaultMaxSalesPerTxn < ActiveRecord::Migration
def change
change_column :valid_vouchers, :max_sales_per_txn, :integer, :default => ValidVoucher::INFINITE, :allow_nil => false
end
end
10 changes: 5 additions & 5 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20230925030503) do
ActiveRecord::Schema.define(version: 20231205042317) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -319,11 +319,11 @@
t.string "promo_code", limit: 1023
t.datetime "start_sales"
t.datetime "end_sales"
t.integer "max_sales_for_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "max_sales_for_type", default: 100000
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "min_sales_per_txn", default: 1
t.integer "max_sales_per_txn", default: 999
t.integer "max_sales_per_txn", default: 100000
end

add_index "valid_vouchers", ["showdate_id"], name: "index_valid_vouchers_on_showdate_id", using: :btree
Expand Down

0 comments on commit cef25ed

Please sign in to comment.