Fix Phase-by-Phase Journey cumulative payout column
Bug: The 'Cumulative to You' column showed /usr/bin/bash.00 (no gift) or a frozen value (with gift) instead of the actual running total of referral earnings. Fix: - Separate ROI tracking (cumulative until gift cost is recouped) from cumulative payout display (always accumulates across all phases) - Use roiCum/roiRow for ROI tracking, cumRunning for display - 3× L7 Endgame uses 1 cycle (not 0) so its contribution is counted - Highlight phase where ROI is achieved (not the phase after it) L1 Only: 5.48, L2+L1: 3.04, L3+L1: 47.68, L4+L3: 39.28, L5+L4: 05.84, L6: ,527.92, L7: ,795.92, 3×L7: ,767.92
This commit is contained in:
+13
-5
@@ -1724,18 +1724,26 @@ ${numPeople > 0 ? `
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cumRunning = 0;
|
let cumRunning = 0;
|
||||||
|
let roiCum = 0;
|
||||||
let roiHit = false;
|
let roiHit = false;
|
||||||
|
let roiRow = ''; // phase key where ROI was achieved
|
||||||
let rows = '';
|
let rows = '';
|
||||||
for (const k of phases) {
|
for (const k of phases) {
|
||||||
const p = HYBRIDS[k];
|
const p = HYBRIDS[k];
|
||||||
const yourCut = p.payout * (commPct / 100);
|
const yourCut = p.payout * (commPct / 100);
|
||||||
const cyclesNum = p.cycles;
|
const cyclesNum = k === '3xL7' ? 1 : p.cycles;
|
||||||
|
// Track cumulative payout (always accumulates — this is the total to sponsor)
|
||||||
|
cumRunning += yourCut * cyclesNum;
|
||||||
|
|
||||||
|
// Track ROI separately (only when there's a gift cost)
|
||||||
if (!roiHit && giftCost > 0) {
|
if (!roiHit && giftCost > 0) {
|
||||||
for (let i = 0; i < cyclesNum; i++) cumRunning += yourCut;
|
roiCum += yourCut * cyclesNum;
|
||||||
if (cumRunning >= giftCost) roiHit = true;
|
if (roiCum >= giftCost) {
|
||||||
|
roiHit = true;
|
||||||
|
roiRow = k;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const isRoi = giftCost > 0 && !roiHit ? true : false;
|
const cls = k === '3xL7' ? 'endgame' : (k === roiRow ? 'highlight' : '');
|
||||||
const cls = k === '3xL7' ? 'endgame' : (isRoi && roiHit ? 'highlight' : '');
|
|
||||||
rows += `<tr class="${cls}">
|
rows += `<tr class="${cls}">
|
||||||
<td>${p.label}</td>
|
<td>${p.label}</td>
|
||||||
<td class="num">${k === '3xL7' ? 'every 19d' : `${cyclesNum}×`}</td>
|
<td class="num">${k === '3xL7' ? 'every 19d' : `${cyclesNum}×`}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user