Repository navigation
Conversation
…l at nightly cleanup The nightly reset only touched one-time cards (crontab IS NULL), so a recurring daily bonus chore claimed from the pool kept its claimer after completion: the schedule row itself carries the assignment, and nothing ever cleared it. Extend dailyBackgroundProcessing with a second reset that returns a recurring bonus schedule to the pool once its current holder completed it for the day that just ended. A claim that was never completed stays assigned — the holder still owes it, and a parent can move it back with the Transfer dialog. Completing today does not return it early, so nobody can claim and complete the same chore twice in a day.
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.
What this fixes
A recurring bonus chore claimed from the bonus pool never cycled back to the pool. Once a kid claimed a daily bonus chore (a schedule with a
crontaband aclam_value > 0), it stayed assigned to them forever, even after they completed it — so nobody else ever got a turn at it.The cause is in the nightly cleanup in
dailyBackgroundProcessing(server/index.js): the existing reset that returns bonus chores to the pool only covers one-time cards, because it filterscrontab IS NULL. A recurring daily bonus chore never matches that filter, so it was never returned.The fix
After the existing reset, the nightly job now also looks for recurring bonus schedules (
crontab IS NOT NULL, visible,clam_value > 0, currently assigned) where the current holder has acompletionhistory entry for the day that just ended, and sets those schedules'user_idback toNULL— returning them to the bonus pool for the next day. The result is reported asreturnedBonusSchedulesCountalongside the existing nightly counts.Two cases are deliberately left alone:
Tests
New test file
server/tests/bonusChoreReturnToPool.test.js(5 tests):Results on this branch head, rebased onto current
upstream/main(811c9b7):As a control, the new tests were also run against the unmodified base: 4/5 pass there, with exactly the bug test failing (the schedule kept
user_id: 1instead of returning toNULL), confirming the tests capture the bug and the fix resolves it.Verification
Verified locally on a local demo stack with a live database, running the real nightly job:
user_idstill set).No UI change, so no screenshot.
Generated with Muse AI 🤖