Ensure excluded shops are captured by #closed_shops

This commit is contained in:
Joseph Johansen
2024-09-03 17:14:25 +01:00
parent 6df0b24bcf
commit 7d2f3bfa2f

View File

@@ -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