comee_core 0.3.12 → 0.3.14
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07ea8b2d38974e5d0c2bc42dbd9a9242ede67b2a9a18e7f8101e68db2a0f2f55
|
4
|
+
data.tar.gz: 532f72af1b4e969c73b155ca975b3dd3b72b3a63e1eadc147e5eec1f9d0bf6d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2069cc8af72a264e78738a6d0ec44868d543126384ea67fc32c041da0fafdc3625f9bf15465462fc3f9846c10576018bef95e7696e2d8606c3bb99c5f82fab
|
7
|
+
data.tar.gz: cb950057668a419cfac9b0b266512594db85b15eea6696a9f37bdb6a40d57dad909a8ee0213851e8ea9cb03c3f8f5323d8920e3bdaca9d97a51eca8d86c5412c
|
@@ -5,13 +5,16 @@ module Comee
|
|
5
5
|
|
6
6
|
def index
|
7
7
|
super do
|
8
|
-
Client.includes(
|
8
|
+
Client.includes(
|
9
|
+
:parent, :agents, :contacts, :client_warehouses, :client_addresses, :country, :user, :currency
|
10
|
+
).all
|
9
11
|
end
|
10
12
|
end
|
11
13
|
|
12
14
|
def filter
|
13
|
-
clients = Client.includes(
|
14
|
-
|
15
|
+
clients = Client.includes(
|
16
|
+
:parent, :agents, :contacts, :client_warehouses, :client_addresses, :country, :user, :currency
|
17
|
+
).ransack(params[:q]).result
|
15
18
|
render_content(clients)
|
16
19
|
end
|
17
20
|
|
@@ -13,7 +13,8 @@ module Comee
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def filter
|
16
|
-
shipment_item = ShipmentItem.includes(:
|
16
|
+
shipment_item = ShipmentItem.includes(sales_order_item: [:unit, :product, sales_order: :client])
|
17
|
+
.ransack(params[:q]).result
|
17
18
|
options = {include: ["sales_order_item.sales_order.client", "sales_order_item.product", "sales_order_item.unit"]}
|
18
19
|
render_content(shipment_item, options)
|
19
20
|
end
|
@@ -160,27 +160,32 @@ module Comee
|
|
160
160
|
shipping_date: order.shipping_date,
|
161
161
|
delivery_date: order.final_delivery_date,
|
162
162
|
consignee: order.consignee,
|
163
|
-
created_by: accepted_by || ""
|
163
|
+
created_by: accepted_by || "",
|
164
|
+
consolidator_date: order.consolidator_date,
|
165
|
+
voyage_no: order.voyage_no,
|
166
|
+
shipping_arrangement: order.shipping_arrangement
|
164
167
|
)
|
165
168
|
order_items = order.customer_order_items.includes(:product, :unit)
|
166
169
|
client_id = order.client.parent_id || order.client_id
|
170
|
+
product_ids = order_items.map(&:product_id).uniq
|
167
171
|
client_prices = ClientPrice.where(
|
168
172
|
client_id: client_id,
|
169
|
-
product_id:
|
173
|
+
product_id: product_ids,
|
170
174
|
status: ClientPrice.statuses[:current]
|
171
175
|
)
|
172
176
|
master_prices = MasterPrice.includes(:supplier).where(primary: true, status: Price.statuses[:current],
|
173
|
-
|
174
|
-
main_query = ProductLookup.includes(:itemable).where(itemable_type: "Comee::Core::Supplier")
|
177
|
+
product_id: product_ids)
|
175
178
|
queries = master_prices.each_with_object([]) do |obj, res|
|
176
179
|
res << {
|
177
180
|
product_id: obj.product_id,
|
178
181
|
itemable_id: obj.supplier_id
|
179
182
|
}
|
180
183
|
end
|
181
|
-
|
184
|
+
|
185
|
+
product_lookups = queries.inject(ProductLookup.none) do |conditions, condition|
|
182
186
|
conditions.or(ProductLookup.where(condition))
|
183
187
|
end
|
188
|
+
product_lookups = product_lookups.includes(:itemable).where(itemable_type: "Comee::Core::Supplier")
|
184
189
|
items = order_items.each_with_object([]) do |item, res|
|
185
190
|
next if item.canceled?
|
186
191
|
|
@@ -189,9 +194,7 @@ module Comee
|
|
189
194
|
quantity = convert_quantity(item.quantity, item.unit_id, unit_id)
|
190
195
|
client_price = client_prices.find { |price| price.product_id == item.product_id }
|
191
196
|
master_price = master_prices.find { |price| price.product_id == item.product_id }
|
192
|
-
product_lookup = product_lookups.find
|
193
|
-
lookup.product_id == master_price.product_id && lookup.itemable_id == master_price.supplier_id
|
194
|
-
end
|
197
|
+
product_lookup = product_lookups.find { |lookup| lookup.product_id == item.product_id }
|
195
198
|
raise(StandardError, "No primary supplier found for product #{item.customer_item_no}") unless master_price
|
196
199
|
|
197
200
|
price = if client_price
|
data/lib/comee/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.14
|
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-
|
11
|
+
date: 2024-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|