mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
This enables the Rubocop's Style/MultilineMethodCallIndentation cop with
indentend enforced style. Which makes you split multiline method calls like:
orders = Spree::Order
.an_scope
.another_scope
.where(id: list_of_ids)
It also autofixes the current violations and updates the
rubocop_todo.yml
43 lines
1.3 KiB
Ruby
43 lines
1.3 KiB
Ruby
require 'spree/core/controller_helpers/respond_with_decorator'
|
|
require 'open_food_network/tag_rule_applicator'
|
|
|
|
class BaseController < ApplicationController
|
|
include Spree::Core::ControllerHelpers
|
|
include Spree::Core::ControllerHelpers::Auth
|
|
include Spree::Core::ControllerHelpers::Common
|
|
include Spree::Core::ControllerHelpers::Order
|
|
include Spree::Core::ControllerHelpers::RespondWith
|
|
|
|
include EnterprisesHelper
|
|
include OrderCyclesHelper
|
|
|
|
helper 'spree/base'
|
|
|
|
# Spree::Core::ControllerHelpers declares helper_method get_taxonomies, so we need to
|
|
# include Spree::ProductsHelper so that method is available on the controller
|
|
include Spree::ProductsHelper
|
|
|
|
before_filter :check_order_cycle_expiry
|
|
|
|
|
|
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)
|
|
|
|
applicator = OpenFoodNetwork::TagRuleApplicator.new(@distributor, "FilterOrderCycles", current_customer.andand.tag_list)
|
|
applicator.filter!(@order_cycles)
|
|
|
|
# And default to the only order cycle if there's only the one
|
|
if @order_cycles.count == 1
|
|
current_order(true).set_order_cycle! @order_cycles.first
|
|
end
|
|
end
|
|
end
|