Class: Workarea::PriceAdjustment
- Inherits:
-
Object
- Object
- Workarea::PriceAdjustment
- Includes:
- ApplicationDocument
- Defined in:
- app/models/workarea/price_adjustment.rb
Instance Method Summary collapse
-
#discount? ⇒ Boolean
Whether this adjustment was a discount.
-
#unit ⇒ Money
The cost per-unit of this price adjustment.
Methods included from ApplicationDocument
Methods included from Sidekiq::Callbacks
add_worker, assert_valid_config!, async, caching_classes?, disable, enable, inline, #run_callbacks, workers, workers_list
Methods included from Mongoid::Document
Instance Method Details
#discount? ⇒ Boolean
Whether this adjustment was a discount. A price adjustment is considered a discount if its amount is less than zero and not a pricing override, or it has discount data.
42 43 44 |
# File 'app/models/workarea/price_adjustment.rb', line 42 def discount? (amount < 0 && data['override'].nil?) || data['discount_value'].present? end |
#unit ⇒ Money
The cost per-unit of this price adjustment.
32 33 34 |
# File 'app/models/workarea/price_adjustment.rb', line 32 def unit amount / quantity end |