Fix SCENARIOS: compute dynamically from functions

This commit is contained in:
Marty Bostick
2026-07-11 10:23:54 +00:00
parent 5590c0e918
commit 9fca0fee55
+25 -13
View File
@@ -676,20 +676,32 @@ const LADDER_STEPS = [
const THREE_L7_YOUR_CUT = 972; // 10% of 9720
// ══════════════════════════════════════════════════════════════════════
// SCENARIO DATA (from skill + calculations)
// SCENARIO DATA — computed from functions for consistency with Overview tab
// ══════════════════════════════════════════════════════════════════════
const SCENARIOS = [
{ id: 'gift1', label: 'L1 Gift ($14)', yourCost: 14, time: 19, yr1: 430, totalEG: 3711, monthly: 1860 },
{ id: 'gift2', label: 'L1-L2 Gift ($98)', yourCost: 98, time: 16, yr1: 460, totalEG: 3700, monthly: 1860 },
{ id: 'gift3', label: 'L1-L3 Gift ($263)', yourCost: 263,time: 14, yr1: 415, totalEG: 3686, monthly: 1860 },
{ id: 'gift4', label: 'L1-L4 Gift ($593)', yourCost: 593,time: 11, yr1: 1373, totalEG: 3641, monthly: 1860 },
{ id: 'gift5', label: 'L1-L5 Gift ($1,253)', yourCost:1253,time: 7, yr1: 1680, totalEG: 3357, monthly: 1860 },
{ id: 'self1', label: 'Self L1 ($14)', yourCost: 14, time: 19, yr1: 430, totalEG: 3711, monthly: 1860 },
{ id: 'self2', label: 'Self L2 ($98)', yourCost: 0, time: 16, yr1: 550, totalEG: 3700, monthly: 1860 },
{ id: 'self3', label: 'Self L3 ($263)', yourCost: 0, time: 14, yr1: 530, totalEG: 3686, monthly: 1860 },
{ id: 'self4', label: 'Self L4 ($593)', yourCost: 0, time: 11, yr1: 1373, totalEG: 3641, monthly: 1860 },
{ id: 'self5', label: 'Self L5 ($1,253)', yourCost: 0, time: 7, yr1: 1680, totalEG: 3357, monthly: 1860 },
];
function buildSCENARIOS() {
const levels = [
{ giftLvl: 1, selfLvl: 0, id: 'gift1', label: 'L1 Gift ($14)', yourCost: 14 },
{ giftLvl: 0, selfLvl: 1, id: 'self1', label: 'Self L1 ($14)', yourCost: 0 },
{ giftLvl: 2, selfLvl: 0, id: 'gift2', label: 'L1-L2 Gift ($98)', yourCost: 98 },
{ giftLvl: 0, selfLvl: 2, id: 'self2', label: 'Self L2 ($98)', yourCost: 0 },
{ giftLvl: 3, selfLvl: 0, id: 'gift3', label: 'L1-L3 Gift ($263)', yourCost: 263},
{ giftLvl: 0, selfLvl: 3, id: 'self3', label: 'Self L3 ($263)', yourCost: 0 },
{ giftLvl: 4, selfLvl: 0, id: 'gift4', label: 'L1-L4 Gift ($593)', yourCost: 593},
{ giftLvl: 0, selfLvl: 4, id: 'self4', label: 'Self L4 ($593)', yourCost: 0 },
{ giftLvl: 5, selfLvl: 0, id: 'gift5', label: 'L1-L5 Gift ($1,253)', yourCost:1253},
{ giftLvl: 0, selfLvl: 5, id: 'self5', label: 'Self L5 ($1,253)', yourCost: 0 },
];
return levels.map(s => {
const eff = Math.max(s.giftLvl, s.selfLvl);
const phases = getPhaseSequence(eff);
const t = Math.round(estimateMonths(phases));
const y = estimateYear1Cum(phases, 10, s.giftLvl);
const eg = phases.filter(k => k !== '3xL7')
.reduce((sum, k) => sum + HYBRIDS[k].payout * 0.10 * HYBRIDS[k].cycles, 0);
return { ...s, time: t, yr1: Math.round(y), totalEG: Math.round(eg), monthly: 1860 };
});
}
const SCENARIOS = buildSCENARIOS();
// ══════════════════════════════════════════════════════════════════════
// HELPERS