now to check results of teacher timetable

This commit is contained in:
Flatlogic Bot 2025-12-06 17:09:31 +00:00
parent 2fe54d548e
commit 729ef9f5af

View File

@ -80,22 +80,17 @@ if ($selected_teacher_id) {
} }
// Organize schedule for easy display // Organize schedule for easy display
$teacher_timetable = array_fill(0, count($days_of_week), []); $teacher_timetable = [];
foreach ($timeslots as $timeslot) { foreach ($teacher_schedule_raw as $lesson) {
if (!$timeslot['is_break']) { $day_idx = $lesson['day_of_week'] - 1; // Days are 1-5, array is 0-4
foreach ($days_of_week as $day_idx => $day) { if (!isset($teacher_timetable[$day_idx])) {
$teacher_timetable[$day_idx][$timeslot['id']] = null; $teacher_timetable[$day_idx] = [];
}
} }
$teacher_timetable[$day_idx][$lesson['timeslot_id']] = $lesson;
} }
foreach ($teacher_schedule_raw as $lesson) { // Gemini: Log the final structure
$day_idx = $lesson['day_of_week'] - 1; // Adjust for 0-based array index error_log("Final teacher_timetable structure: " . print_r($teacher_timetable, true));
$timeslot_id = $lesson['timeslot_id'];
if (isset($teacher_timetable[$day_idx]) && isset($teacher_timetable[$day_idx][$timeslot_id])) {
$teacher_timetable[$day_idx][$timeslot_id] = $lesson;
}
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>