Merge branch '596-add-distance-when-sorting-for-round-robin-hub-filtering' into 'master-fix'
Resolve "Add distance when sorting for round robin hub filtering" See merge request jankstudio/resq!714
This commit is contained in:
commit
a2fa95ac98
4 changed files with 71 additions and 63 deletions
|
|
@ -95,14 +95,20 @@ class HubDistributor
|
|||
|
||||
usort($arranged_hubs, function($a, $b) {
|
||||
if ($a['jo_count'] == $b['jo_count'])
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class HubSelector
|
|||
$hubs_round_robin = $this->filterHubsByRoundRobin($filtered_hubs, $flag_round_robin);
|
||||
$filtered_hubs = $hubs_round_robin;
|
||||
|
||||
//error_log('round robin hubs ' . json_encode($filtered_hubs));
|
||||
error_log('round robin hubs ' . json_encode($filtered_hubs));
|
||||
|
||||
// max results filter
|
||||
$hubs_max_result = $this->filterHubsByMaxResults($filtered_hubs, $limit_results, $jo_id, $customer_id);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -2035,6 +2035,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
// counters
|
||||
$hub['rider_count'] = count($hub['hub']->getAvailableRiders());
|
||||
$hub['redis_jo_count'] = $hub['jo_count'];
|
||||
$hub['jo_count'] = count($hub['hub']->getForAssignmentJobOrders());
|
||||
|
||||
// check for rejection
|
||||
|
|
@ -2337,6 +2338,7 @@ class ResqJobOrderHandler implements JobOrderHandlerInterface
|
|||
|
||||
// counters
|
||||
$hub['rider_count'] = count($hub['hub']->getAvailableRiders());
|
||||
$hub['redis_jo_count'] = $hub['jo_count'];
|
||||
$hub['jo_count'] = count($hub['hub']->getForAssignmentJobOrders());
|
||||
|
||||
// check for rejection
|
||||
|
|
|
|||
|
|
@ -662,11 +662,11 @@
|
|||
<tr>
|
||||
<th>Hub</th>
|
||||
<th>Branch</th>
|
||||
<!--
|
||||
<th class="text-right">Distance</th>
|
||||
<!--<th class="text-right">Distance</th>
|
||||
<th class="text-right">Travel Time</th>
|
||||
-->
|
||||
<th class="text-right">Available Riders</th>
|
||||
<th class="text-right">Job Order Count</th>
|
||||
<th class="text-right">Jobs For Assignment</th>
|
||||
<th class="text-right">Inventory</th>
|
||||
<th>Contact Numbers</th>
|
||||
|
|
@ -675,7 +675,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr class="placeholder-row{{ hubs|length > 0 ? ' hide' }}">
|
||||
<td colspan="7">
|
||||
<td colspan="8">
|
||||
No items to display.
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -684,11 +684,11 @@
|
|||
<tr data-lat="{{ hub.hub.getCoordinates.getLatitude }}" data-lng="{{ hub.hub.getCoordinates.getLongitude }}" data-id="{{ hub.hub.getID }}"{{ obj.getHub and obj.getHub.getID == hub.hub.getID ? ' class="m-table__row--primary"' }}>
|
||||
<td>{{ hub.hub.getName }}</td>
|
||||
<td>{{ hub.hub.getBranch }}</td>
|
||||
<!--
|
||||
<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td>
|
||||
<!--<td class="text-right">{{ hub.distance ? hub.distance : '-' }}</td>
|
||||
<td class="text-right">{{ hub.duration ? hub.duration : '-' }}</td>
|
||||
-->
|
||||
<td class="text-right">{{ hub.rider_count }}</td>
|
||||
<td class="text-right">{{ hub.redis_jo_count }}</td>
|
||||
<td class="text-right">{{ hub.jo_count }}</td>
|
||||
<td class="text-right">{{ hub.inventory|default('0') }}</td>
|
||||
<td>{{ hub.hub.getContactNumbers|replace({"\n": ', '}) }}</td>
|
||||
|
|
|
|||
Loading…
Reference in a new issue