From 405cf0bf2d1ffab3ced485d8c4317fbf137a0d35 Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Fri, 4 Sep 2026 07:58:09 +0200 Subject: [PATCH] docs+chore: everyNMonths is n-generic too; stop the demo double-charging Rent PRODUCT.md described recurring costs as repeating "monthly, every N days, or every N weeks", understating everyNMonths, which supports an interval like the other two kinds. demo-data.ts gave "Rent" both an ordinary monthly purchase and a never-confirmed recurring cost from 2026-06 onward, so the demo's Rent Projected read as double-charged for June through September. The ordinary purchase now stops once the recurring cost exists. --- docs/PRODUCT.md | 4 ++-- scripts/demo-data.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/PRODUCT.md b/docs/PRODUCT.md index 766ef69..cb93375 100755 --- a/docs/PRODUCT.md +++ b/docs/PRODUCT.md @@ -67,8 +67,8 @@ Confirmed and in place: browser. - Offline-capable installable PWA. Currently deploys as one static artifact to both GitHub Pages (under a subpath) and a self-hosted Docker image. -- Recurring costs — a bill that repeats monthly, every N days, or every N - weeks on a weekday, split across posts like any purchase. Each due date is a +- Recurring costs — a bill that repeats every N months, every N days, or + every N weeks on a weekday, split across posts like any purchase. Each due date is a projected occurrence the owner confirms into a real purchase; the month view shows what is still expected alongside a second, projected balance per post, so a known bill is visible before it is paid without touching the reconciled diff --git a/scripts/demo-data.ts b/scripts/demo-data.ts index 46bc1bb..1792d4d 100755 --- a/scripts/demo-data.ts +++ b/scripts/demo-data.ts @@ -104,7 +104,12 @@ const buy = (date: string, description: string, amount: number, currency: "DKK" for (let m = 1; m <= 9; m++) { const mm = String(m).padStart(2, "0"); - buy(`2026-${mm}-01`, "Rent", 8200, "DKK", rent.id); + // The "Rent" recurring cost above starts 2026-06 and is left unconfirmed, + // so it already projects an expected charge for June onward. An ordinary + // Rent purchase in those same months would double-charge the post in the + // screenshots — one from `charges`, one from `expected` — so this ordinary + // purchase only covers the months before the recurring cost exists. + if (m < 6) buy(`2026-${mm}-01`, "Rent", 8200, "DKK", rent.id); buy(`2026-${mm}-04`, "Groceries", 1180 + m * 37, "DKK", food.id); buy(`2026-${mm}-18`, "Groceries", 1420 - m * 12, "DKK", food.id); buy(`2026-${mm}-06`, "Commuter pass", 1100, "DKK", transport.id);