Skip to content

Commit

Permalink
fix typo in controller and typo in validation error for min_sales_per…
Browse files Browse the repository at this point in the history
…_txn>max_sales_per_txn
  • Loading branch information
armandofox committed Oct 20, 2023
1 parent d22ba17 commit a2f1130
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/valid_vouchers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def set_arg_defaults_if_blank!(args)
# this should be done with strong params
# supply defaults for min/max_sales_for_type and max_sales_per_txn if blank
args[:min_sales_per_txn] = 1 if args[:min_sales_per_txn].blank?
args[:max_sales_for_type, :max_sales_per_txn].each do |attrib|
[:max_sales_for_type, :max_sales_per_txn].each do |attrib|
args[attrib] = ValidVoucher::INFINITE if args[attrib].blank?
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/valid_voucher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def self_service_comps_must_have_promo_code
def min_max_sales_constraints
errors.add :min_sales_per_txn, "cannot be greater than max allowed sales of this type" if
min_sales_per_txn > max_sales_for_type
errors.add :min_sales_per_txn, "cannot be greater than minimum purchase per transaction" if
errors.add :min_sales_per_txn, "cannot be greater than maximum purchase per transaction" if
min_sales_per_txn > max_sales_per_txn
errors.empty?
end
Expand Down

0 comments on commit a2f1130

Please sign in to comment.