From be88b95e8c991588b2d006c3a9fd9b101551b815 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 19 May 2022 10:42:53 +0200 Subject: [PATCH 1/2] `orders_and_fulfillment` reports, distinct product by `variant` & `price` --- lib/reporting/reports/orders_and_fulfillment/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/reporting/reports/orders_and_fulfillment/base.rb b/lib/reporting/reports/orders_and_fulfillment/base.rb index 703f5e12b9..daea0990a8 100644 --- a/lib/reporting/reports/orders_and_fulfillment/base.rb +++ b/lib/reporting/reports/orders_and_fulfillment/base.rb @@ -22,7 +22,7 @@ module Reporting end def query_result - report_line_items.list(line_item_includes).group_by(&:variant_id).values + report_line_items.list(line_item_includes).group_by { |e| [e.variant_id, e.price] }.values end private From e32797d2fd242e12a284cfd3b2ee3ef976362429 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Wed, 25 May 2022 11:42:06 +0200 Subject: [PATCH 2/2] Do not group by order --- lib/reporting/reports/orders_and_fulfillment/base.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/reporting/reports/orders_and_fulfillment/base.rb b/lib/reporting/reports/orders_and_fulfillment/base.rb index daea0990a8..72ca34a83d 100644 --- a/lib/reporting/reports/orders_and_fulfillment/base.rb +++ b/lib/reporting/reports/orders_and_fulfillment/base.rb @@ -22,7 +22,9 @@ module Reporting end def query_result - report_line_items.list(line_item_includes).group_by { |e| [e.variant_id, e.price] }.values + report_line_items.list(line_item_includes).group_by { |e| + [e.variant_id, e.price, e.order_id] + }.values end private