Add sorting by distance to round robin. #596
This commit is contained in:
parent
bad6de1ed2
commit
625236667b
2 changed files with 9 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue