cats_core 1.0.23 → 1.0.24

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fdf3896b40c9ff598fa14a38d5f7a32b6dab30c3e72f7f3b16b480579df3a073
4
- data.tar.gz: d60e1032a3b708fa85a8372e58e899f45ec41fee42ce909c4b3117278c44ee59
3
+ metadata.gz: 42be12240a7c83fb5885cf25ae71c6926078e982975b6b07d9a3b60cc5c355c3
4
+ data.tar.gz: 7479ddfee27ddc4f2e7de0b4f40b8efd3e218026cb51ba3bbeb9ea77f8b2ade8
5
5
  SHA512:
6
- metadata.gz: 8364011f2d5dc631bcfa08396111bec092f85d37baba59fc327c993bf73b98a3d555432670be77d0933834be539c4c113df156df0d51378a44a881583d954400
7
- data.tar.gz: '034875a3d26227194eca732e64a360635696d18141c285ff769f66bccdfc3e09508da840f01d0866a9b76939c8f54ca78be4dfedeb6f0ce5726cb3f2dbb06785'
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
@@ -6,6 +6,8 @@ module Cats
6
6
 
7
7
  validates :reference_no, :order_date, :supplier, presence: true
8
8
  validates :reference_no, uniqueness: true
9
+
10
+ delegate(:name, to: :commodity_category, prefix: true)
9
11
  end
10
12
  end
11
13
  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
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.0.23'.freeze
3
+ VERSION = '1.0.24'.freeze
4
4
  end
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cats_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.23
4
+ version: 1.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.