mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Make it work with both relations and arrays
This commit is contained in:
@@ -61,7 +61,7 @@ module OpenFoodNetwork
|
||||
proc { |_line_items| "" },
|
||||
proc { |_line_items| I18n.t('admin.reports.total_items') },
|
||||
proc { |_line_items| "" },
|
||||
proc { |line_items| line_items.sum(&:quantity) },
|
||||
proc { |line_items| line_items.to_a.sum(&:quantity) },
|
||||
proc { |_line_items| "" }] },
|
||||
{ group_by: proc { |line_item| line_item.product.supplier },
|
||||
sort_by: proc { |supplier| supplier.name } },
|
||||
@@ -82,7 +82,7 @@ module OpenFoodNetwork
|
||||
proc { |_line_items| "" },
|
||||
proc { |_line_items| I18n.t('admin.reports.total_items') },
|
||||
proc { |_line_items| "" },
|
||||
proc { |line_items| line_items.sum(&:quantity) },
|
||||
proc { |line_items| line_items.to_a.sum(&:quantity) },
|
||||
proc { |_line_items| "" }] },
|
||||
{ group_by: proc { |line_item| line_item.product },
|
||||
sort_by: proc { |product| product.name } },
|
||||
@@ -102,7 +102,7 @@ module OpenFoodNetwork
|
||||
proc { |line_items| line_items.first.product.supplier.name },
|
||||
proc { |line_items| line_items.first.product.name },
|
||||
proc { |line_items| line_items.first.full_name },
|
||||
proc { |line_items| line_items.sum(&:quantity) },
|
||||
proc { |line_items| line_items.to_a.sum(&:quantity) },
|
||||
proc { |line_items| is_temperature_controlled?(line_items.first) }]
|
||||
else
|
||||
[
|
||||
@@ -113,7 +113,7 @@ module OpenFoodNetwork
|
||||
proc { |line_items| line_items.first.order.bill_address.lastname },
|
||||
proc { |line_items| line_items.first.product.name },
|
||||
proc { |line_items| line_items.first.full_name },
|
||||
proc { |line_items| line_items.sum(&:quantity) },
|
||||
proc { |line_items| line_items.to_a.sum(&:quantity) },
|
||||
proc { |line_items| is_temperature_controlled?(line_items.first) }
|
||||
]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user