mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-05 02:41:33 +00:00
Ensure excluded shops are captured by #closed_shops
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ShopsListService
|
||||
# shops that are ready for checkout, and have an order cycle that is currently open
|
||||
def open_shops
|
||||
shops_list.
|
||||
ready_for_checkout.
|
||||
distributors_with_active_order_cycles.
|
||||
all
|
||||
distributors_with_active_order_cycles
|
||||
end
|
||||
|
||||
# shops that are either not ready for checkout, or don't have an open order cycle; the inverse of
|
||||
# #open_shops
|
||||
def closed_shops
|
||||
shops_list.not_ready_for_checkout.all
|
||||
shops_list.where.not(id: open_shops.reselect("enterprises.id"))
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user