diff --git a/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report.rb b/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report.rb index cfb1a1f3f9..d9828e6aef 100644 --- a/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report.rb +++ b/lib/open_food_network/orders_and_fulfillments_report/distributor_totals_by_supplier_report.rb @@ -59,7 +59,7 @@ module OpenFoodNetwork proc { |line_items| line_items.first.variant.product.supplier.name }, proc { |line_items| line_items.first.variant.product.name }, proc { |line_items| line_items.first.variant.full_name }, - proc { |line_items| line_items.sum(:quantity) }, + proc { |line_items| line_items.to_a.sum(&:quantity) }, proc { |line_items| line_items.first.price }, proc { |line_items| line_items.sum(&:amount) }, proc { |_line_items| "" }, diff --git a/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report.rb b/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report.rb index cddc962f49..98aa381a79 100644 --- a/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report.rb +++ b/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_by_distributor_report.rb @@ -60,7 +60,7 @@ module OpenFoodNetwork proc { |line_items| line_items.first.variant.product.name }, proc { |line_items| line_items.first.variant.full_name }, proc { |line_items| line_items.first.order.distributor.name }, - proc { |line_items| line_items.sum(:quantity) }, + proc { |line_items| line_items.to_a.sum(&:quantity) }, proc { |line_items| line_items.first.price }, proc { |line_items| line_items.sum(&:amount) }, proc { |_line_items| I18n.t(:report_header_shipping_method) } diff --git a/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb b/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb index 3029cf19b3..a7a341664c 100644 --- a/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb +++ b/lib/open_food_network/orders_and_fulfillments_report/supplier_totals_report.rb @@ -44,7 +44,7 @@ module OpenFoodNetwork supplier_name, product_name, line_items_name, - proc { |line_items| line_items.sum(:quantity) }, + proc { |line_items| line_items.to_a.sum(&:quantity) }, proc { |line_items| total_units(line_items) }, proc { |line_items| line_items.first.price }, proc { |line_items| line_items.sum(&:amount) },