From 5b434ca7c40f3b793b77597586bda9ba341cc1cb Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 29 Jan 2022 12:57:51 +0000 Subject: [PATCH] Replace conditional with a guard clause --- app/controllers/concerns/order_stock_check.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/concerns/order_stock_check.rb b/app/controllers/concerns/order_stock_check.rb index 3a46ee9ea0..bcbb9fb87d 100644 --- a/app/controllers/concerns/order_stock_check.rb +++ b/app/controllers/concerns/order_stock_check.rb @@ -19,14 +19,14 @@ module OrderStockCheck end def check_order_cycle_expiry - if current_order_cycle&.closed? - Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order) - current_order.empty! - current_order.set_order_cycle! nil - flash[:info] = I18n.t('order_cycle_closed') + return unless current_order_cycle&.closed? - redirect_to main_app.shop_path - end + Bugsnag.notify("Notice: order cycle closed during checkout completion", order: current_order) + current_order.empty! + current_order.set_order_cycle! nil + + flash[:info] = I18n.t('order_cycle_closed') + redirect_to main_app.shop_path end private