Skip to main content

Module chores

Module chores 

Source

Structs§

ChoresState
The user’s chore list for the current local day, held in the scheduler while it runs. Mirrors the screen_time pattern: a snapshot loaded at boot, rolled over when the local day changes, and persisted on mutation.

Constants§

MORNING_PROMPT_FLOOR_MIN 🔒
Earliest local minute-of-day the morning chore prompt may fire. Guards the all-day work-window case (work_start = 00:00) so the prompt lands in the morning rather than at the post-midnight rollover tick.

Functions§

next_prompt
Pick the next chore to surface and advance the rotation cursor. Returns None when the list is empty (nothing to nudge). Pure: takes and mutates plain data so the cycling maths is unit-testable without a store.
persist_chores
Persist state to disk, logging (never panicking) on failure — a chore list is best-effort, and a write error must not take down the scheduler.
prompt_for_break
Resolve the chore nudge for a break. Only long breaks draw a chore — micro breaks are too short to start a task and bedtime is for winding down. Advances the rotation cursor as a side effect for long breaks with a non-empty list.
rollover_if_new_day
Reset state to an empty list if today differs from its stored date. Returns true iff a rollover happened (so the caller can decide whether to persist).
should_prompt_morning_chores
Whether to surface the morning chore prompt this tick. Fires once per local day — the first time the user is inside their work window (past an early-morning floor), while today’s list is still empty and we haven’t already prompted today. Only nudges users who have ever used chores: the list resets empty every morning, so without this a user who never touches chores would have Preferences popped open every single work-day on a permanently-empty list. Pure so the gating is unit-testable without a scheduler or clock.