cats_core 1.0.24 → 1.0.25
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b4daffc3ad671e1f4b955ec649f6186cc8048ffc0a74972292e2b745460b28c
|
4
|
+
data.tar.gz: a75cb602fd8859e7e39f064212cee3daafc6a8dfda04247614d2608058433183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43c85afb0693fb6158597758b1a8399e6490b7fdcaf7291dda9304e02be716aab33e25f02408539a46e5b3c3adddd746e9a94ed14754999ec51048c411408041
|
7
|
+
data.tar.gz: d7dc26e79aafdf1429fc0d1a40a988f9608c6db56c137cc2a46cfdeb630fa957882329fc1cca0df8dd9396651b2dcd372193eb75129d0d743da6df3e10efc961
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Cats
|
2
2
|
module Core
|
3
3
|
class Commodity < ApplicationRecord
|
4
|
+
after_initialize :set_approved
|
5
|
+
|
4
6
|
# Commodity statuses
|
5
7
|
GOOD = 'Good'.freeze
|
6
8
|
DAMAGED = 'Damaged'.freeze
|
@@ -20,6 +22,12 @@ module Cats
|
|
20
22
|
validates :quantity, presence: true, numericality: { greater_than: 0 }
|
21
23
|
validates :volume_per_metric_ton, numericality: { greater_than: 0, allow_nil: true }
|
22
24
|
validates :arrival_status, presence: true, inclusion: { in: ARRIVAL_STATUSES }
|
25
|
+
|
26
|
+
def set_approved
|
27
|
+
return unless new_record?
|
28
|
+
|
29
|
+
self.approved = false
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
@@ -12,6 +12,7 @@ class CreateCatsCoreCommodities < ActiveRecord::Migration[6.1]
|
|
12
12
|
t.date :best_use_before, null: false
|
13
13
|
t.float :volume_per_metric_ton
|
14
14
|
t.string :arrival_status, null: false, default: 'At Source'
|
15
|
+
t.boolean :approved, null: false, default: false
|
15
16
|
|
16
17
|
t.timestamps
|
17
18
|
end
|
data/lib/cats/core/version.rb
CHANGED