order_optimizer 0.5.0 → 0.5.1

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: 21b6b1f9358d26572d0f3fe4d2a237c2da2a217bbb5f2d241d7a98683a9a43e1
4
- data.tar.gz: 29987d3e12a263c8f18acdcf6c1972dcfa91204ece002e1a778ccc72a38a2843
3
+ metadata.gz: dc5f8c71f67ec7c63ccf96363c1653637f5f4ea50d866485cdd4f6238594522d
4
+ data.tar.gz: 13c69c75805106de2e1ae6a0031bb86639f05c435c49732aaae3124375458efb
5
5
  SHA512:
6
- metadata.gz: 32b08adac0ba68f5133e60506b72a2f969d2e5617fd02ab16e922a05088e0afb81294041d6cbf6762dc70e8877a522733dc6160bb5583a30f744d67668efbee7
7
- data.tar.gz: e8808b19221863663091640750d3765fccbf9dea0a4191f8cb9b1d13c46f49a3fa47f7ba8f906efaaa7bf5f3a6f7f13873ccdf19a59fcd32e81025b409676300
6
+ metadata.gz: '0633497552abad8d67891a0f2952fafa9221ba4941709440c0e515f19f8241fb05bd30ccf4129b1c4a879686ef9203d75565c37556e78fdc0b73db0bca862085'
7
+ data.tar.gz: 03742d3da4bd0db3beb4b19c824f99cc17db427a84c63e27944bd0d20327eff779cfdb355fb0613ab6179c9950279b5427e247bc8802517955a326d523b992e1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # OrderOptimizer Gem Changelog
2
2
 
3
+ ## 0.5.1 (2021-11-29)
4
+ - Consider `max_quantity` when desired exceeds OR EQUALS max_quantity
5
+
3
6
  ## 0.5.0 (2021-04-15)
4
7
  - Add `maximum_quantity` for SKUs
5
8
 
@@ -1,3 +1,3 @@
1
1
  class OrderOptimizer
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
@@ -55,7 +55,7 @@ class OrderOptimizer
55
55
  def count_and_remainder_for_sku(quantity, sku)
56
56
  count, remainder = quantity.divmod(sku.quantity)
57
57
 
58
- if sku.max_quantity && count * sku.quantity > sku.max_quantity
58
+ if sku.max_quantity && count * sku.quantity >= sku.max_quantity
59
59
  new_count = (sku.max_quantity / sku.quantity).ceil
60
60
  remainder = (count - new_count) * sku.quantity
61
61
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: order_optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - crispymtn
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-04-15 00:00:00.000000000 Z
13
+ date: 2021-11-29 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.2.15
104
+ rubygems_version: 3.2.22
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Helps to optimize orders if the goods are offered in different pack sizes