From 0f5bf2e8d63812ac2589b19e46b232fe8cc155f9 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 23 Jun 2020 09:40:39 +0000 Subject: [PATCH] Fix error when rider is not selected. #424 --- .../JobOrderHandler/CMBJobOrderHandler.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Service/JobOrderHandler/CMBJobOrderHandler.php b/src/Service/JobOrderHandler/CMBJobOrderHandler.php index 339f64cd..2dd355d5 100644 --- a/src/Service/JobOrderHandler/CMBJobOrderHandler.php +++ b/src/Service/JobOrderHandler/CMBJobOrderHandler.php @@ -558,19 +558,6 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface } } - // set priority based on rider's existing open job orders - $rider_jos = $rider->getOpenJobOrders(); - - // get maximum priority then add 1 - // NOTE: this can be a bit buggy due to concurrency issues - // ideally have to lock jo table, but that isn't feasible right now - $priority = 0; - foreach ($rider_jos as $rider_jo) - { - if ($priority < $rider_jo->getPriority()) - $priority = $rider_jo->getPriority() + 1; - } - // get discount and set to meta $discount = $req->request->get('invoice_discount', []); @@ -583,6 +570,19 @@ class CMBJobOrderHandler implements JobOrderHandlerInterface if (empty($error_array)) { + // set priority based on rider's existing open job orders + $rider_jos = $rider->getOpenJobOrders(); + + // get maximum priority then add 1 + // NOTE: this can be a bit buggy due to concurrency issues + // ideally have to lock jo table, but that isn't feasible right now + $priority = 0; + foreach ($rider_jos as $rider_jo) + { + if ($priority < $rider_jo->getPriority()) + $priority = $rider_jo->getPriority() + 1; + } + // get current user $user = $this->security->getUser();