Skip to content

Add penalty system for point deductions#11

Merged
tempus2016 merged 2 commits intomainfrom
claude/analyze-test-coverage-LkM4P
Mar 24, 2026
Merged

Add penalty system for point deductions#11
tempus2016 merged 2 commits intomainfrom
claude/analyze-test-coverage-LkM4P

Conversation

@tempus2016
Copy link
Copy Markdown
Owner

@tempus2016 tempus2016 commented Mar 24, 2026

Summary

  • New Penalty data model (name, points to deduct, description, icon, optional per-child assignment)
  • Full backend CRUD — storage, coordinator methods, and 4 new HA services (add_penalty, update_penalty, remove_penalty, apply_penalty)
  • Penalties surfaced in sensor.taskmate_overview attributes so the card can read them
  • New taskmate-penalties-card Lovelace card

How it works

  1. Open the card and tap the pencil icon to enter edit mode
  2. Tap New Penalty, enter a name (e.g. "Not going to bed") and the number of points to deduct, then save
  3. Switch back to normal mode, select the child (tab at the top), then tap Apply on the relevant penalty
  4. Points are deducted immediately, the tile flashes red, and a toast confirms the action

The deduction is logged in the activity feed as Penalty: <name> so it appears in the history.

Test plan

  • Add a penalty via the card → verify it appears in the list
  • Apply a penalty to a child → verify points decrease and activity log shows the deduction
  • Edit a penalty name/points → verify the change is saved
  • Delete a penalty → verify it's removed
  • taskmate.apply_penalty service callable from HA developer tools
  • All 120 existing tests pass

claude added 2 commits March 24, 2026 18:56
Parents can define named penalties (e.g. "Not going to bed = 10 points")
and apply them to a child with a single tap.

Backend:
- New Penalty dataclass (name, points, description, icon, assigned_to)
- Full CRUD in storage: add/get/update/remove_penalty
- Coordinator: async_add_penalty, async_update_penalty, async_remove_penalty,
  async_apply_penalty (delegates to async_remove_points with a labelled reason)
- 4 new HA services: taskmate.add_penalty, taskmate.update_penalty,
  taskmate.remove_penalty, taskmate.apply_penalty
- Penalties exposed in sensor.taskmate_overview attributes

Frontend:
- New taskmate-penalties-card.js:
  - Child tabs to select who to penalise
  - Penalty tiles showing icon, name, and point cost
  - Tap Apply → instant deduction + flash animation + toast
  - Edit mode to add/edit/delete penalty definitions

https://claude.ai/code/session_01CkPmKWe5siThpfZ6GDpNQF
config_flow.py called async_delete_chore() which doesn't exist;
the correct method name is async_remove_chore().

https://claude.ai/code/session_01CkPmKWe5siThpfZ6GDpNQF
@tempus2016 tempus2016 merged commit 4e52c1b into main Mar 24, 2026
4 checks passed
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.

2 participants