From 7d2f3bfa2f4c6d9a230da84df0b63af0ceadbb3a Mon Sep 17 00:00:00 2001 From: Joseph Johansen Date: Tue, 3 Sep 2024 17:14:25 +0100 Subject: [PATCH] Ensure excluded shops are captured by #closed_shops --- app/services/shops_list_service.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/shops_list_service.rb b/app/services/shops_list_service.rb index d276f57ae8..e145eedc93 100644 --- a/app/services/shops_list_service.rb +++ b/app/services/shops_list_service.rb @@ -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