Sha256: 148c6303d906234842bccf759e97bbe96fa0532ef350e1a56c6027a9df409f3e
Contents?: true
Size: 978 Bytes
Versions: 9
Compression:
Stored size: 978 Bytes
Contents
module Logistics module Core class BreakBulkDemurrageRate < ApplicationRecord belongs_to :break_bulk_unit belongs_to :transaction_type belongs_to :demurrage_rate_period def self.generate_demurage_rate(rate_period_id, effective_date) transaction_types = get_transaction_types break_bulk_units = get_break_bulk_units transaction_types.each { |tt| break_bulk_units.each{ |bb| bdr = BreakBulkDemurrageRate.where('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id, 'break_bulk_unit_id' => bb.id) if bdr.count == 0 BreakBulkDemurrageRate.create('transaction_type_id' => tt.id, 'demurage_rate_period_id' => rate_period_id, 'break_bulk_unit_id' => bb.id, 'rate' => 0, 'effective_date' => effective_date) end } } end end end end
Version data entries
9 entries across 9 versions & 1 rubygems