Merge branch 'master' of gitlab.com:jankstudio/resq into 404-resq-script-to-run-the-generatewarrantyfromjobordercommand
This commit is contained in:
commit
29daf75633
1 changed files with 17 additions and 5 deletions
|
|
@ -2294,7 +2294,7 @@ class APIController extends Controller implements LoggedController
|
||||||
if (empty($nearest_hub_slots['hub']))
|
if (empty($nearest_hub_slots['hub']))
|
||||||
{
|
{
|
||||||
$res->setError(true)
|
$res->setError(true)
|
||||||
->setErrorMessage('No hub found.');
|
->setErrorMessage('Thank you for reaching out to us. Due to the General Community Quarantine, our Operations are from 8AM to 6PM only. Please expect a call from us tomorrow and we will assist you with your request. Thank you and stay safe!');
|
||||||
return $res->getReturnResponse();
|
return $res->getReturnResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2360,7 +2360,11 @@ class APIController extends Controller implements LoggedController
|
||||||
$schedule_date = $req->request->get('date_schedule');
|
$schedule_date = $req->request->get('date_schedule');
|
||||||
$slot_id = $req->request->get('slot_id');
|
$slot_id = $req->request->get('slot_id');
|
||||||
$advance_order = $req->request->get('flag_advance_order');
|
$advance_order = $req->request->get('flag_advance_order');
|
||||||
$flag_advance_order = ($advance_order == 1) ? true : false;
|
if ($advance_order)
|
||||||
|
$flag_advance_order = true;
|
||||||
|
else
|
||||||
|
$flag_advance_order = false;
|
||||||
|
// $flag_advance_order = $advance_order ? true : false;
|
||||||
|
|
||||||
$jo = new JobOrder();
|
$jo = new JobOrder();
|
||||||
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
$jo->setSource(TransactionOrigin::MOBILE_APP)
|
||||||
|
|
@ -2972,29 +2976,36 @@ 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);
|
||||||
$end_date->setTime(23, 59);
|
$end_date->setTime(23, 59);
|
||||||
|
|
||||||
$str_request_time = date('Y-m-d H:i:s', $request_time);
|
|
||||||
$time_of_request = DateTime::createFromFormat('Y-m-d H:i:s', $str_request_time);
|
|
||||||
|
|
||||||
// NOTE: get advance orders via query
|
// NOTE: get advance orders via query
|
||||||
// get JOs assigned to hub that are advance orders and scheduled for the next three days with
|
// get JOs assigned to hub that are advance orders and scheduled for the next three days with
|
||||||
// for hub assignment status
|
// for hub assignment status
|
||||||
|
|
@ -3009,6 +3020,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