Timetable & Schedule
One-line: Build each class’s repeating weekly grid of who teaches what and when, and derive “today’s schedule” from it for every teacher and student.
What it does
Timetable holds the weekly, repeating plan for a school: a grid of class x day x period x subject x teacher. One row exists per period, per weekday, per class — so Class 10-A, Monday, Period 1 maps to Mathematics taught by Priya Sharma. Around that grid sit the period structure (how many periods a day, when the day starts, where lunch falls) and a set of slots that fill it in.
Schedule is the read-side view derived from that grid. Given the current weekday, it answers “what is happening today?” for whoever is asking — a teacher sees their own periods across classes, a student sees their class’s periods, an admin can see all of it — with any date-specific overrides (a cancelled day, a substitute teacher) applied on top.
Who uses it
- Admins and academic coordinators — build and edit the grid on the admin-web Timetable page (visual weekly table, drag-and-drop, live conflict warnings, auto-generate).
- Branch-restricted sub-admins — same page, limited to classes in their own school unit(s).
- Teachers and students — consume it: a weekly view and a “today” list in the mobile app.
Key concepts
- Timetable config — one per tenant per academic year: total periods, period duration, day start time, which period is lunch.
- Slot — one filled cell of the grid: a class + day + period assigned a subject and teacher.
- Period — a numbered time band in the day, with computed start/end times derived from the config.
- Bell schedule / academic settings — the config-driven period times and lunch break that turn “Period 3” into
09:30–10:15. - Today’s schedule — the derived, per-user list of today’s periods (with overrides applied), not a stored table.
How it works
1. Configure periods / bell schedule → set periods-per-day, duration, start time, lunch period
2. Fill slots per class → assign subject + teacher to each day/period (manual or auto-generate)
3. Conflict detection → block a placement that double-books a teacher or class
4. Derive today's schedule → resolve current weekday + user → their periods, apply overridesAdmins can auto-generate a class’s grid (respecting teacher availability and workload) or edit slots by hand. Overrides record one-off, date-specific changes on top of the base grid.
Rules & edge cases
- Gated behind the
timetable/schedule_managementplan keys — tenants without them do not get the module. - Teacher double-booking is rejected server-side on slot create and update (and on move/swap), not just flagged advisorily; update only re-checks when the placement actually changes, so a room-only edit is not blocked by a pre-existing conflict.
- Tenant-scoped: every query is isolated by tenant.
- Mobile weekly views require the caller to map to a Teacher/Student row in the tenant, else
403; a student with no class enrollment gets409.
Where it lives
- Backend:
server/modules/timetable/,server/modules/schedule/ - Admin web: Timetable page +
admin-web/src/services/timetableService.ts - Mobile: weekly grid + today-view screens (
client/) - Plan keys:
timetable,schedule_management