diff --git a/app/controllers/base_controller.rb b/app/controllers/base_controller.rb index e5535b71ad..7f9a0f2df6 100644 --- a/app/controllers/base_controller.rb +++ b/app/controllers/base_controller.rb @@ -23,11 +23,14 @@ class BaseController < ApplicationController private def set_order_cycles + unless @distributor.ready_for_checkout? + @order_cycles = OrderCycle.where('false') + return + end + @order_cycles = OrderCycle.with_distributor(@distributor).active .order(@distributor.preferred_shopfront_order_cycle_order) - ensure_shop_ready - applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor, "FilterOrderCycles", current_customer.andand.tag_list) applicator.filter!(@order_cycles) @@ -36,9 +39,4 @@ class BaseController < ApplicationController current_order(true).set_order_cycle! @order_cycles.first end end - - def ensure_shop_ready - # Don't display order cycles if shop is not ready for checkout - @order_cycles = {} unless @distributor.ready_for_checkout? - end end