feat(domain): allocation rules become a dated series

Post.standingRule becomes Post.rules: RuleVersion[], resolved by ruleAt() as
the last version effective at or before a month. Per-month overrides still win
outright; a post with no applicable version allocates zero rather than
applying its earliest rule backwards.

allocationFor keeps its signature, so the fold, the views and the ODS export
are untouched. Settings gets a read-only rule summary for now; the history
editor follows.
This commit is contained in:
Lucas Winther
2026-09-02 02:15:34 +02:00
parent c74a66aea9
commit 68712e72a3
11 changed files with 252 additions and 151 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ import type { Dataset } from "../domain/types.ts";
function populated(): Dataset {
const data = createSeedDataset("2026-01");
data.months[0]!.income = { amount: 20000, currency: "DKK" };
data.posts[1]!.standingRule = { kind: "percentOfIncome", percent: 25 };
data.posts[1]!.rules = [{ from: "2026-01", rule: { kind: "percentOfIncome", percent: 25 } }];
data.purchases.push({
id: "p1",
date: "2026-01-15",