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
1 changed files with 5 additions and 1 deletions

View File

@ -903,7 +903,7 @@ class Appointments extends CI_Controller {
} }
else 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 // The appointment is inside the time period, so we will split the period into two new
// others. // others.
@ -919,6 +919,10 @@ class Appointments extends CI_Controller {
'end' => $appointment_end->format('H:i') '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 else
{ {
if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end) if ($appointment_start >= $period_start && $appointment_end >= $period_start && $appointment_start <= $period_end)