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 +4 -4
- data/app/models/cats/core/transport_bid.rb +4 -1
- data/app/models/cats/core/transport_bid_item.rb +1 -0
- data/app/models/cats/core/transport_contract.rb +1 -0
- data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +4 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/transport_contracts.rb +1 -0
- metadata +3 -5
- data/app/models/cats/core/transport_request.rb +0 -46
- data/app/models/cats/core/transport_request_item.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0b78245442c046287e1a2ddf16e27d33031ebe242b38e6363eaae738e792d92
|
4
|
+
data.tar.gz: 83613611f8a6a31cab227fbc540afbacc35585c87df76a30ea6eb2bcbd8beb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
@@ -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
|
data/lib/cats/core/version.rb
CHANGED
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.
|
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-
|
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:
|
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
|