From a7a89d7ccb2b9db02181717a76e6d3058ff47c0c Mon Sep 17 00:00:00 2001 From: Kristina Lim Date: Thu, 10 Oct 2019 20:12:56 +0800 Subject: [PATCH] Add attr reader for report type in Orders and Fulfillment report --- .../orders_and_fulfillments_report.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/open_food_network/orders_and_fulfillments_report.rb b/lib/open_food_network/orders_and_fulfillments_report.rb index 6674b65306..262168754d 100644 --- a/lib/open_food_network/orders_and_fulfillments_report.rb +++ b/lib/open_food_network/orders_and_fulfillments_report.rb @@ -9,17 +9,17 @@ include Spree::ReportsHelper module OpenFoodNetwork class OrdersAndFulfillmentsReport - attr_reader :options + attr_reader :options, :report_type def initialize(permissions, options = {}, render_table = false) @options = options + @report_type = options[:report_type] @permissions = permissions @render_table = render_table end def header - case options[:report_type] - + case report_type when SupplierTotalsReport::REPORT_TYPE SupplierTotalsReport.new(self).header when SupplierTotalsByDistributorReport::REPORT_TYPE @@ -43,7 +43,7 @@ module OpenFoodNetwork end def rules - case options[:report_type] + case report_type when SupplierTotalsReport::REPORT_TYPE SupplierTotalsReport.new(self).rules when SupplierTotalsByDistributorReport::REPORT_TYPE @@ -60,7 +60,7 @@ module OpenFoodNetwork # Returns a proc for each column displayed in each report type containing # the logic to compute the value for each cell. def columns - case options[:report_type] + case report_type when SupplierTotalsReport::REPORT_TYPE SupplierTotalsReport.new(self).columns when SupplierTotalsByDistributorReport::REPORT_TYPE