Sha256: 3d314fc0b53b40b3e7085863119b03c119412bbd43be918d60cebe25750163b1
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
module Logistics module Core class BreakBulkStorageRate < ApplicationRecord belongs_to :break_bulk_unit belongs_to :transaction_type belongs_to :warehouse_rate_period belongs_to :content_type def self.generate_storage_rate(rate_period_id, effective_date) transaction_types = TransactionType.all break_bulk_units = BreakBulkUnit.all content_types = ContentType.all transaction_types.each { |tt| break_bulk_units.each{ |bb| content_types.each { |ct| bsr = BreakBulkStorageRate.where('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id, 'break_bulk_unit_id' => bb.id, 'content_type_id' => ct.id) if bsr.count == 0 BreakBulkStorageRate.create('transaction_type_id' => tt.id, 'warehouse_rate_period_id' => rate_period_id, 'content_type_id' => ct.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