Class: Logistics::Core::DemurrageRate
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Logistics::Core::DemurrageRate
- Defined in:
- app/models/logistics/core/demurrage_rate.rb
Class Method Summary collapse
Methods inherited from ApplicationRecord
Class Method Details
.generate_demurage_rate(rate_period_id) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/models/logistics/core/demurrage_rate.rb', line 7 def self.generate_demurage_rate(rate_period_id) unit_of_charges = UnitOfCharge.all unit_of_charges.each { |unit_of_charge| uoc = DemurrageRate.where('unit_of_charge_id' => unit_of_charge.id, 'demurage_rate_period_id' => rate_period_id) if uoc.count == 0 DemurrageRate.create('unit_of_charge_id' => unit_of_charge.id, 'demurage_rate_period_id' => rate_period_id, 'rate' => 0) end } end |