Repository navigation
feat(chores): allow transferring a chore back to the bonus pool from the Transfer dialog - #372
Conversation
|
Read c614681, not run. The change does what it says and stays in the widget: the bonus row appears only for an assigned chore, the dialog no longer reads id 0 as nothing selected, the revoke/keep box stays hidden for the pool, and the menu item shows for a single-person household. One thing before merge. A pending transfer bonus rides back into the pool. If a parent moved a chore to Henry with "keep reward" (the schedule now carries Optional: the menu condition now repeats the dialog's rule in a second form. |
…he pool A chore moved to a user with "keep reward" carries transfer_bonus_clams. Sending it back to bonus left that value on the schedule, so whoever claimed it from the pool would be paid the previous holder's bonus. confirmTransfer now sends transfer_bonus_clams: 0 for a pool target, which the API already accepts. Also collapses the Transfer menu-item condition onto getTransferTargets, which states the same rule once. Addresses review feedback on jherforth#372.
|
Fixed, thanks for catching it:
Commit a6342fb on this branch; |
Description
A chore that was assigned to a person could never go back to the bonus pool
from the wall display: the Transfer dialog only ever listed real users. The
schedule editor already allowed it (its "Unassigned (Bonus chore)" choice),
and the API already accepted it (
PATCH /api/chore-schedules/:idwithuser_id: 0stores NULL, which is how the bonus pool is read) — only thewidget's Transfer dialog blocked it.
This change closes that UI gap, nothing else:
🧺) as a target whenever the chore is currently assigned to someone. A
chore that is already in the bonus pool gets no bonus row.
selected": the confirm button enables for the bonus target, and the
already-finished revoke/keep choice stays hidden for bonus (the pool has
no day to complete, so no transfer bonus is ever attached on the way
back).
there is no other real user to hand it to (previously it required another
person in the list, so a single-person household could not transfer
back at all).
Unchanged on purpose: assigning to real users, claiming a bonus chore,
streaks, schedules, and completion behavior. A transfer bonus attached by
an earlier person-to-person move still rides on the schedule and pays
whoever completes it next, exactly as before — moving back to bonus does
not clear it. The daily-bonus re-check on reassignment already handles a
null new owner (it skips the award for bonus and re-checks the previous
owner, who may have become all-done by losing the chore).
Changes
client/src/components/ChoreWidget.jsx— bonus target in the Transferdialog, 0-safe selection/confirm handling, Transfer menu gating.
client/src/utils/choreHelpers.js— new puregetTransferTargetshelper (real users except the assignee, plus the bonus row when
assigned).
client/src/utils/choreHelpers.test.js— unit tests for the helper.server/tests/choreTransferBack.test.js— real-server test: assigned→ PATCH
user_id: 0→ reads back NULL (bonus pool) → claimable againby a person. No server change was needed; the test pins the API half.
Verification
getTransferTargetstests).chore assigned to one person, opened its Transfer dialog (bonus row
listed alongside the other people, assignee correctly excluded),
transferred to the bonus pool, and confirmed via the API that the
schedule's assignee reads back as null and that the chore appears in
the Bonus Chores pool with claim buttons for every person.
Screenshots
Transfer dialog showing the bonus target:
The chore back in the Bonus Chores pool after transfer (2-clam card with
claim buttons for every person):
Generated with Muse AI 🤖