unidom-inventory 0.8 → 1.0

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
  SHA1:
3
- metadata.gz: 9dfaf76f12b1e87709dda0d1e98b29c5d698238b
4
- data.tar.gz: 09351223269c99dd7b829177fe98a16547b15043
3
+ metadata.gz: 85e68916ba502e3361af1019e4d072ad0239b5b5
4
+ data.tar.gz: ac1b5d1043e892277d1e1091168fb89612f8fe94
5
5
  SHA512:
6
- metadata.gz: 418c0d32329497fb63dddb0889a8ff16edb7f237e6a940268d51ac4250f0a800e9181a212648f1caf7b9757a01e7ef9742bf0a7e0edb633e8c5037aa27a77dfe
7
- data.tar.gz: 08e68e9f020b7de78d101b68bf8b95bc7bc63db57efabcab7ffda3e7527efe76be5e4c396e19e7b6a3258d537341c75cceaa64dde951f6d52e1d9b9a2c072878
6
+ metadata.gz: 2d19e0e8f698d7cc98b9b02880709df196e880484dd2b2c37061dc158a48e8e120bf6fbc83b029a1088f61dad520d95bbf7aff94e6336a314c744a0bb8d516e7
7
+ data.tar.gz: fe55a88b7043bd8b304231485af3df3662fdfd5376a4561b4f8a9d5176866359f9ea5ca4da9606bc05ad43eefb9bbe37bd4e8fa6010eac555209aaaa7ffd0f26
@@ -9,5 +9,6 @@ class Unidom::Inventory::GroupedInventoryItem < Unidom::Inventory::ApplicationRe
9
9
  include Unidom::Inventory::Concerns::AsInventoryItem
10
10
 
11
11
  validates :quantity, presence: true, numericality: true
12
+ #validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0.0, less_than: 1_000_000_000.00 }
12
13
 
13
14
  end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::GroupedInventoryItem'
@@ -11,6 +11,7 @@ class Unidom::Inventory::InventoryItemVariance < Unidom::Inventory::ApplicationR
11
11
  include Unidom::Common::Concerns::ModelExtension
12
12
 
13
13
  validates :quantity, presence: true, numericality: true
14
+ #validates :quantity, presence: true, numericality: { greater_than: -1_000_000_000.00, less_than: 1_000_000_000.00 }
14
15
 
15
16
  belongs_to :inventory_item, polymorphic: true
16
17
  belongs_to :reason, polymorphic: true
@@ -10,7 +10,7 @@ class CreateUnidomGroupedInventoryItems < ActiveRecord::Migration
10
10
  polymorphic: { null: false, default: '', limit: 200 }
11
11
  t.references :lot, type: :uuid, null: true
12
12
 
13
- t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
13
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
14
14
 
15
15
  t.column :state, 'char(1)', null: false, default: 'C'
16
16
  t.datetime :opened_at, null: false, default: ::Time.utc(1970)
@@ -9,7 +9,7 @@ class CreateUnidomInventoryItemVariances < ActiveRecord::Migration
9
9
  t.references :reason, type: :uuid, null: true,
10
10
  polymorphic: { null: true, default: nil, limit: 200 }
11
11
 
12
- t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
12
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
13
13
 
14
14
  t.text :description
15
15
  t.text :instruction
@@ -5,7 +5,7 @@ class CreateUnidomLots < ActiveRecord::Migration
5
5
  create_table :unidom_lots, id: :uuid do |t|
6
6
 
7
7
  t.string :identification_number, null: false, default: '', limit: 200
8
- t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
8
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
9
9
 
10
10
  t.text :description
11
11
  t.text :instruction
@@ -8,7 +8,7 @@ class CreateUnidomPickItems < ActiveRecord::Migration
8
8
  t.references :inventory_item, type: :uuid, null: false,
9
9
  polymorphic: { null: false, default: '', limit: 200 }
10
10
 
11
- t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
11
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
12
12
 
13
13
  t.text :description
14
14
  t.text :instruction
@@ -10,7 +10,7 @@ class CreateUnidomItemIssuings < ActiveRecord::Migration
10
10
  t.references :target_item, type: :uuid, null: true,
11
11
  polymorphic: { null: true, default: nil, limit: 200 }
12
12
 
13
- t.decimal :quantity, null: false, default: 0.0, precision: 10, scale: 6
13
+ t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
14
14
 
15
15
  t.text :description
16
16
  t.text :instruction
@@ -19,6 +19,30 @@ describe Unidom::Inventory::GroupedInventoryItem, type: :model do
19
19
 
20
20
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
21
21
 
22
+ =begin
23
+ it_behaves_like 'validates', model_attributes, :quantity,
24
+ { } => 0,
25
+ { quantity: nil } => 2,
26
+ { quantity: '' } => 2,
27
+ { quantity: '1' } => 0,
28
+ { quantity: 1 } => 0,
29
+ { quantity: 'A' } => 1,
30
+ { quantity: '1.23' } => 0,
31
+ { quantity: 1.23 } => 0,
32
+ { quantity: '-0.01' } => 1,
33
+ { quantity: -0.01 } => 1,
34
+ { quantity: '0' } => 0,
35
+ { quantity: 0 } => 0,
36
+ { quantity: '0.01' } => 0,
37
+ { quantity: 0.01 } => 0,
38
+ { quantity: '999_999_999.99' } => 0,
39
+ { quantity: 999_999_999.99 } => 0,
40
+ { quantity: '1_000_000_000' } => 1,
41
+ { quantity: 1_000_000_000 } => 1,
42
+ { quantity: '1_000_000_000.01' } => 1,
43
+ { quantity: 1_000_000_000.01 } => 1
44
+ =end
45
+
22
46
  end
23
47
 
24
48
  end
@@ -18,6 +18,30 @@ describe Unidom::Inventory::InventoryItemVariance, type: :model do
18
18
 
19
19
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
20
 
21
+ =begin
22
+ it_behaves_like 'validates', model_attributes, :quantity,
23
+ { } => 0,
24
+ { quantity: nil } => 2,
25
+ { quantity: '' } => 2,
26
+ { quantity: '1' } => 0,
27
+ { quantity: 1 } => 0,
28
+ { quantity: 'A' } => 1,
29
+ { quantity: '0.00' } => 0,
30
+ { quantity: 0.00 } => 0,
31
+ { quantity: '-999_999_999.99' } => 0,
32
+ { quantity: -999_999_999.99 } => 0,
33
+ { quantity: '-1_000_000_000' } => 1,
34
+ { quantity: -1_000_000_000 } => 1,
35
+ { quantity: '-1_000_000_000.01' } => 1,
36
+ { quantity: -1_000_000_000.01 } => 1,
37
+ { quantity: '999_999_999.99' } => 0,
38
+ { quantity: 999_999_999.99 } => 0,
39
+ { quantity: '1_000_000_000' } => 1,
40
+ { quantity: 1_000_000_000 } => 1,
41
+ { quantity: '1_000_000_000.01' } => 1,
42
+ { quantity: 1_000_000_000.01 } => 1
43
+ =end
44
+
21
45
  end
22
46
 
23
47
  end
@@ -17,8 +17,29 @@ describe Unidom::Inventory::SerializedInventoryItem, type: :model do
17
17
  serial_number: '123456789012'
18
18
  }
19
19
 
20
+ #serial_number_max_length = described_class.columns_hash['serial_number'].limit
21
+
20
22
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
21
23
 
24
+ =begin
25
+ it_behaves_like 'validates', model_attributes, :serial_number,
26
+ { } => 0,
27
+ { serial_number: nil } => 2,
28
+ { serial_number: '' } => 2,
29
+ { serial_number: '1' } => 1,
30
+ { serial_number: '11' } => 0,
31
+ { serial_number: '111' } => 0,
32
+ { serial_number: 'A' } => 1,
33
+ { serial_number: 'AA' } => 0,
34
+ { serial_number: 'AAA' } => 0,
35
+ { serial_number: '1'*(serial_number_max_length-1) } => 0,
36
+ { serial_number: '1'*serial_number_max_length } => 0,
37
+ { serial_number: '1'*(serial_number_max_length+1) } => 1,
38
+ { serial_number: 'A'*(serial_number_max_length-1) } => 0,
39
+ { serial_number: 'A'*serial_number_max_length } => 0,
40
+ { serial_number: 'A'*(serial_number_max_length+1) } => 1
41
+ =end
42
+
22
43
  end
23
44
 
24
45
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Inventory
3
- VERSION = '0.8'.freeze
3
+ VERSION = '1.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-inventory
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: '1.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-11 00:00:00.000000000 Z
11
+ date: 2017-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common