Skip to content

fix(parent-complete): clear today's assignee for rotation chores#355

Merged
tempus2016 merged 1 commit into
mainfrom
fix/parent-complete-clears-assignee
May 11, 2026
Merged

fix(parent-complete): clear today's assignee for rotation chores#355
tempus2016 merged 1 commit into
mainfrom
fix/parent-complete-clears-assignee

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

Summary

Clicking Parents did it on a rotation-mode chore (alternating / random / balanced) showed a success toast but left the chore visually assigned to the same child for the rest of the day — both on the child's stats card and in the Manage Chores Current column.

Root cause

Two gaps in the parent-completion path:

  1. coord_assignments.py _is_rotation_done_today filtered with if comp.child_id not in pool: continue. The __parent__ sentinel id is never in the rotation pool, so a parent-completion didn't count toward daily_limit and the chore stayed visible on the active child's list. This contradicted the docstring above the call site in coord_chores.py which already noted that parent completions should retire the chore for the whole pool.
  2. coord_chores.py async_parent_complete_chore wrote a completion + per-child last_completed, but never cleared chore.assignment_current_child_id. The midnight refresh recomputes it next day, but until then the Current column kept pointing at the original child.

Fix

  • _is_rotation_done_today: also count comp.child_id == "__parent__" toward the daily quota.
  • async_parent_complete_chore: clear chore.assignment_current_child_id for non-everyone modes and persist via update_chore. The midnight refresh restores it normally for the next day.

Everyone-mode chores are untouched (they don't cache a current assignee).

Tests

  • Renamed test_parent_complete_does_not_change_rotation_pointertest_parent_complete_clears_rotation_pointer_today and flipped the assertion. The old name captured the broken behavior, not the desired one.
  • Added test_parent_complete_preserves_everyone_mode_pointer (no-op for everyone-mode).
  • Added test_parent_complete_counts_toward_rotation_done_today (asserts _is_rotation_done_today flips to True after a parent completion).
  • Full suite: 454 passed. Ruff: clean.

Test plan

  • Manage Chores → pick a chore in alternating/random/balanced mode. Confirm Current column shows a child.
  • Click Parents did it (👤✓), accept the confirmation.
  • Current column now shows .
  • The chore disappears from the child's stats card / active list for the rest of the day.
  • After next midnight, the rotation recomputes normally (same alternating cadence as if the chore had not been completed by a child).

Fixes #351

When a parent clicks "Parents did it" on a rotation-mode chore
(alternating / random / balanced), the chore was visually still
assigned to the original child for the rest of the day:

- `_is_rotation_done_today` excluded `__parent__` completions (the
  sentinel id isn't in the rotation pool), so the chore stayed on
  the active child's list even though the completion was recorded.
- `async_parent_complete_chore` never touched `chore.assignment_
  current_child_id`, so the "Current" column kept pointing at the
  original child until the next midnight refresh.

Fix both gaps:

- Count `__parent__` completions toward the daily quota in
  `_is_rotation_done_today` so the chore disappears from every pool
  member's view, including the active child's. This matches the
  intent already documented in the function's docstring.
- Clear today's cached `assignment_current_child_id` for rotation
  chores in `async_parent_complete_chore`. The midnight refresh
  (`_async_refresh_assignments_and_publish`) recomputes the pointer
  normally for the next day; everyone-mode chores are untouched.

The pre-existing `test_parent_complete_does_not_change_rotation_
pointer` was renamed to assert the new (and intended) behavior. Two
new tests cover the everyone-mode no-op case and the rotation-done-
today quota fill.

Fixes #351
@tempus2016 tempus2016 merged commit 36918cc into main May 11, 2026
2 checks passed
@tempus2016 tempus2016 deleted the fix/parent-complete-clears-assignee branch May 11, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: "Parents did it" button does not clear assignee to 'None'

1 participant