Class: Workarea::Pricing::Discount::QuantityFixedPrice::ApplicationCalculator
- Inherits:
-
Object
- Object
- Workarea::Pricing::Discount::QuantityFixedPrice::ApplicationCalculator
- Defined in:
- app/models/workarea/pricing/discount/quantity_fixed_price/application_calculator.rb
Overview
Responsible for calcuating a how many applicaitons a given set of items should recieve a Workarea::Pricing::Discount::QuantityFixedPrice. Limits at max application is set.
Instance Method Summary collapse
-
#applications ⇒ Integer
The number of applications these items can recieve.
-
#initialize(discount, items) ⇒ ApplicationCalculator
constructor
A new instance of ApplicationCalculator.
Constructor Details
#initialize(discount, items) ⇒ ApplicationCalculator
Returns a new instance of ApplicationCalculator.
12 13 14 15 |
# File 'app/models/workarea/pricing/discount/quantity_fixed_price/application_calculator.rb', line 12 def initialize(discount, items) @discount = discount @items = items end |
Instance Method Details
#applications ⇒ Integer
The number of applications these items can recieve.
21 22 23 24 25 26 27 28 |
# File 'app/models/workarea/pricing/discount/quantity_fixed_price/application_calculator.rb', line 21 def applications if max_applications.present? && potential_applications > max_applications max_applications else potential_applications end end |