Class: Calculator::FlatInRange
- Inherits:
-
Calculator
- Object
- Calculator
- Calculator::FlatInRange
- Defined in:
- app/models/spree/calculator/flat_in_range.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.description ⇒ Object
7 8 9 |
# File 'app/models/spree/calculator/flat_in_range.rb', line 7 def self.description I18n.t(:flat_in_range) end |
Instance Method Details
#compute(object) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'app/models/spree/calculator/flat_in_range.rb', line 11 def compute(object) sum = 0 item_total = object.line_items.map(&:amount).sum if (item_total >= self.preferred_lower_boundry && item_total <= self.preferred_upper_boundry) return self.preferred_amount else return 0.0 end end |