Commits
2026-09-24
🐛 fix(schedule): code-review findings on the holiday and section surfacesAhmet Kaan Gümüş · ecd544b
🐛 fix(schedule): code-review findings on the holiday and section surfaces A PATCH that moves a lesson onto an instant another lesson of the same section already starts at now answers the coded 409 session_time_taken instead of a 500 — the new UNIQUE (class_course, starts_at) was mapped on the create door only. The materialize route rejects an unrepresentable from/to (i64::MAX and friends) with a 400 naming the field, instead of panicking inside the day math; the guard is checked arithmetic over the largest offset the timezone allow-list can produce, and zoned_day's own contract is untouched. The profile course block withholds class, class_name and grade_level from a viewer who fails the same bar the classes block in the same response applies — a student could read another student's class name and grade through a shared catalogue course. visible_instances resolves the sections a teacher is assigned in with one statement instead of a query per taught course plus one per instance; every new per-section surface pays that read.
✨ feat(holidays): the non-teaching calendar over the API and the materialize routeAhmet Kaan Gümüş · 3547dc5
✨ feat(holidays): the non-teaching calendar over the API and the materialize route
`src/web/holidays.rs`: five routes (paged overlap-filtered `GET /holidays`,
`GET /holidays/{id}` for any session, manager-gated `POST`/`PATCH`/`DELETE`),
nested ungated beside `/terms` and tagged in the spec. `HolidayLimits` and the
weekly-plan materialize caps join `GET /limits`, and `max_course_sections` is
published with them.
`POST /instances/{id}/weekly-plan/materialize` turns a section's resolved plan
into dated lessons over a range: dry run by default, the same call with
`apply: true` commits, holidays and already-scheduled starts are reported as
skipped, and the response reuses `SessionResponse`. Slot DTOs carry the new
optional topic.
Also closes a wave-1 defect: `service::course_session::materialize` captured
`&PgPool`/`&ClassCourse` in its `tx_with_retry` closure, so its future was not
Send and no route could await it — now owned captures.✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer coreAhmet Kaan Gümüş · 7c481f7
✨ feat(schedule): holiday calendar, slot topics, and the weekly-plan materializer core Schema (migrations/school/20260924000001_holidays_and_materialize.sql): a school-wide `holiday` table over instant ranges, an optional `topic` on both weekly-plan slot tables, and UNIQUE (class_course, starts_at) on course_session so two lessons of one section cannot start together. Domain: `holiday` (name/kind/range newtypes, inclusive `overlaps`) and `calendar` (the school-zone day math hoisted out of web/attendance, which now imports it). `WeeklySlot` carries an optional topic; `overlaps` is unchanged. Db: `holiday` CRUD + overlap-paged list + the materializer's unpaged read; `course_session::insert_many` (one unnest INSERT .. ON CONFLICT DO NOTHING RETURNING, so the reported rows are the rows actually inserted) plus `existing_starts`; a duplicate start on the single-session route now answers 409 session_time_taken instead of a 500. Service: `holiday` pass-throughs and `course_session::materialize` — one transaction, archived-year wall, row lock on the instance, refusals coded instance_has_no_weekly_plan / instance_has_no_teacher, a range cap of 366 days and a candidate cap of 500, holidays and already-scheduled starts skipped and counted, nothing ever deleted. Dry run is side-effect free. The HTTP surface, per-section course lists, and the integration suite follow in later commits.
✨ feat(courses): grade-ladder course templates with per-class overridesAhmet Kaan Gümüş · 450bc8c
✨ feat(courses): grade-ladder course templates with per-class overrides course_offering per (course x grade_level 0..=12), per-class overrides on class_course (nullable scalars + *_inherited flags), subjects/weights/ weekly-plan axis tables, instance_resolve with batched twin, resolved title/description on instance-scoped reads, six new route groups, integration scenario test, README regenerated. Evolution migrations squashed into the base schema (20260912000002_courses + 20260916000001_k12_remodel). Local-Gate: 246daa3fb3ee7b0ff507a95d6ab346bab1333a37 (1556 passed, 455s)