cats_core 1.2.32 → 1.2.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/cats/core/ration_item.rb +1 -1
- data/app/models/cats/core/transport_bid.rb +3 -18
- data/app/models/cats/core/transport_bid_item.rb +2 -4
- data/app/models/cats/core/transport_contract.rb +0 -2
- data/app/models/cats/core/transport_plan.rb +26 -0
- data/app/models/cats/core/transport_plan_item.rb +14 -0
- data/db/migrate/20210717031343_create_cats_core_ration_items.rb +1 -0
- data/db/migrate/20211215114737_create_cats_core_transport_plans.rb +14 -0
- data/db/migrate/20211215114835_create_cats_core_transport_plan_items.rb +22 -0
- data/db/migrate/20211215121151_create_cats_core_transport_bids.rb +4 -5
- data/db/migrate/20211215124452_create_cats_core_transport_bid_items.rb +5 -7
- data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +0 -4
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/ration_items.rb +1 -0
- data/spec/factories/cats/core/transport_bid_items.rb +1 -2
- data/spec/factories/cats/core/transport_bids.rb +1 -2
- data/spec/factories/cats/core/transport_contracts.rb +0 -1
- data/spec/factories/cats/core/transport_plan_items.rb +9 -0
- data/spec/factories/cats/core/transport_plans.rb +7 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 496524a19290b62ba488dca18f3d4f33c650e6af6702381e698cde2dbd6d9497
|
4
|
+
data.tar.gz: e1ca7c19c73a9eb79aec8a25b4ea833501285dac8d715a4779e618f10e0bd519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e600dd3870ed29dc8762c214335c71435761ef87f62370a8408d60aba84a7128355bcf818a94cd24d70f1f727646341d735ecc4b2520c1cdae0ab94b216ac070
|
7
|
+
data.tar.gz: 5028a95e9fd176960f12ebcfab91731737b5928d97f4bcd5a7649325e830d4e1c95817d45351f7e16a61266f1a6eefbdd03977c57393d2ad0c25cb5d34bf54d1
|
@@ -5,7 +5,7 @@ module Cats
|
|
5
5
|
belongs_to :ration
|
6
6
|
belongs_to :unit_of_measure
|
7
7
|
|
8
|
-
validates :amount, presence: true, numericality: { greater_than: 0 }
|
8
|
+
validates :amount, :no_of_days, presence: true, numericality: { greater_than: 0 }
|
9
9
|
|
10
10
|
delegate(:name, to: :commodity_category, prefix: true)
|
11
11
|
delegate(:abbreviation, to: :unit_of_measure, prefix: true)
|
@@ -8,22 +8,17 @@ module Cats
|
|
8
8
|
WINNERS_DECLARED = 'Winner Declared'.freeze
|
9
9
|
STATUSES = [NEW, OPEN, CLOSED, RANKED, WINNERS_DECLARED].freeze
|
10
10
|
|
11
|
-
# Bid types
|
12
|
-
REGIONAL = 'Regional'.freeze
|
13
|
-
NON_REGIONAL = 'Non Regional'.freeze
|
14
|
-
BID_TYPES = [REGIONAL, NON_REGIONAL].freeze
|
15
|
-
|
16
11
|
has_many :transport_bid_items
|
17
12
|
has_many :transport_offers
|
13
|
+
has_many :offer_items, through: :transport_offers
|
18
14
|
belongs_to :region, class_name: 'Cats::Core::Location', optional: true
|
15
|
+
belongs_to :transport_plan
|
19
16
|
|
20
17
|
validates :reference_no, presence: true, uniqueness: true
|
21
|
-
validates :start_date, :end_date, :status, :
|
18
|
+
validates :start_date, :end_date, :status, :bid_bond_amount, presence: true
|
22
19
|
validates :bid_bond_amount, numericality: { greater_than_or_equal_to: 0 }
|
23
20
|
validates :status, inclusion: { in: STATUSES }
|
24
|
-
validates :bid_type, inclusion: { in: BID_TYPES }
|
25
21
|
validate :validate_start_date_against_end_date
|
26
|
-
validate :validate_region
|
27
22
|
|
28
23
|
def validate_start_date_against_end_date
|
29
24
|
return unless start_date && end_date
|
@@ -31,16 +26,6 @@ module Cats
|
|
31
26
|
errors.add(:start_date, 'should be before end date.') if start_date >= end_date
|
32
27
|
end
|
33
28
|
|
34
|
-
def validate_region
|
35
|
-
return unless bid_type
|
36
|
-
|
37
|
-
errors.add(:region, 'should be null.') if bid_type == NON_REGIONAL && region
|
38
|
-
|
39
|
-
errors.add(:region, 'should not be null.') if bid_type == REGIONAL && !region
|
40
|
-
|
41
|
-
errors.add(:region, 'is not valid.') if region && region.location_type != Location::REGION
|
42
|
-
end
|
43
|
-
|
44
29
|
def open
|
45
30
|
raise(StandardError, 'Bid is already open.') if status == OPEN
|
46
31
|
|
@@ -2,15 +2,13 @@ module Cats
|
|
2
2
|
module Core
|
3
3
|
class TransportBidItem < ApplicationRecord
|
4
4
|
belongs_to :transport_bid
|
5
|
-
belongs_to :
|
6
|
-
belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure', optional: true
|
5
|
+
belongs_to :transport_plan_item
|
7
6
|
|
8
7
|
has_many :offer_items
|
9
8
|
|
10
9
|
validates :quantity, presence: true, numericality: { greater_than: 0 }
|
10
|
+
validates :transport_plan_item_id, uniqueness: true
|
11
11
|
|
12
|
-
delegate(:name, to: :route, prefix: true)
|
13
|
-
delegate(:name, to: :unit, prefix: true, allow_nil: true)
|
14
12
|
delegate(:reference_no, to: :transport_bid, prefix: true)
|
15
13
|
end
|
16
14
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class TransportContract < ApplicationRecord
|
4
|
-
belongs_to :region, class_name: 'Cats::Core::Location'
|
5
4
|
belongs_to :transporter
|
6
5
|
belongs_to :transport_bid
|
7
6
|
has_many :contract_items
|
@@ -9,7 +8,6 @@ module Cats
|
|
9
8
|
validates :contract_no, presence: true, uniqueness: true
|
10
9
|
validates :contract_date, :expires_on, presence: true
|
11
10
|
|
12
|
-
delegate(:name, to: :region, prefix: true)
|
13
11
|
delegate(:name, to: :transporter, prefix: true)
|
14
12
|
delegate(:reference_no, to: :transport_bid, prefix: :bid)
|
15
13
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Cats
|
2
|
+
module Core
|
3
|
+
class TransportPlan < ApplicationRecord
|
4
|
+
# Plan types
|
5
|
+
REGIONAL = 'Regional'.freeze
|
6
|
+
NON_REGIONAL = 'Non Regional'.freeze
|
7
|
+
PLAN_TYPES = [REGIONAL, NON_REGIONAL].freeze
|
8
|
+
|
9
|
+
belongs_to :region, class_name: 'Cats::Core::Location', optional: true
|
10
|
+
|
11
|
+
validates :reference_no, presence: true, uniqueness: true
|
12
|
+
validates :plan_type, presence: true, inclusion: { in: PLAN_TYPES }
|
13
|
+
validate :validate_region
|
14
|
+
|
15
|
+
def validate_region
|
16
|
+
return unless plan_type
|
17
|
+
|
18
|
+
errors.add(:region, 'should be null.') if plan_type == NON_REGIONAL && region
|
19
|
+
|
20
|
+
errors.add(:region, 'should not be null.') if plan_type == REGIONAL && !region
|
21
|
+
|
22
|
+
errors.add(:region, 'is not valid.') if region && region.location_type != Location::REGION
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Cats
|
2
|
+
module Core
|
3
|
+
class TransportPlanItem < ApplicationRecord
|
4
|
+
belongs_to :route
|
5
|
+
belongs_to :transport_plan
|
6
|
+
belongs_to :unit, class_name: 'Cats::Core::UnitOfMeasure'
|
7
|
+
|
8
|
+
validates :quantity, presence: true, numericality: { greater_than: 0 }
|
9
|
+
|
10
|
+
delegate(:name, to: :route, prefix: true)
|
11
|
+
delegate(:name, to: :unit, prefix: true)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateCatsCoreTransportPlans < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :cats_core_transport_plans do |t|
|
4
|
+
t.string :reference_no, unique: true
|
5
|
+
t.string :plan_type, null: false, default: 'Regional'
|
6
|
+
t.references :region,
|
7
|
+
null: true,
|
8
|
+
index: { name: 'region_on_tp_indx' },
|
9
|
+
foreign_key: { to_table: :cats_core_locations }
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateCatsCoreTransportPlanItems < ActiveRecord::Migration[6.1]
|
2
|
+
def change
|
3
|
+
create_table :cats_core_transport_plan_items do |t|
|
4
|
+
t.references :route,
|
5
|
+
null: false,
|
6
|
+
index: { name: 'route_on_tpi_indx' },
|
7
|
+
foreign_key: { to_table: :cats_core_routes }
|
8
|
+
t.references :transport_plan,
|
9
|
+
null: false,
|
10
|
+
index: { name: 'tp_on_tpi_indx' },
|
11
|
+
foreign_key: { to_table: :cats_core_transport_plans }
|
12
|
+
t.float :quantity, null: false
|
13
|
+
t.references :unit,
|
14
|
+
null: false,
|
15
|
+
index: { name: 'unit_on_tpi_indx' },
|
16
|
+
foreign_key: { to_table: :cats_core_unit_of_measures }
|
17
|
+
t.boolean :planned, null: false, default: false
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -6,12 +6,11 @@ class CreateCatsCoreTransportBids < ActiveRecord::Migration[6.1]
|
|
6
6
|
t.date :start_date, null: false
|
7
7
|
t.date :end_date, null: false
|
8
8
|
t.string :status, null: false, default: 'New'
|
9
|
-
t.string :bid_type, null: false, default: 'Regional'
|
10
|
-
t.references :region,
|
11
|
-
null: true,
|
12
|
-
index: { name: 'region_on_tb_indx' },
|
13
|
-
foreign_key: { to_table: :cats_core_locations }
|
14
9
|
t.float :bid_bond_amount, null: false, default: 0
|
10
|
+
t.references :transport_plan,
|
11
|
+
null: false,
|
12
|
+
index: { name: 'tp_on_tb_indx' },
|
13
|
+
foreign_key: { to_table: :cats_core_transport_plans }
|
15
14
|
|
16
15
|
t.timestamps
|
17
16
|
end
|
@@ -5,17 +5,15 @@ class CreateCatsCoreTransportBidItems < ActiveRecord::Migration[6.1]
|
|
5
5
|
null: false,
|
6
6
|
index: { name: 'tb_on_tbi_indx' },
|
7
7
|
foreign_key: { to_table: :cats_core_transport_bids }
|
8
|
-
t.references :
|
8
|
+
t.references :transport_plan_item,
|
9
9
|
null: false,
|
10
|
-
index: { name: '
|
11
|
-
foreign_key: { to_table: :
|
12
|
-
t.references :unit,
|
13
|
-
null: true,
|
14
|
-
index: { name: 'unit_on_tbi_indx' },
|
15
|
-
foreign_key: { to_table: :cats_core_unit_of_measures }
|
10
|
+
index: { name: 'tpi_on_tbi_indx' },
|
11
|
+
foreign_key: { to_table: :cats_core_transport_plan_items }
|
16
12
|
t.float :quantity, null: false
|
17
13
|
|
18
14
|
t.timestamps
|
19
15
|
end
|
16
|
+
|
17
|
+
add_index :cats_core_transport_bid_items, :transport_plan_item_id, unique: true
|
20
18
|
end
|
21
19
|
end
|
@@ -2,10 +2,6 @@ class CreateCatsCoreTransportContracts < ActiveRecord::Migration[6.1]
|
|
2
2
|
def change
|
3
3
|
create_table :cats_core_transport_contracts do |t|
|
4
4
|
t.string :contract_no, unique: true
|
5
|
-
t.references :region,
|
6
|
-
null: false,
|
7
|
-
index: { name: 'region_on_tc_indx' },
|
8
|
-
foreign_key: { to_table: :cats_core_locations }
|
9
5
|
t.references :transporter,
|
10
6
|
null: false,
|
11
7
|
index: { name: 'transporter_on_tc_indx' },
|
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.36
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -296,6 +296,8 @@ files:
|
|
296
296
|
- app/models/cats/core/transport_bid_item.rb
|
297
297
|
- app/models/cats/core/transport_contract.rb
|
298
298
|
- app/models/cats/core/transport_offer.rb
|
299
|
+
- app/models/cats/core/transport_plan.rb
|
300
|
+
- app/models/cats/core/transport_plan_item.rb
|
299
301
|
- app/models/cats/core/transporter.rb
|
300
302
|
- app/models/cats/core/unit_of_measure.rb
|
301
303
|
- app/models/cats/core/user.rb
|
@@ -367,6 +369,8 @@ files:
|
|
367
369
|
- db/migrate/20211002050739_create_cats_core_notification_rules.rb
|
368
370
|
- db/migrate/20211024063240_add_status_to_cats_core_rhn_requests.rb
|
369
371
|
- db/migrate/20211030133752_add_status_to_cats_core_commodities.rb
|
372
|
+
- db/migrate/20211215114737_create_cats_core_transport_plans.rb
|
373
|
+
- db/migrate/20211215114835_create_cats_core_transport_plan_items.rb
|
370
374
|
- db/migrate/20211215121151_create_cats_core_transport_bids.rb
|
371
375
|
- db/migrate/20211215124452_create_cats_core_transport_bid_items.rb
|
372
376
|
- db/migrate/20211229160125_create_cats_core_transport_offers.rb
|
@@ -423,6 +427,8 @@ files:
|
|
423
427
|
- spec/factories/cats/core/transport_bids.rb
|
424
428
|
- spec/factories/cats/core/transport_contracts.rb
|
425
429
|
- spec/factories/cats/core/transport_offers.rb
|
430
|
+
- spec/factories/cats/core/transport_plan_items.rb
|
431
|
+
- spec/factories/cats/core/transport_plans.rb
|
426
432
|
- spec/factories/cats/core/transporters.rb
|
427
433
|
- spec/factories/cats/core/unit_of_measures.rb
|
428
434
|
- spec/factories/cats/core/users.rb
|