mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-04 07:09:14 +00:00
Move "order_cycle_supplier_totals" report type to constant
This commit is contained in:
@@ -17,7 +17,7 @@ module OpenFoodNetwork
|
||||
def header
|
||||
case options[:report_type]
|
||||
|
||||
when "order_cycle_supplier_totals"
|
||||
when SupplierTotalsReport::REPORT_TYPE
|
||||
SupplierTotalsReport.new(self).header
|
||||
when "order_cycle_supplier_totals_by_distributor"
|
||||
[I18n.t(:report_header_producer), I18n.t(:report_header_product), I18n.t(:report_header_variant), I18n.t(:report_header_to_hub),
|
||||
@@ -57,7 +57,7 @@ module OpenFoodNetwork
|
||||
|
||||
def rules
|
||||
case options[:report_type]
|
||||
when "order_cycle_supplier_totals"
|
||||
when SupplierTotalsReport::REPORT_TYPE
|
||||
SupplierTotalsReport.new(self).rules
|
||||
when "order_cycle_supplier_totals_by_distributor"
|
||||
[
|
||||
@@ -192,7 +192,7 @@ module OpenFoodNetwork
|
||||
# the logic to compute the value for each cell.
|
||||
def columns
|
||||
case options[:report_type]
|
||||
when "order_cycle_supplier_totals"
|
||||
when SupplierTotalsReport::REPORT_TYPE
|
||||
SupplierTotalsReport.new(self).columns
|
||||
when "order_cycle_supplier_totals_by_distributor"
|
||||
[
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module OpenFoodNetwork
|
||||
class OrdersAndFulfillmentsReport
|
||||
class SupplierTotalsReport
|
||||
REPORT_TYPE = "order_cycle_supplier_totals"
|
||||
|
||||
attr_reader :context
|
||||
|
||||
delegate :supplier_name, :product_name, :line_items_name, :total_units, to: :context
|
||||
|
||||
@@ -11,7 +11,7 @@ RSpec.describe OpenFoodNetwork::OrdersAndFulfillmentsReport::SupplierTotalsRepor
|
||||
let(:permissions) { OpenFoodNetwork::Permissions.new(current_user) }
|
||||
|
||||
let(:report) do
|
||||
report_options = { report_type: "order_cycle_supplier_totals" }
|
||||
report_options = { report_type: described_class::REPORT_TYPE }
|
||||
OpenFoodNetwork::OrdersAndFulfillmentsReport.new(permissions, report_options, true)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user