mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-12-22 06:32:24 +03:00
* Fixed issue #26
This commit is contained in:
parent
f0a28c7451
commit
e522af54f2
1 changed files with 4 additions and 2 deletions
|
@ -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]);
|
||||
|
|
Loading…
Reference in a new issue