Skip to content

fix(rewards): measure reward progress against the selected child (#1068) - #1069

Merged
tempus2016 merged 1 commit into
mainfrom
fix/1068-rewards-progress-selected-child
Oct 15, 2026
Merged

tempus2016 merged 1 commit into
mainfrom
fix/1068-rewards-progress-selected-child

Conversation

@tempus2016

Copy link
Copy Markdown
Owner

Fixes #1068

What was wrong

On a rewards card with no child_id pinned, the progress bar and the x/cost figure always used the first child's points. Switching child tabs updated the spendable balance and the claim button, but every child's bar showed the first child's progress. The bar could read 100% while the claim button was disabled, or the other way round.

The same line was in both render paths: the classic row (_renderRewardRow) and the designed-style rows (_rewardData).

Fix

Both paths now take the points from relevantChild. That is the pinned child, or the selected tab when nothing is pinned, and it is the same child the affordability check already used. A pinned card behaves as before. Jackpot and pool-mode rewards are unchanged.

Testing

  • New frontend tests: two children with 30 and 10 points and a 40-point reward. Selecting each child gives 75% / 25% on both the classic and designed rows, and a card pinned to the second child shows 25%. The test failed before the fix.
  • node --test tests/frontend/*.test.cjs: 683 passed. ESLint is clean.
  • ha-dev: injected the worktree card next to the shipped one and used a temporary 1000-point reward. With Vaiha selected, the shipped card showed 756/1000 (Malia's points); the fixed card showed 638/1000 on both classic and playroom. The test reward was removed afterwards.

With no child_id pinned, the progress bar and points figure used the first
child's points for every child, so switching tabs changed the balance and
the claim button but not the bar. Both render paths now use the pinned or
selected child, the same child the affordability check already uses.
@github-actions github-actions Bot added cards Lovelace cards / frontend (www/*.js) tests Test suite labels Oct 15, 2026
@tempus2016
tempus2016 merged commit 5847d40 into main Oct 15, 2026
16 checks passed
@tempus2016
tempus2016 deleted the fix/1068-rewards-progress-selected-child branch October 15, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cards Lovelace cards / frontend (www/*.js) tests Test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Rewards Card - Point denominator doesn’t update

1 participant