item_builder 0.1.11 → 0.1.12

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: 4ddc2ca092fa7c101e60c5783bfd3490f9941607ca1ca43bc391a6a28efa34b3
4
- data.tar.gz: 8a35a5c7788941679e513c5932412de396d9a47adfe07d6ae6e60d8536cf1de7
3
+ metadata.gz: 1ff740418480a710b0cec377cec19a6330aad599ea3fbe555280f7ad0c59f08b
4
+ data.tar.gz: 02e64890eb8054a0bf68bc613c1b3e0637450c9e2846ecad4fdd9649b29e6e01
5
5
  SHA512:
6
- metadata.gz: ea23a5e5fd024dcf4fca70589fa6c9715bda51e4e1e22cafdd1fd4e04bbf764faef8b829a6c0428d644f46880e683ae65938041e2d6ccee69bb6d49e60ccaccc
7
- data.tar.gz: 1763a2c44c86051beeeb39167b164a367a1cda8d07d6be1fffb3d9300cafb9b7cc2f6c539dea40159ae06bc5869fd5aa9c76126bac1aa6d520e6c0281a78b016
6
+ metadata.gz: 40383445dc0e0b9b7a44610de2de1d8950523616f339881d0285875882dd7c50fb8d40e3680f5b100609ba8c39110d5e8d152a1d8e3d87d4fbf5b24cf4351129
7
+ data.tar.gz: fe4881bb71807c32e5a6e0d39a74afa62a3606a38e72fe1f363d08b7ec72b38b2868c3c7ed133c2947dca5c1de2ae729a809ca6d9b7413b6cac22c523a32d1cb
@@ -78,19 +78,14 @@ module ItemBuilder
78
78
  # Quantity for bundle config
79
79
  qty_list = []
80
80
  bundle_variants.each do |bvr|
81
- qty = 0
82
- if bundle_condition(bvr)
83
- qty = bvr.variant.warehouse_spaces.first.quantity / bvr.unit
84
- end
81
+ qty = WarehouseSpace.find_by(item_variant_id: bvr.variant_id)&.quantity
82
+ qty ||= 0
83
+ qty = qty / bvr.unit
85
84
  qty_list.push(qty)
86
85
  end
87
86
  [qty_list.min, 0].sort[1]
88
87
  end
89
88
 
90
- def bundle_condition(bvr)
91
- bvr.variant.present? && bvr.variant.warehouse_spaces.present?
92
- end
93
-
94
89
  def bundle_variants
95
90
  Bundle.where('variant_id = ?', variant.id).first.bundle_variants
96
91
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemBuilder
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.12'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: item_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - okaaryanata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2020-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler