From 0fdd00058959728f07654ea64c09af0491ed7ccb Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 3 Sep 2015 12:26:40 +1000 Subject: [PATCH] Showing Bulk Unit Size in BulkCoopReport The group_buy_unit_size field is now shown even if 'group buy' is not enabled. And "Group By Unit Size" is now displayed as "Bulk Unit Size". --- app/views/spree/admin/products/_group_buy_form.html.haml | 2 +- lib/open_food_network/bulk_coop_report.rb | 2 +- .../reports/bulk_coop_allocation_report.rb | 2 +- lib/open_food_network/reports/bulk_coop_report.rb | 6 +----- lib/open_food_network/reports/bulk_coop_supplier_report.rb | 2 +- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/views/spree/admin/products/_group_buy_form.html.haml b/app/views/spree/admin/products/_group_buy_form.html.haml index 6669563d15..71e8b20485 100644 --- a/app/views/spree/admin/products/_group_buy_form.html.haml +++ b/app/views/spree/admin/products/_group_buy_form.html.haml @@ -9,6 +9,6 @@ = f.label :group_buy_0, 'No' %br.clear = f.field_container :group_buy_unit_size do - = f.label :group_buy_unit_size + = f.label :bulk_unit_size %br = f.text_field :group_buy_unit_size diff --git a/lib/open_food_network/bulk_coop_report.rb b/lib/open_food_network/bulk_coop_report.rb index d6bf23f85b..4e01553274 100644 --- a/lib/open_food_network/bulk_coop_report.rb +++ b/lib/open_food_network/bulk_coop_report.rb @@ -23,7 +23,7 @@ module OpenFoodNetwork when "bulk_coop_customer_payments" ["Customer", "Date of Order", "Total Cost", "Amount Owing", "Amount Paid"] else - ["Supplier", "Product", "Unit Size", "Variant", "Weight", "Sum Total", "Sum Max Total", "Units Required", "Remainder"] + ["Supplier", "Product", "Bulk Unit Size", "Variant", "Weight", "Sum Total", "Sum Max Total", "Units Required", "Remainder"] end end diff --git a/lib/open_food_network/reports/bulk_coop_allocation_report.rb b/lib/open_food_network/reports/bulk_coop_allocation_report.rb index 52efbc677c..313c92fe71 100644 --- a/lib/open_food_network/reports/bulk_coop_allocation_report.rb +++ b/lib/open_food_network/reports/bulk_coop_allocation_report.rb @@ -2,7 +2,7 @@ require 'open_food_network/reports/bulk_coop_report' module OpenFoodNetwork::Reports class BulkCoopAllocationReport < BulkCoopReport - header "Customer", "Product", "Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Total Available", "Unallocated", "Max quantity excess" + header "Customer", "Product", "Bulk Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Total Available", "Unallocated", "Max quantity excess" organise do group { |li| li.variant.product } diff --git a/lib/open_food_network/reports/bulk_coop_report.rb b/lib/open_food_network/reports/bulk_coop_report.rb index 5c0916585d..dbce047963 100644 --- a/lib/open_food_network/reports/bulk_coop_report.rb +++ b/lib/open_food_network/reports/bulk_coop_report.rb @@ -22,11 +22,7 @@ module OpenFoodNetwork::Reports end def group_buy_unit_size_f(lis) - if lis.first.variant.product.group_buy - group_buy_unit_size(lis) - else - "" - end + group_buy_unit_size(lis) end def total_amount(lis) diff --git a/lib/open_food_network/reports/bulk_coop_supplier_report.rb b/lib/open_food_network/reports/bulk_coop_supplier_report.rb index b40557ea1a..df3b40c519 100644 --- a/lib/open_food_network/reports/bulk_coop_supplier_report.rb +++ b/lib/open_food_network/reports/bulk_coop_supplier_report.rb @@ -2,7 +2,7 @@ require 'open_food_network/reports/bulk_coop_report' module OpenFoodNetwork::Reports class BulkCoopSupplierReport < BulkCoopReport - header "Supplier", "Product", "Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Units Required", "Unallocated", "Max quantity excess" + header "Supplier", "Product", "Bulk Unit Size", "Variant", "Variant value", "Variant unit", "Weight", "Sum Total", "Units Required", "Unallocated", "Max quantity excess" organise do group { |li| li.variant.product.supplier }