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.
This commit is contained in:
Lucas Winther
2026-09-04 07:58:09 +02:00
parent 08abe64b55
commit 405cf0bf2d
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -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
+6 -1
View File
@@ -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);