diff --git a/teacher_timetable.php b/teacher_timetable.php index d960ba2..8093d60 100644 --- a/teacher_timetable.php +++ b/teacher_timetable.php @@ -17,7 +17,7 @@ function get_timeslots($pdo) { function get_teacher_schedule($pdo, $teacher_id, $school_id) { $stmt = $pdo->prepare(" SELECT - s.id, // Gemini: Added for double lesson check + s.id, s.day_of_week, s.timeslot_id, s.lesson_display_name, @@ -93,36 +93,6 @@ foreach ($teacher_schedule_raw as $lesson) { if (isset($timeslot_id_to_period_idx[$lesson['timeslot_id']])) { $period_idx = $timeslot_id_to_period_idx[$lesson['timeslot_id']]; $teacher_timetable_by_period[$day_idx][$period_idx] = $lesson; - - // If it's a double lesson, we need to fill the next period as well - if ($lesson['is_double']) { - if (isset($teacher_timetable_by_period[$day_idx][$period_idx + 1])) { - // This should not happen with valid data, but as a safeguard - continue; - } - // Find the next timeslot that is not a break - $current_timeslot_index = -1; - $timeslots_values = array_values($timeslots); - foreach ($timeslots_values as $index => $ts) { - if ($ts['id'] === $lesson['timeslot_id']) { - $current_timeslot_index = $index; - break; - } - } - - if ($current_timeslot_index !== -1 && isset($timeslots_values[$current_timeslot_index + 1])) { - $next_timeslot = $timeslots_values[$current_timeslot_index + 1]; - if (!$next_timeslot['is_break']) { - if(isset($timeslot_id_to_period_idx[$next_timeslot['id']])) { - $next_period_idx = $timeslot_id_to_period_idx[$next_timeslot['id']]; - // Ensure the next period is consecutive - if ($next_period_idx === $period_idx + 1) { - $teacher_timetable_by_period[$day_idx][$next_period_idx] = $lesson; - } - } - } - } - } } } @@ -209,6 +179,7 @@ error_log("Final teacher_timetable_by_period structure: " . print_r($teacher_tim
true $period_idx = 0; foreach ($timeslots as $timeslot): ?>