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) {
|
usort($arranged_hubs, function($a, $b) {
|
||||||
if ($a['jo_count'] == $b['jo_count'])
|
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'])
|
if ($a['jo_count'] < $b['jo_count'])
|
||||||
return -1;
|
return -1;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
//error_log('arranged hubs ' . json_encode($arranged_hubs));
|
error_log('arranged hubs ' . json_encode($arranged_hubs));
|
||||||
|
|
||||||
return $arranged_hubs;
|
return $arranged_hubs;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1985,7 +1985,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
||||||
if ($this->hub_geofence->isCovered($long, $lat))
|
if ($this->hub_geofence->isCovered($long, $lat))
|
||||||
{
|
{
|
||||||
// if true, set other values for HubCriteria
|
// 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())
|
$hub_criteria->setPaymentMethod($obj->getModeOfPayment())
|
||||||
->setJoType($obj->getServiceType())
|
->setJoType($obj->getServiceType())
|
||||||
->setRoundRobin(true);
|
->setRoundRobin(true);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue