From e80ce9db664e6884525f505f0568fc57b7458d84 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Thu, 24 Mar 2022 05:38:18 +0000 Subject: [PATCH] Fix issues found while testing. #651 --- src/Controller/APIController.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Controller/APIController.php b/src/Controller/APIController.php index 3e4d2906..49cde869 100644 --- a/src/Controller/APIController.php +++ b/src/Controller/APIController.php @@ -4336,7 +4336,16 @@ class APIController extends Controller implements LoggedController foreach ($nearest_hubs_with_distance as $nhd) { if (empty($nearest)) - $nearest = $nhd; + { + // get the slots for the hub to check if hub is available for assignment + $hub_slots = $this->getHubRiderSlots($nhd['hub'], $em); + + $flag_hub_available = $hub_slots['flag_hub_available']; + if ($flag_hub_available == true) + { + $nearest = $nhd; + } + } else { if ($nhd['distance'] < $nearest['distance'])