From 61bbf0714efadf929f3fdcc221f7f236d8c4acff Mon Sep 17 00:00:00 2001 From: Cillian O'Ruanaidh Date: Wed, 29 Jun 2022 11:48:55 +0100 Subject: [PATCH] Remove flag argument anti-pattern from Shop::OrderCyclesList Co-authored-by: Maikel --- app/services/shop/order_cycles_list.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/services/shop/order_cycles_list.rb b/app/services/shop/order_cycles_list.rb index 3a453aa7ac..e51d3aed5f 100644 --- a/app/services/shop/order_cycles_list.rb +++ b/app/services/shop/order_cycles_list.rb @@ -4,11 +4,13 @@ module Shop class OrderCyclesList def self.active_for(distributor, customer) - new(distributor, customer).call(ready_for_checkout: false) + new(distributor, customer).call end def self.ready_for_checkout_for(distributor, customer) - new(distributor, customer).call(ready_for_checkout: true) + return OrderCycle.none if !distributor.ready_for_checkout? + + new(distributor, customer).call end def initialize(distributor, customer) @@ -16,9 +18,7 @@ module Shop @customer = customer end - def call(ready_for_checkout:) - return OrderCycle.none if ready_for_checkout && !@distributor.ready_for_checkout? - + def call order_cycles = OrderCycle.with_distributor(@distributor).active .order(@distributor.preferred_shopfront_order_cycle_order).to_a