cats_core 1.4.10 → 1.4.13
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_order.rb +8 -1
- data/app/models/cats/core/transport_order_item.rb +4 -1
- data/db/migrate/20220506082329_create_cats_core_transport_orders.rb +2 -1
- data/db/migrate/20220506083042_create_cats_core_transport_order_items.rb +0 -1
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/transport_order_items.rb +0 -1
- data/spec/factories/cats/core/transport_orders.rb +2 -6
- data/spec/factories/cats/core/transport_requisitions.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a2d3b649cc7d706426630befadcda681cb80e886fb1347a9621c2c2db38a6c
|
4
|
+
data.tar.gz: fb61fef9d7d60138b51e833009f467389ce76323c72cbe32d96b5016ca93f26f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '090040e502dd0cca57b485ec9fd17deed37c9fec16d3ac39ee28e274b82ebacc2e9a77e38942e5cfdbc864c843de3c820ea0b4e469422694351a15754a7c3e9d'
|
7
|
+
data.tar.gz: b98de5aa7d98ce805bf738c3250268f2746fcf212233b9e3bbd30d87b072e98e54e03a53f490d90762182ad2b3387667fd460ef6aeb480a8c14fcb6c46b2d052
|
@@ -7,11 +7,18 @@ module Cats
|
|
7
7
|
|
8
8
|
belongs_to :transport_requisition
|
9
9
|
belongs_to :prepared_by, class_name: 'Cats::Core::User'
|
10
|
-
belongs_to :approved_by, class_name: 'Cats::Core::User'
|
10
|
+
belongs_to :approved_by, class_name: 'Cats::Core::User', optional: true
|
11
|
+
|
12
|
+
has_many :transport_order_items
|
11
13
|
|
12
14
|
validates :status, presence: true, inclusion: { in: STATUSES }
|
15
|
+
validates :order_date, presence: true
|
13
16
|
validate :validate_against_requisition
|
14
17
|
|
18
|
+
delegate(:full_name, to: :prepared_by, prefix: true)
|
19
|
+
delegate(:full_name, to: :approved_by, prefix: true, allow_nil: true)
|
20
|
+
delegate(:reference_no, to: :transport_requisition, prefix: 'requisition')
|
21
|
+
|
15
22
|
def validate_against_requisition
|
16
23
|
return unless transport_requisition
|
17
24
|
|
@@ -6,11 +6,14 @@ module Cats
|
|
6
6
|
belongs_to :transport_requisition_item
|
7
7
|
belongs_to :transport_contract, optional: true
|
8
8
|
|
9
|
-
validates :
|
9
|
+
validates :valid_for, presence: true
|
10
10
|
validates :valid_for, numericality: { greater_than: 0 }
|
11
11
|
validates :transport_requisition_item_id, uniqueness: true
|
12
12
|
validate :validate_requisition
|
13
13
|
|
14
|
+
delegate(:name, to: :transporter, prefix: true)
|
15
|
+
delegate(:contract_no, to: :transport_contract, prefix: false)
|
16
|
+
|
14
17
|
def validate_requisition
|
15
18
|
return unless transport_requisition_item
|
16
19
|
|
@@ -10,9 +10,10 @@ class CreateCatsCoreTransportOrders < ActiveRecord::Migration[7.0]
|
|
10
10
|
index: { name: 'pb_on_to_indx' },
|
11
11
|
foreign_key: { to_table: :cats_core_users }
|
12
12
|
t.references :approved_by,
|
13
|
-
null:
|
13
|
+
null: true,
|
14
14
|
index: { name: 'ab_on_to_indx' },
|
15
15
|
foreign_key: { to_table: :cats_core_users }
|
16
|
+
t.date :order_date, null: false
|
16
17
|
t.string :status, null: false, default: 'Draft'
|
17
18
|
|
18
19
|
t.timestamps
|
@@ -17,7 +17,6 @@ class CreateCatsCoreTransportOrderItems < ActiveRecord::Migration[7.0]
|
|
17
17
|
null: false,
|
18
18
|
index: { name: 'tri_on_toi_indx' },
|
19
19
|
foreign_key: { to_table: :cats_core_transport_requisition_items }
|
20
|
-
t.date :order_date, null: false, default: Date.today
|
21
20
|
t.integer :valid_for, null: false, default: 10
|
22
21
|
|
23
22
|
t.timestamps
|
data/lib/cats/core/version.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :transport_order, class: 'Cats::Core::TransportOrder' do
|
3
|
-
transport_requisition
|
4
|
-
requisition = create(:transport_requisition)
|
5
|
-
create(:transport_requisition_item, transport_requisition: requisition)
|
6
|
-
requisition.approve
|
7
|
-
requisition
|
8
|
-
end
|
3
|
+
association :transport_requisition, :approved
|
9
4
|
prepared_by factory: :user
|
10
5
|
approved_by factory: :user
|
6
|
+
order_date { Date.today }
|
11
7
|
status { Cats::Core::TransportOrder::DRAFT }
|
12
8
|
end
|
13
9
|
end
|
@@ -6,5 +6,12 @@ FactoryBot.define do
|
|
6
6
|
approved_by factory: :user
|
7
7
|
status { Cats::Core::TransportRequisition::DRAFT }
|
8
8
|
unit factory: :unit_of_measure
|
9
|
+
|
10
|
+
trait :approved do
|
11
|
+
after(:create) do |requisition|
|
12
|
+
create(:transport_requisition_item, transport_requisition: requisition)
|
13
|
+
requisition.approve
|
14
|
+
end
|
15
|
+
end
|
9
16
|
end
|
10
17
|
end
|
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.4.
|
4
|
+
version: 1.4.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|