Fix issues found while testing. #651

This commit is contained in:
Korina Cordero 2022-03-24 05:28:15 +00:00
parent b7c5f5dafe
commit 457bbece2b

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,17 +4350,17 @@ class APIController extends Controller implements LoggedController
if ($flag_hub_available == true)
{
$nearest = $nhd;
}
}
}
}
}
// temporarily set hub_data to nearest
// set hub data to what is in nearest
$hub_data = [
'hub' => $nhd['hub'],
'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,