fix: use real calendar math for estimateMonths and estimateYear1Cum

- estimateMonths: cycles × daysPer / 30.4 instead of simplified .months
- estimateYear1Cum: track days_left (365) instead of aggregated months
- removes dead variable cycInMonth
- Gift L3 year 1 commissions: ~,085 → ~,113 (honest calendar-based)
- Time to 3×L7 for Gift L3: 12.5mo → 15.0mo (realistic)
This commit is contained in:
Marty Bostick
2026-07-11 10:35:37 +00:00
parent 9fca0fee55
commit 7be4867604
+8 -10
View File
@@ -725,27 +725,25 @@ function getPhaseSequence(effectiveStart) {
} }
function estimateMonths(phases) { function estimateMonths(phases) {
let total = 0; let totalDays = 0;
for (const k of phases) { for (const k of phases) {
if (k === '3xL7') break; if (k === '3xL7') break;
total += HYBRIDS[k].months; totalDays += HYBRIDS[k].cycles * HYBRIDS[k].daysPer;
} }
return Math.round(total * 10) / 10; return Math.round(totalDays / 30.4 * 10) / 10;
} }
function estimateYear1Cum(phases, commPct, giftLevel) { function estimateYear1Cum(phases, commPct, giftLevel) {
let cum = 0; let cum = 0;
let months = 0; let daysLeft = 365;
for (const k of phases) { for (const k of phases) {
if (k === '3xL7') break; if (k === '3xL7') break;
const p = HYBRIDS[k]; const p = HYBRIDS[k];
const yourCut = p.payout * (commPct / 100); const yourCut = p.payout * (commPct / 100);
const cycInMonth = p.months / (p.daysPer / 30.4); const cyclesFit = Math.min(p.cycles, Math.floor(daysLeft / p.daysPer));
const cyclesInYear1 = Math.min(p.cycles, Math.max(0, (12 - months) / (p.months / p.cycles))); cum += cyclesFit * yourCut;
const actual = Math.floor(cyclesInYear1); daysLeft -= cyclesFit * p.daysPer;
for (let i = 0; i < actual; i++) cum += yourCut; if (daysLeft <= 0) break;
months += p.months;
if (months >= 12) break;
} }
return Math.round(cum); return Math.round(cum);
} }