[insight] Plans and statistics: category plans, categories of your own, spending, the month in numbers; v0.5.0 #7

Manually merged
mnovak merged 1 commits from feature/plans-stats into main 2026-11-06 13:03:13 +01:00
Owner

Phase 1 of the plan for Categories, Statistics, Rewards and phone parity: the pure core for the Categories and Statistics screens. Design: docs/04_plans_stats.md.

What

  • category.planned { category, amount, from }: a monthly plan for a spending category from the month of from (the 1st) on, until a later one replaces it; zero removes it. Not for income, transfers or uncategorised; 0 to 100 000 000 CZK. State::plan_for.
  • category.created { category, label }: a category of your own. State::category_label, State::categories().
  • fiscus-insight::spending: one definition of spending (money out of your own payments, transfers excluded, uncategorised counted), money in, and permille by the largest remainder so shares add up to exactly 1000.
  • fiscus-insight::plan: month_plan (per category planned, spent, left, bar share, pace: Under / OnPace / Ahead >110 % / Over) and suggest (average of the last three complete months since the first payment, rounded up to 100 CZK).
  • fiscus-insight::stats: month_stats (top 7 slices + the rest, in, out, net, six months, same day last month, top 5 merchants by key, subscriptions' share).
  • Version 0.5.0.

Self-review

  • Money: haléře throughout; every sum checked (Haler::sum, checked_add), None on overflow (tested with two near-i64::MIN payments). Ratios in i128, shares as whole thousandths. No float.
  • Purity: today and the month are parameters; no clock.
  • Hostile input: every refusal of the two events is tested and changes nothing (unknown or non-plannable category, not an id, negative, over the limit, not the 1st, duplicate category, empty or padded or long or control-character label).
  • Sharing boundary: unchanged. share.rs and the app's outgoing build only payment.shared, so plans and custom categories never reach a shared budget. A member posting category.planned into a group log only affects that group's own state, which no view reads plans from.
  • Only my payments: plans and statistics read the personal state; other members' payments live in the shared budgets' logs.
  • Tests: 11 new (plans 5, stats 5, permille 1); 115 in the workspace, all green. Three deliberate mistakes (transfers counted as spending, a plan counted before its month, no largest remainder) each fail them.
  • Clippy: no new warnings (the three remaining are older: merchant.rs, money.rs, subscriptions.rs).
  • Open: renaming a category of your own is not built yet; the app side (Categories and Statistics screens) is the next Fiscus PR.
Phase 1 of the plan for Categories, Statistics, Rewards and phone parity: the pure core for the Categories and Statistics screens. Design: `docs/04_plans_stats.md`. ## What - `category.planned { category, amount, from }`: a monthly plan for a spending category from the month of `from` (the 1st) on, until a later one replaces it; zero removes it. Not for income, transfers or uncategorised; 0 to 100 000 000 CZK. `State::plan_for`. - `category.created { category, label }`: a category of your own. `State::category_label`, `State::categories()`. - `fiscus-insight::spending`: one definition of spending (money out of your own payments, transfers excluded, uncategorised counted), money in, and `permille` by the largest remainder so shares add up to exactly 1000. - `fiscus-insight::plan`: `month_plan` (per category planned, spent, left, bar share, pace: Under / OnPace / Ahead >110 % / Over) and `suggest` (average of the last three complete months since the first payment, rounded up to 100 CZK). - `fiscus-insight::stats`: `month_stats` (top 7 slices + the rest, in, out, net, six months, same day last month, top 5 merchants by key, subscriptions' share). - Version 0.5.0. ## Self-review - **Money**: haléře throughout; every sum checked (`Haler::sum`, `checked_add`), `None` on overflow (tested with two near-`i64::MIN` payments). Ratios in i128, shares as whole thousandths. No float. - **Purity**: `today` and the month are parameters; no clock. - **Hostile input**: every refusal of the two events is tested and changes nothing (unknown or non-plannable category, not an id, negative, over the limit, not the 1st, duplicate category, empty or padded or long or control-character label). - **Sharing boundary**: unchanged. `share.rs` and the app's `outgoing` build only `payment.shared`, so plans and custom categories never reach a shared budget. A member posting `category.planned` into a group log only affects that group's own state, which no view reads plans from. - **Only my payments**: plans and statistics read the personal state; other members' payments live in the shared budgets' logs. - **Tests**: 11 new (plans 5, stats 5, permille 1); 115 in the workspace, all green. Three deliberate mistakes (transfers counted as spending, a plan counted before its month, no largest remainder) each fail them. - **Clippy**: no new warnings (the three remaining are older: merchant.rs, money.rs, subscriptions.rs). - **Open**: renaming a category of your own is not built yet; the app side (Categories and Statistics screens) is the next Fiscus PR.
mnovak added 1 commit 2026-11-06 13:02:59 +01:00
- category.planned (carries forward, zero removes it; spending categories only) and category.created
- fiscus-insight: spending (outflows, inflow, largest-remainder thousandths that add up to 1000), plan (the
  month against its plan with the pace, a suggested plan from the last three months), stats (pie slices, in,
  out, net, six months, same day last month, top merchants, subscriptions' share)
- docs/04_plans_stats.md; 11 new tests
mnovak manually merged commit 2e8eee6007 into main 2026-11-06 13:03:13 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mnovak/FiscusPublic#7