live timing: Show event status #93
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "live-timing/event-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #85
The public live timing site now shows each event's status (pending / active / complete) plus start and end times, taken from the admin event lifecycle transitions.
Data flow
Changes
Postgres (
libs/timekeeping_persistence)20260927_0001: nullablestarted_at/ended_atcolumns onevents(existing rows stay NULL — displayed as unknown)update_event_status()stampsstarted_aton PENDING→ACTIVE andended_aton ACTIVE→COMPLETEDget_events()returns the new fieldsRelay (
live_timing_relay)_sync_event_status()compares a per-event(status, started_at, ended_at)snapshot and calls the newset_eventRPC only on change (cheap: fires on transitions, not per poll)Server (
live_timing_server)eventstable created ininit_db()(no migration needed for existing volumes)set_event(token, name, status, started_at, ended_at)RPC methodget_events()now returns{name, status, started_at, ended_at}; events known only through lap traffic (legacy data) getNULLmetadata; ordering: ACTIVE → PENDING → COMPLETED → unknown, then most recent activityset_eventupserts, so a relay restart heals any transitions the server missedUI (
live_timing_server/templates)Notes
init_db().ui/) already manages PENDING/ACTIVE/COMPLETED transitions — no changes needed there; timestamps are stamped server-side.target-version py314rewritesexcept (A, B):into PEP 758 bare form (invalid on the Python 3.12 the containers run) —models.pywas kept compatible deliberately; pre-existing formatting churn left untouched sincelive_timing_serveris not part ofmake check.Testing
live_timing_servertests (5 new: legacy-only events, set_event roundtrip/update, empty-name rejection, ACTIVE-first ordering, join dedup)_poll_once→ real XML-RPCset_event→ SQLite → Flask routes render correct status/times; cache suppresses redundant pushes; invalid transitions still rejectedmake checkpasses