Added fix for endless loop issue during availabilities generation.

This commit is contained in:
alext 2018-02-02 14:40:01 +01:00
parent edbe78c6f4
commit 75b7fe69f6

View file

@ -903,7 +903,7 @@ class Appointments extends CI_Controller {
}
else
{
if ($appointment_start >= $period_start && $appointment_end <= $period_end)
if ($appointment_start >= $period_start && $appointment_end < $period_end)
{
// The appointment is inside the time period, so we will split the period into two new
// others.
@ -919,6 +919,10 @@ class Appointments extends CI_Controller {
'end' => $appointment_end->format('H:i')
];
}
else if ($appointment_start == $period_start && $appointment_end == $period_end)
{
unset($periods[$index]); // The whole period is blocked so remove it from the available periods array.
}
else
{
if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end)