Merge branch '399-app-advance-order-issues' into 'master'
Make hub slot computation easier #399 Closes #399 See merge request jankstudio/resq!454
This commit is contained in:
commit
5eff2d4f76
1 changed files with 11 additions and 0 deletions
|
|
@ -2976,21 +2976,31 @@ class APIController extends Controller implements LoggedController
|
||||||
protected function getHubRiderSlots(Hub $hub, EntityManagerInterface $em)
|
protected function getHubRiderSlots(Hub $hub, EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
// check hub's advance orders for the day
|
// check hub's advance orders for the day
|
||||||
|
|
||||||
|
/*
|
||||||
// get number of advance orders for the next day if request came in before midnight
|
// get number of advance orders for the next day if request came in before midnight
|
||||||
// or for current day if request came in after midnight
|
// or for current day if request came in after midnight
|
||||||
// check request_time
|
// check request_time
|
||||||
$request_time = time();
|
$request_time = time();
|
||||||
$midnight = strtotime('00:00');
|
$midnight = strtotime('00:00');
|
||||||
|
*/
|
||||||
$start_date = new DateTime();
|
$start_date = new DateTime();
|
||||||
$end_date = new DateTime();
|
$end_date = new DateTime();
|
||||||
|
|
||||||
|
// to keep things simple, just start on next day regardless of midnight timer
|
||||||
|
$start_date->add(new DateInterval('P1D'));
|
||||||
|
$end_date->add(new DateInterval('P3D'));
|
||||||
|
|
||||||
|
/*
|
||||||
if ($request_time < $midnight)
|
if ($request_time < $midnight)
|
||||||
{
|
{
|
||||||
// add +1 to start date to get the next day
|
// add +1 to start date to get the next day
|
||||||
// add +3 to date to end date to get the advance orders for the next three days
|
// add +3 to date to end date to get the advance orders for the next three days
|
||||||
$start_date->add(new DateInterval('P1D'));
|
$start_date->add(new DateInterval('P1D'));
|
||||||
|
$end_date->add(new DateInterval('P1D'));
|
||||||
}
|
}
|
||||||
$end_date->add(new DateInterval('P2D'));
|
$end_date->add(new DateInterval('P2D'));
|
||||||
|
*/
|
||||||
|
|
||||||
// set time bounds for the start and end date
|
// set time bounds for the start and end date
|
||||||
$start_date->setTime(0, 1);
|
$start_date->setTime(0, 1);
|
||||||
|
|
@ -3013,6 +3023,7 @@ class APIController extends Controller implements LoggedController
|
||||||
'status_fulfilled' => JOStatus::FULFILLED,
|
'status_fulfilled' => JOStatus::FULFILLED,
|
||||||
])
|
])
|
||||||
->getResult();
|
->getResult();
|
||||||
|
// check request_time
|
||||||
|
|
||||||
// check each JO's date_schedule, decrement rider_slots if date schedule falls in that slot
|
// check each JO's date_schedule, decrement rider_slots if date schedule falls in that slot
|
||||||
// index - equivalent time
|
// index - equivalent time
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue