fix group order matrix pdf

This commit is contained in:
Philipp Rothmann 2023-06-08 13:18:06 +02:00 committed by Philipp Rothmann
parent fb2b4d8a8a
commit 285441cb4b

View file

@ -113,7 +113,7 @@ class OrderPdf < RenderPdf
# get quantity for each article and ordergroup # get quantity for each article and ordergroup
goa_records = group_order_articles(group_ids) goa_records = group_order_articles(group_ids)
.group('group_order_articles.order_article_id, group_orders.ordergroup_id') .group('group_order_articles.order_article_id, group_orders.ordergroup_id')
.pluck('group_order_articles.order_article_id', 'group_orders.ordergroup_id', 'SUM(COALESCE(group_order_articles.result, group_order_articles.quantity))') .pluck('group_order_articles.order_article_id', 'group_orders.ordergroup_id', Arel.sql('SUM(COALESCE(group_order_articles.result, group_order_articles.quantity))'))
# transform the flat list of results in a hash (with the article as key), which contains an array for all ordergroups # transform the flat list of results in a hash (with the article as key), which contains an array for all ordergroups
results = goa_records.group_by(&:first).transform_values do |value| results = goa_records.group_by(&:first).transform_values do |value|