Resolve "Fix nearest hub issue" #1574

Merged
korina.cordero merged 5 commits from 651-fix-nearest-hub-issue into master 2022-03-24 06:35:40 +00:00
Showing only changes of commit 457bbece2b - Show all commits

View file

@ -4326,6 +4326,7 @@ class APIController extends Controller implements LoggedController
}
$nearest = null;
$hub_slots = [];
$slot_found = false;
// find the nearest hub
if (!empty($nearest_hubs_with_distance))
@ -4349,18 +4350,18 @@ class APIController extends Controller implements LoggedController
if ($flag_hub_available == true)
{
$nearest = $nhd;
// temporarily set hub_data to nearest
$hub_data = [
'hub' => $nhd['hub'],
'slots' => $hub_slots['slot_data'],
];
}
}
}
}
}
// set hub data to what is in nearest
$hub_data = [
'hub' => $nearest['hub'],
'slots' => $hub_slots['slot_data'],
];
return $hub_data;
}
@ -4525,7 +4526,10 @@ class APIController extends Controller implements LoggedController
error_log('total rider slots ' . $total_rslots);
error_log('total unavailable slots ' . $total_unavailable_slots);
if ($total_rslots == $total_unavailable_rslots)
{
error_log('hub has no available slots');
$hub_available = false;
}
$hs_data = [
'flag_hub_available' => $hub_unavailable,