Merge branch '403-resq-refactor-setting-of-each-day-in-auto-assign-advance-order-jo' into 'master'

Deplete next rider slot for scheduled order if it overlaps #403

Closes #403

See merge request jankstudio/resq!461
This commit is contained in:
Kendrick Chan 2020-05-09 14:27:48 +00:00
commit 0f579ad0cb

View file

@ -3071,7 +3071,19 @@ class APIController extends Controller implements LoggedController
error_log("SLOT - $date_string - $slot_id");
// decrement rider slot
$hub_rider_slots[$date_string][$slot_id]--;
if (isset($hub_rider_slots[$date_string][$slot_id]))
$hub_rider_slots[$date_string][$slot_id]--;
// check if it goes through next slot (10 min allowance)
$mins = $date_sched->format('i');
if ($mins > 10)
{
$next_slot_id = sprintf('%02d_$02d', $hour + 1, $hour + 2);
// decrement rider slot
if (isset($hub_rider_slots[$date_string][$next_slot_id]))
$hub_rider_slots[$date_string][$next_slot_id]--;
}
}
error_log(print_r($hub_rider_slots, true));