Sha256: 001fd12bc76ed7b976216ed5214f8252b76b380d729069a4c0b22fe6a60e923b

Contents?: true

Size: 582 Bytes

Versions: 9

Compression:

Stored size: 582 Bytes

Contents

module Logistics
  module Core
    class DemurrageRatePeriod < ApplicationRecord
      validates :carrier_agent, :from, :to, :rate_period, presence: true
      belongs_to :carrier_agent

      def self.generate_carrier_agent_matrix
        carrier_agents = CarrierAgent.all
        carrier_agents.each { |carrier_agent|
          ca = DemurrageRatePeriod.where('carrier_agent_id' => carrier_agent.id)
          if ca.count == 0
            DemurrageRatePeriod.create('carrier_agent_id' => carrier_agent.id, 'from' => 0, 'to' => 0)
          end
        }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logistics_core-21.11.2 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-21.11.1 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-21.08.1 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-21.03.1 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-20.10.3 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-20.10.2 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-20.10.1 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-20.9.1 app/models/logistics/core/demurrage_rate_period.rb
logistics_core-20.8.1 app/models/logistics/core/demurrage_rate_period.rb