comee_core 0.3.19 → 0.3.20

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: 3a167a9d01cd03be307e0f99d440d4edfe98a86a8d3e84b9571b3c19b9389657
4
- data.tar.gz: 429b64c12e99c22246678db52440ec59ef926217b51374e31bba5e9b8c166f6c
3
+ metadata.gz: 5800c13672eb17e44ca33d72b8793090222e15e35a1b3b006fcdbb8394e1440c
4
+ data.tar.gz: d3c846baacc27f192b2bc54cb009b98bccdc9958dc3e1a617bcbf8476c6d54c5
5
5
  SHA512:
6
- metadata.gz: 3b64d2413b3325dd5d0d10b831b56bb2caba6068111c25c4cd581260a45b5ec9522c7e7ce221d806daed864893f7e1fdc205999aae9b511174cf18dc0a60423d
7
- data.tar.gz: e57f98846dc9bdb9ace8478c206d11858938e0126ec86bc4ca9fb3b24b462c4b1109e4bf6031fc360932afd395a17fd7bed7ec058100a5fe7f7d2417e75e41b4
6
+ metadata.gz: 6c2a9a3381044970f4bc3a23459d3bb5438e226e8ff0265de16a952c9939dd6e88f369a453ab54d8398301d464b305500b4cc1c6405553437a4dd0514751ef5c
7
+ data.tar.gz: 2f18c9811f6165ce75f2bfd6cd06f300043e9699ad56b282ca5c3f87e10f83f5df7bf1d1d98a00e909462fca97547a5dd27e72c5a12b358cd04948a15c6f1948
@@ -175,17 +175,7 @@ module Comee
175
175
  )
176
176
  master_prices = MasterPrice.includes(:supplier).where(primary: true, status: Price.statuses[:current],
177
177
  product_id: product_ids)
178
- queries = master_prices.each_with_object([]) do |obj, res|
179
- res << {
180
- product_id: obj.product_id,
181
- itemable_id: obj.supplier_id
182
- }
183
- end
184
178
 
185
- product_lookups = queries.inject(ProductLookup.none) do |conditions, condition|
186
- conditions.or(ProductLookup.where(condition))
187
- end
188
- product_lookups = product_lookups.includes(:itemable).where(itemable_type: "Comee::Core::Supplier")
189
179
  items = order_items.each_with_object([]) do |item, res|
190
180
  next if item.canceled?
191
181
 
@@ -194,9 +184,9 @@ module Comee
194
184
  quantity = convert_quantity(item.quantity, item.unit_id, unit_id)
195
185
  client_price = client_prices.find { |price| price.product_id == item.product_id }
196
186
  master_price = master_prices.find { |price| price.product_id == item.product_id }
197
- product_lookup = product_lookups.find { |lookup| lookup.product_id == item.product_id }
198
187
  raise(StandardError, "No primary supplier found for product #{item.customer_item_no}") unless master_price
199
188
 
189
+ product_lookup = master_price.product_lookup
200
190
  price = if client_price
201
191
  convert_price(client_price.price, client_price.unit_id, unit_id)
202
192
  else
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.3.19".freeze
3
+ VERSION = "0.3.20".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.19
4
+ version: 0.3.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-04 00:00:00.000000000 Z
11
+ date: 2024-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers