diff --git a/src/Service/HubDistributor.php b/src/Service/HubDistributor.php index 2b32cce5..44069f03 100644 --- a/src/Service/HubDistributor.php +++ b/src/Service/HubDistributor.php @@ -95,14 +95,20 @@ class HubDistributor usort($arranged_hubs, function($a, $b) { if ($a['jo_count'] == $b['jo_count']) - return 0; + { + if ($a['distance'] == $b['distance']) + return 0; + if ($a['distance'] < $b['distance']) + return -1; + return 1; + } if ($a['jo_count'] < $b['jo_count']) return -1; else return 1; }); - //error_log('arranged hubs ' . json_encode($arranged_hubs)); + error_log('arranged hubs ' . json_encode($arranged_hubs)); return $arranged_hubs; } diff --git a/src/Service/JobOrderHandler/ResqJobOrderHandler.php b/src/Service/JobOrderHandler/ResqJobOrderHandler.php index 971f6903..092e9bf6 100644 --- a/src/Service/JobOrderHandler/ResqJobOrderHandler.php +++ b/src/Service/JobOrderHandler/ResqJobOrderHandler.php @@ -1985,7 +1985,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface if ($this->hub_geofence->isCovered($long, $lat)) { // if true, set other values for HubCriteria - // error_log('Area is covered by hub filtering'); + error_log('Area is covered by hub filtering'); $hub_criteria->setPaymentMethod($obj->getModeOfPayment()) ->setJoType($obj->getServiceType()) ->setRoundRobin(true);