Budget history by month, shared tab navigation, file imported statements into Statements/year/month and stop re-reading them
build-container / build (push) Successful in 40s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-21 15:52:05 -04:00
1 parent d7808a3925
commit 20317b14c9
7 files changed
+147 -12

No files matched your search

+14
View File
@@ -61,3 +61,17 @@ def compute(D, month):
ready=round(inc_cum - bud_cum, 2), ready_before=round(inc_prev - bud_prev, 2),
expected=exp_default, expected_saved=month in expected, budgeted_month=round(sum(r["budgeted"] for r in rows), 2),
has_budget=bool(budget_months), months=months, prev_has=any(v for (c, m), v in bud.items() if m == ym_add(month, -1)))
def history(D):
"""Every envelope's budgeted / spent / left-over for each month since the first budget month (left-over rolls forward)."""
first = min((m for m, env, _ in D.get("budget", [])), default=None)
if not first: return dict(months=[], envelopes=[])
months, m = [], first
while m <= this_month(): months.append(m); m = ym_add(m, 1)
env = {}
for m in months:
for r in compute(D, m)["envelopes"]:
env.setdefault(r["envelope"], {})[m] = [r["budgeted"], r["spent"], r["available"]]
rows = [dict(envelope=e, cells=[v.get(m, [0, 0, 0]) for m in months]) for e, v in env.items()
if any(c[0] or c[1] or c[2] for c in v.values())]
return dict(months=months, envelopes=rows)