Phase 6 follow-up: today-and-future events, one write per school-wide event

Two corrections found while preparing the first live run:

- A scan that runs late in the day still records today's school events; the
  candidate window now starts at the local start of day instead of "now".
- The Compass week calendar is school-wide, so one event is stored against each
  child. Write it once, with no child prefix in the title, and record the same
  Home Assistant event id on every child's item. A per-child event still keeps
  the child's name.

Also report pending events as events, not rows, in `school calendar status`.
Tests cover the window and the de-duplication.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-10-15 18:05:33 +11:00
parent f6be17fe4f
commit f56dbb46ac
5 changed files with 244 additions and 80 deletions

View File

@@ -17,7 +17,12 @@ only write is to the calendar (rule 7 — no approval needed).
`5 - 11HLEGB5 - D8 - LHT` and an event as
`End of Year Senior Music Concert - HALL (Senior Music Concert) - KSH, CFR`.
The first part of a lesson is a period label (`5`, `C`, `RLE GROUP D`).
- Only **future** events are written: a past lesson is history, not a plan.
- Only **today and future** events are written: a scan that runs late in the
day still records today's school events, but yesterday is history.
- The Compass week calendar is **school-wide**, so the same event is stored
against each child. A school-wide event is written **once**, with no child
prefix in its title, and every child's item records the same event id. A
per-child event keeps the child's name in its title (`Harry — …`).
- Which events qualify is visible before anything is written:
```bash
@@ -116,6 +121,19 @@ internal/web/server.go the item action + the fail-loud calendar banner
scripts/calendar-push.sh one-off container runner (no service restart)
```
## Found while building (worth a decision later)
The Compass week-calendar page looks **school-wide, not child-filtered**: Finn's
page carries `Year 11 Assembly` and `Tour to China photo` exactly as Harry's
does, while their lesson grids differ. Phase 6 handles that honestly — a shared
event is written once and both children's items record the same event id — but
the **per-child attribution** of a school-wide event is a Phase 3/4 data
question, not a calendar one. It matters for the Phase 7 per-boy brief.
The week grid also stops at Thursday in the stored pages (Monday–Thursday have
lessons, Friday–Sunday do not), so a Friday scan may be the first to carry
future school events.
## Verification
```bash