Zero Amount header at the top of budget and month pages #8

Merged
claude-code merged 3 commits from feat/7-zero-amount into main 2026-04-17 12:08:49 -06:00
Collaborator

Closes #7 (will be manually closed on merge).

Summary

Adds a prominent "Zero Amount" header at the top of / and every /month/YYYY-MM page.

  • / shows one big number: sum(income.amount) - sum(non-income.amount)
  • /month/YYYY-MM shows Planned and Applied side by side, each computed the same way over the month's entries
  • Colour coding: green at $0.00, amber when positive (unassigned money), red when negative (over-budget)
  • Primary Debt Target is excluded from the math since it is a pointer, not a totalable section
  • Every mutation route (add / delete on the budget, add / delete / update on a month) OOB-swaps the widget so it stays in sync without a full reload
  • Uses the same hx-swap-oob pattern the debt target card already uses; an _append_oob helper replaces the ad-hoc string concatenation

Test plan

  • uv run pytest passes (54/54, +13 new)
  • Live smoke on a throwaway DB (/tmp/qm-zero-smoke.db):
    • Empty budget renders tone-zero, $0.00
    • Adding income flips to tone-positive, $2500.00
    • Adding rent keeps positive, $1300.00
    • Adding food over income flips to tone-negative, $-200.00
    • Month page renders the paired widget with Planned and Applied
  • Every test run includes OOB id="zero-widget" + hx-swap-oob="outerHTML" in mutation responses

Out of scope

  • Configurable currency or per-section weighting
  • Historical chart of zero over time
Closes #7 (will be manually closed on merge). ## Summary Adds a prominent "Zero Amount" header at the top of `/` and every `/month/YYYY-MM` page. * `/` shows one big number: `sum(income.amount) - sum(non-income.amount)` * `/month/YYYY-MM` shows Planned and Applied side by side, each computed the same way over the month's entries * Colour coding: green at `$0.00`, amber when positive (unassigned money), red when negative (over-budget) * Primary Debt Target is excluded from the math since it is a pointer, not a totalable section * Every mutation route (add / delete on the budget, add / delete / update on a month) OOB-swaps the widget so it stays in sync without a full reload * Uses the same `hx-swap-oob` pattern the debt target card already uses; an `_append_oob` helper replaces the ad-hoc string concatenation ## Test plan * [x] `uv run pytest` passes (54/54, +13 new) * [x] Live smoke on a throwaway DB (`/tmp/qm-zero-smoke.db`): * [x] Empty budget renders tone-zero, $0.00 * [x] Adding income flips to tone-positive, $2500.00 * [x] Adding rent keeps positive, $1300.00 * [x] Adding food over income flips to tone-negative, $-200.00 * [x] Month page renders the paired widget with Planned and Applied * [x] Every test run includes OOB `id="zero-widget"` + `hx-swap-oob="outerHTML"` in mutation responses ## Out of scope * Configurable currency or per-section weighting * Historical chart of zero over time
claude-code added 3 commits 2026-04-17 12:07:03 -06:00
budget_zero sums income minus every non-income section on the budget
config. month_zero returns both Planned and Applied versions over a
month's entries. zero_tone classifies a value as zero / positive /
negative so templates can pick a colour.

Refs #7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Single large number on /, Planned + Applied pair on /month/YYYY-MM,
both colour-coded (green at zero, amber positive, red negative).
Every mutation route (add, delete, month entry update) appends the
zero widget to its response with hx-swap-oob so totals stay in sync
without a full page reload. An _append_oob helper replaces the ad-hoc
string concatenation the target card was already using.

Refs #7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Service tests hit empty, positive, negative, and exactly-zero cases,
verify debt_target is excluded from the calculation, and confirm
month_zero responds to applied updates. Route tests assert the zero
widget appears OOB on every mutation with the expected tone class.

Refs #7

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
claude-code merged commit 85efed8f2c into main 2026-04-17 12:08:49 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/quartermaster#8
No description provided.