cats_core 1.2.22 → 1.2.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5139b115f1503157e1d5f53a0a013b72d1296a0cd1fe808c1fd117a4a813830
4
- data.tar.gz: eaf56d0ba167f6360144a4d7e6152eba2e0375b7c272ea271cfc9805178e781b
3
+ metadata.gz: f0b78245442c046287e1a2ddf16e27d33031ebe242b38e6363eaae738e792d92
4
+ data.tar.gz: 83613611f8a6a31cab227fbc540afbacc35585c87df76a30ea6eb2bcbd8beb5d
5
5
  SHA512:
6
- metadata.gz: bad07930acac569a78aee9152527d95c390f48eb3a69070894c888a3ff8de74f07f0904730aa59446b17a9b1979a0cdbd8e898b23eeb231b1693f449f664be7b
7
- data.tar.gz: ab180af55c2610e87a0f1f7f7f1031a8730f9cccbae2ea1c0f5bc58cc6cf219dfac657e3078624e2624f38230b950dd49d708d44691f8ed47db55652262852d3
6
+ metadata.gz: ef654680cb95d92056bfc92ff73e1c8cc56cddc5f4749428e66a94a4e3fdc7522198091f52009f364b57cd0a03f25049c1fdbe09c2c87e7565b9a520359871a0
7
+ data.tar.gz: 33ff4b09f447fcc0a3554b310594ea497de2160b3ff5588118332386b9ad352b126b92dcbc670aa485157c050572b4965d47dc6531193e21e6ea6cab0c7012c9
@@ -4,9 +4,12 @@ module Cats
4
4
  NEW = 'New'.freeze
5
5
  OPEN = 'Open'.freeze
6
6
  CLOSED = 'Closed'.freeze
7
- STATUSES = [NEW, OPEN, CLOSED].freeze
7
+ RANKED = 'Ranked'.freeze
8
+ WINNERS_DECLARED = 'Winner Declared'.freeze
9
+ STATUSES = [NEW, OPEN, CLOSED, RANKED, WINNERS_DECLARED].freeze
8
10
 
9
11
  has_many :transport_bid_items
12
+ has_many :transport_offers, through: :transport_bid_items
10
13
 
11
14
  validates :reference_no, presence: true, uniqueness: true
12
15
  validates :start_date, :end_date, :status, presence: true
@@ -11,6 +11,7 @@ module Cats
11
11
 
12
12
  delegate(:name, to: :route, prefix: true)
13
13
  delegate(:name, to: :unit, prefix: true, allow_nil: true)
14
+ delegate(:reference_no, to: :transport_bid, prefix: true)
14
15
  end
15
16
  end
16
17
  end
@@ -3,6 +3,7 @@ module Cats
3
3
  class TransportContract < ApplicationRecord
4
4
  belongs_to :region, class_name: 'Cats::Core::Location'
5
5
  belongs_to :transporter
6
+ belongs_to :transport_bid
6
7
 
7
8
  validates :contract_date, :expires_on, presence: true
8
9
  end
@@ -9,6 +9,10 @@ class CreateCatsCoreTransportContracts < ActiveRecord::Migration[6.1]
9
9
  null: false,
10
10
  index: { name: 'transporter_on_tc_indx' },
11
11
  foreign_key: { to_table: :cats_core_transporters }
12
+ t.references :transport_bid,
13
+ null: false,
14
+ index: { name: 'tb_on_tc_indx' },
15
+ foreign_key: { to_table: :cats_core_transport_bids }
12
16
  t.date :contract_date, null: false
13
17
  t.date :expires_on, null: false
14
18
  t.string :payment_term
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.2.22'.freeze
3
+ VERSION = '1.2.26'.freeze
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ FactoryBot.define do
2
2
  factory :transport_contract, class: 'Cats::Core::TransportContract' do
3
3
  region factory: :location
4
4
  transporter
5
+ transport_bid
5
6
  contract_date { Date.today }
6
7
  expires_on { Date.today + 6.month }
7
8
  payment_term { FFaker::Name.name }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.22
4
+ version: 1.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-18 00:00:00.000000000 Z
11
+ date: 2021-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -295,8 +295,6 @@ files:
295
295
  - app/models/cats/core/transport_bid_item.rb
296
296
  - app/models/cats/core/transport_contract.rb
297
297
  - app/models/cats/core/transport_offer.rb
298
- - app/models/cats/core/transport_request.rb
299
- - app/models/cats/core/transport_request_item.rb
300
298
  - app/models/cats/core/transporter.rb
301
299
  - app/models/cats/core/unit_of_measure.rb
302
300
  - app/models/cats/core/user.rb
@@ -441,7 +439,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
441
439
  requirements:
442
440
  - - ">="
443
441
  - !ruby/object:Gem::Version
444
- version: '0'
442
+ version: 3.0.2
445
443
  required_rubygems_version: !ruby/object:Gem::Requirement
446
444
  requirements:
447
445
  - - ">="
@@ -1,46 +0,0 @@
1
- module Cats
2
- module Core
3
- class TransportRequest < ApplicationRecord
4
- DRAFT = 'Draft'.freeze
5
- APPROVED = 'Approved'.freeze
6
- OPEN = 'Open'.freeze
7
- CLOSED = 'Closed'.freeze
8
- STATUSES = [DRAFT, APPROVED, OPEN, CLOSED].freeze
9
-
10
- belongs_to :requested_by, class_name: 'Cats::Core::User'
11
- belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
12
- has_many :transport_request_items
13
-
14
- validates :reference_no, :request_date, :status, presence: true
15
- validates :reference_no, uniqueness: true
16
- validates :status, inclusion: { in: STATUSES }
17
-
18
- delegate(:full_name, to: :requested_by, prefix: true, allow_nil: true)
19
- delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
20
-
21
- def approve(approver)
22
- raise(StandardError, 'Request is not open for approval.') unless status == DRAFT
23
-
24
- raise(StandardError, 'Request is empty.') if transport_request_items.count.zero?
25
-
26
- self.approved_by = approver
27
- self.status = APPROVED
28
- save!
29
- end
30
-
31
- def open
32
- raise(StandardError, 'Request is not approved for opening.') unless status == APPROVED
33
-
34
- self.status = OPEN
35
- save!
36
- end
37
-
38
- def close
39
- raise(StandardError, 'Request is not open.') unless status == OPEN
40
-
41
- self.status = CLOSED
42
- save!
43
- end
44
- end
45
- end
46
- end
@@ -1,16 +0,0 @@
1
- module Cats
2
- module Core
3
- class TransportRequestItem < ApplicationRecord
4
- belongs_to :transport_request
5
- belongs_to :source, class_name: 'Cats::Core::Location'
6
- belongs_to :destination, class_name: 'Cats::Core::Location'
7
- belongs_to :commodity
8
-
9
- has_many :transport_offers
10
-
11
- delegate(:name, to: :source, prefix: true)
12
- delegate(:name, to: :destination, prefix: true)
13
- delegate(:name, to: :commodity, prefix: true)
14
- end
15
- end
16
- end