Major rework: multi-user accounts (register/login, per-user data isolation), new layout with sidebar/dashboard/profile menu, matrix phase view with collapsible category columns, life timeline with ages per phase, live budget capping, collapsible transitions, mobile support
Deploy App / deploy (push) Successful in 1m47s
Deploy App / deploy (push) Successful in 1m47s
This commit is contained in:
+23
-2
@@ -59,6 +59,16 @@ export interface PhaseComputed {
|
||||
endWealthReal: number;
|
||||
yearlyNominal: number[]; // Laenge durationYears, Werte am Ende von Jahr 1..durationYears
|
||||
yearlyReal: number[];
|
||||
// Alter der Personen zu Beginn und am Ende dieser Phase (Grundprofil-Alter +
|
||||
// kumulierte Dauer der Vorphasen).
|
||||
ages: PersonAgeRange[];
|
||||
}
|
||||
|
||||
export interface PersonAgeRange {
|
||||
personId: string;
|
||||
role: string; // PERSON_A | PERSON_B
|
||||
startAge: number;
|
||||
endAge: number;
|
||||
}
|
||||
|
||||
export interface PlanComputed {
|
||||
@@ -136,8 +146,16 @@ function computeRetirement(
|
||||
function computePhase(
|
||||
phase: PhaseInput,
|
||||
household: HouseholdInput,
|
||||
cumulativeInflationStart: number
|
||||
cumulativeInflationStart: number,
|
||||
yearsBeforePhase: number
|
||||
): PhaseComputed {
|
||||
const ages: PersonAgeRange[] = household.persons.map((p) => ({
|
||||
personId: p.id,
|
||||
role: p.role,
|
||||
startAge: p.age + yearsBeforePhase,
|
||||
endAge: p.age + yearsBeforePhase + phase.durationYears,
|
||||
}));
|
||||
|
||||
const incomeFromEntries = phase.incomeEntries.reduce((sum, e) => sum + e.amount, 0);
|
||||
const expenseTotal = phase.expenseEntries.reduce((sum, e) => sum + e.amount, 0);
|
||||
const retirement = computeRetirement(household, phase);
|
||||
@@ -241,6 +259,7 @@ function computePhase(
|
||||
endWealthReal: endWealthNominal / cumulativeInflationEnd,
|
||||
yearlyNominal,
|
||||
yearlyReal,
|
||||
ages,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -248,10 +267,12 @@ export function computePlan(plan: PlanInput, household: HouseholdInput): PlanCom
|
||||
const orderedPhases = [...plan.phases].sort((a, b) => a.sequenceNumber - b.sequenceNumber);
|
||||
|
||||
let cumulativeInflation = 1;
|
||||
let yearsBefore = 0;
|
||||
const phases: PhaseComputed[] = [];
|
||||
for (const phase of orderedPhases) {
|
||||
const computed = computePhase(phase, household, cumulativeInflation);
|
||||
const computed = computePhase(phase, household, cumulativeInflation, yearsBefore);
|
||||
cumulativeInflation = computed.cumulativeInflationEnd;
|
||||
yearsBefore += phase.durationYears;
|
||||
phases.push(computed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user