mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-07 22:46:06 +00:00
Ensure hack for showing products on a shop with closed order cycles also works if an order cycle has no shipping methods
If a distributor order cycle has no shipping methods it will be invalid. This is a bit confusing because adding a check for :invalid seems like it would be better if it was done in the Shop::OrderCyclesList service but the hack doesn't work if you put it in there, it seems like something needs a refactor.
This commit is contained in:
committed by
Filipe
parent
5a4bc79c74
commit
a46b77d10c
@@ -15,8 +15,12 @@ class BaseController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def all_distributor_order_cycles_invalid?
|
||||
OrderCycle.with_distributor(@distributor).active.all?(&:invalid?)
|
||||
end
|
||||
|
||||
def set_order_cycles
|
||||
unless @distributor.ready_for_checkout?
|
||||
if !@distributor.ready_for_checkout? || all_distributor_order_cycles_invalid?
|
||||
@order_cycles = OrderCycle.where('false')
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user