fix(parent-complete): clear today's assignee for rotation chores#355
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
coord_assignments.py_is_rotation_done_todayfiltered withif comp.child_id not in pool: continue. The__parent__sentinel id is never in the rotation pool, so a parent-completion didn't count towarddaily_limitand the chore stayed visible on the active child's list. This contradicted the docstring above the call site incoord_chores.pywhich already noted that parent completions should retire the chore for the whole pool.coord_chores.pyasync_parent_complete_chorewrote a completion + per-childlast_completed, but never clearedchore.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 countcomp.child_id == "__parent__"toward the daily quota.async_parent_complete_chore: clearchore.assignment_current_child_idfor non-everyone modes and persist viaupdate_chore. The midnight refresh restores it normally for the next day.Everyone-mode chores are untouched (they don't cache a current assignee).
Tests
test_parent_complete_does_not_change_rotation_pointer→test_parent_complete_clears_rotation_pointer_todayand flipped the assertion. The old name captured the broken behavior, not the desired one.test_parent_complete_preserves_everyone_mode_pointer(no-op for everyone-mode).test_parent_complete_counts_toward_rotation_done_today(asserts_is_rotation_done_todayflips to True after a parent completion).Test plan
—.Fixes #351