* Fixed issue #26

This commit is contained in:
alextselegidis@gmail.com 2013-11-25 08:48:54 +00:00
parent f0a28c7451
commit e522af54f2
1 changed files with 4 additions and 2 deletions

View File

@ -354,7 +354,7 @@ class Appointments extends CI_Controller {
$current_hour = $start_hour;
$diff = $current_hour->diff($end_hour);
while (($diff->h * 60 + $diff->i) > intval($_POST['service_duration'])) {
while (($diff->h * 60 + $diff->i) >= intval($_POST['service_duration'])) {
$available_hours[] = $current_hour->format('H:i');
$current_hour->add(new DateInterval("PT15M"));
$diff = $current_hour->diff($end_hour);
@ -382,6 +382,8 @@ class Appointments extends CI_Controller {
}
}
$available_hours = array_values($available_hours);
sort($available_hours, SORT_STRING );
$available_hours = array_values($available_hours);
echo json_encode($available_hours);
@ -537,7 +539,7 @@ class Appointments extends CI_Controller {
// We will need to break this period and leave the available part.
$period['start'] = $a_end;
} else if ($a_start >= $p_start && $a_end <= $p_start) {
} else if ($a_start >= $p_start && $a_end <= $p_end) {
// The appointment is inside the time period, so we will split the period
// into two new others.
unset($available_periods_with_appointments[$index]);