Fix: Cash-Vorbelegung im Ist-Wizard zeigte den Phasen-Endwert
Deploy App / deploy (push) Successful in 1m4s

Der Wizard las cashBridge.cashEnd -- also den Stand am Phasenende statt
am gewaehlten Stichtag. In einer Phase 2026-2036 erschien fuer 2031 der
Wert von 2036.

Ursache: computePlan wies den Cash-Bestand nur je PHASE aus. YearPoint
traegt neu ein Feld `cash` (Stand am Jahresende), analog zu
wealthNominal; der Wizard liest daraus.

Die Vorbelegung der Elemente war nie betroffen -- die stammte schon
immer aus dem Jahresverlauf.

Zwei Regressionstests (208 -> 210). Spezifikation 0.22.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-20 20:53:59 +02:00
parent e117e5a4e5
commit 44c6c81f5d
4 changed files with 72 additions and 7 deletions
+7
View File
@@ -198,6 +198,11 @@ export interface YearPoint {
// Vermögensverlauf über ALLE Jahre statt nur über die Phasengrenzen.
wealthNominal: number;
wealthReal: number;
// Cash-Bestand am Jahresende. Die Brücken führen Cash nur je PHASE (Anfang/Ende) -- für
// eine Aussage zu einem einzelnen Jahr (Vorbelegung der effektiven Werte, Kap. 3.9.2)
// reicht das nicht: In einer Phase über zehn Jahre ist der Phasen-Endwert etwas ganz
// anderes als der Stand in der Mitte.
cash: number;
}
export interface PlanComputed {
@@ -751,6 +756,7 @@ export function computePlan(plan: PlanInput, sample?: PlanSample, options?: Comp
expenseReal: Math.round(expenseReal),
wealthNominal: 0,
wealthReal: 0,
cash: 0,
};
yearly.push(yearPoint);
@@ -907,6 +913,7 @@ export function computePlan(plan: PlanInput, sample?: PlanSample, options?: Comp
for (const d of debts) total += -d.owed;
yearPoint.wealthNominal = Math.round(total);
yearPoint.wealthReal = Math.round(total / (cumInfl[yearsBefore + t] || 1));
yearPoint.cash = Math.round(cash);
if (ruinAge === null && total < 0) ruinAge = personA.age + yearsBefore + t;
}