cats_core 1.0.23 → 1.0.24
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42be12240a7c83fb5885cf25ae71c6926078e982975b6b07d9a3b60cc5c355c3
|
4
|
+
data.tar.gz: 7479ddfee27ddc4f2e7de0b4f40b8efd3e218026cb51ba3bbeb9ea77f8b2ade8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3640d304c753328131f660578553eda3bfc50fb98e955a86b35eca4fa3efff58fbe069dcddce891001a566069dc2f3da48a361adb577fbf71a9cca96d56b1f60
|
7
|
+
data.tar.gz: 85786685e2667ac62d0f73d793c78efcbe3c5bebe18524d1c6402acc5188cf60670f0dbfabc9f5229ef4bf3941907c918433bb713758b7077bfe21f62dc06123
|
@@ -6,12 +6,20 @@ module Cats
|
|
6
6
|
DAMAGED = 'Damaged'.freeze
|
7
7
|
COMMODITY_STATUSES = [GOOD, DAMAGED].freeze
|
8
8
|
|
9
|
+
# Arrival Statuses
|
10
|
+
AT_SOURCE = 'At Source'.freeze
|
11
|
+
IN_TRANSIT = 'In Transit'.freeze
|
12
|
+
ARRIVED = 'Arrived'.freeze
|
13
|
+
ARRIVAL_STATUSES = [AT_SOURCE, IN_TRANSIT, ARRIVED].freeze
|
14
|
+
|
9
15
|
belongs_to :unit_of_measure
|
10
16
|
belongs_to :source, polymorphic: true
|
11
17
|
|
12
18
|
validates :best_use_before, presence: true
|
19
|
+
validates :batch_no, presence: true, uniqueness: true
|
13
20
|
validates :quantity, presence: true, numericality: { greater_than: 0 }
|
14
21
|
validates :volume_per_metric_ton, numericality: { greater_than: 0, allow_nil: true }
|
22
|
+
validates :arrival_status, presence: true, inclusion: { in: ARRIVAL_STATUSES }
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
|
2
2
|
def change
|
3
3
|
create_table :cats_core_commodities do |t|
|
4
|
+
t.string :batch_no, unique: true
|
4
5
|
t.references :unit_of_measure,
|
5
6
|
null: false,
|
6
7
|
index: { name: 'uom_on_commodities_indx' },
|
@@ -10,6 +11,7 @@ class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
|
|
10
11
|
t.string :description
|
11
12
|
t.date :best_use_before, null: false
|
12
13
|
t.float :volume_per_metric_ton
|
14
|
+
t.string :arrival_status, null: false, default: 'At Source'
|
13
15
|
|
14
16
|
t.timestamps
|
15
17
|
end
|
data/lib/cats/core/version.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :commodity, class: 'Cats::Core::Commodity' do
|
3
|
+
batch_no { FFaker::Name.name }
|
3
4
|
description { FFaker::Name.name }
|
4
5
|
unit_of_measure
|
5
6
|
source factory: :gift_certificate
|
6
7
|
quantity { 100 }
|
7
8
|
best_use_before { Date.today + 2.month }
|
8
9
|
volume_per_metric_ton { 10 }
|
10
|
+
arrival_status { Cats::Core::Commodity::AT_SOURCE }
|
9
11
|
end
|
10
12
|
end
|