Class: Workarea::PriceAdjustment

Inherits:
Object
  • Object
show all
Includes:
ApplicationDocument
Defined in:
app/models/workarea/price_adjustment.rb

Instance Method Summary collapse

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

assert_valid_config!, async, disable, enable, inline, #run_callbacks

Methods included from Mongoid::Document

#embedded_children

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.

Returns:

  • (Boolean)


42
43
44
# File 'app/models/workarea/price_adjustment.rb', line 42

def discount?
  (amount < 0 && data['override'].nil?) || data['discount_value'].present?
end

#unitMoney

The cost per-unit of this price adjustment.

Returns:



32
33
34
# File 'app/models/workarea/price_adjustment.rb', line 32

def unit
  amount / quantity
end