item_builder 0.1.14 → 0.1.15

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: 7f8232744164229bf81eaf5dc1069c9f56fd83d110c48d51088a2284e52dd2e5
4
- data.tar.gz: fbbb12a28d964bc6badd2c5914ca8b0dab476576fb0d8009c4fff230d8ff8afe
3
+ metadata.gz: 78374ce9b35b89257c71b2c25a0ec5ae52490eaa79ca64c777acc1fd65bcb2e5
4
+ data.tar.gz: b839aa926980f7479349658c67ed6e870e2c7960944d0f9abcc2839dec21f984
5
5
  SHA512:
6
- metadata.gz: f51bf30b10eb630cf99ec445ff4192ee150c32ac5b731a007103ab9329e47bd6fb4f49179b7762f302827bbe3a7ad9e72099465c3925984bf9278be58c316273
7
- data.tar.gz: 3c2ecb37ead73a59dd4b9158fa66eadbdd196d77c58eee56b23b859cd57c02a76d3a9c251313dda44ceea88d1cd8f72d382d331e5767a08205c679b004e74f71
6
+ metadata.gz: 35913352045ce6d2d1df6d641ed49e2a4fcd7e6aca2b8ec7e016315fe8923dad12037db32f3eeb52077f514685673071b3aa548c36460e715e4e4784ead4306c
7
+ data.tar.gz: 53928e6cc0be8ad63fb1a42644d4195c031a8a6afc3aece2ff8ae57c3e85a8f49c001288e632d34dfe9c7eae38c6c71175e305823fa73abe65262b61d037ac8d
@@ -76,14 +76,18 @@ module ItemBuilder
76
76
 
77
77
  def qty_bundle
78
78
  # Quantity for bundle config
79
- qty_list = []
80
- bundle_variants.each do |bvr|
81
- qty = WarehouseSpace.find_by(item_variant_id: bvr.variant_id)&.quantity
82
- qty ||= 0
83
- qty = qty / bvr.unit
84
- qty_list.push(qty)
79
+ if bundle_variants.present?
80
+ qty_list = []
81
+ bundle_variants.each do |bvr|
82
+ qty = WarehouseSpace.find_by(item_variant_id: bvr.variant_id)&.quantity
83
+ qty ||= 0
84
+ qty = qty / bvr.unit
85
+ qty_list.push(qty)
86
+ end
87
+ [qty_list.min, 0].sort[1]
88
+ else
89
+ qty_default
85
90
  end
86
- [qty_list.min, 0].sort[1]
87
91
  end
88
92
 
89
93
  def bundle_variants
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ItemBuilder
4
- VERSION = '0.1.14'
4
+ VERSION = '0.1.15'
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.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - okaaryanata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-12 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler