forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/db/holiday.rsClear filter

2026-09-24

✨ 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.