Class: ReservationVoucher
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ReservationVoucher
- Defined in:
- app/models/reservation_voucher.rb
Overview
Voucher quota is voucher.reservation_vouchers.active_scope.count
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Instance Method Details
#assign_amount_voucher ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/reservation_voucher.rb', line 16 def assign_amount_voucher amount_voucher = if voucher.deductible? deductible.present? ? deductible.usage_amount.amount.to_d : 0 elsif voucher.percentage? reservation_used_amount elsif voucher.pack? || voucher.person? determine_amount_voucher_level else voucher.amount.amount.to_d end update(amount: amount_voucher) end |