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();