Show downline count and downline POL on matrix positions
Each tree node now carries a rollup of its subtree — members below and their combined earned POL — shown as a footer line on pyramid cards and inline in the list view. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -387,6 +387,12 @@ function getMatrixTree() {
|
|||||||
};
|
};
|
||||||
n.left = node(m.l, depth + 1);
|
n.left = node(m.l, depth + 1);
|
||||||
n.right = node(m.r, depth + 1);
|
n.right = node(m.r, depth + 1);
|
||||||
|
// downline rollup: members below this position and the POL they earned
|
||||||
|
n.downCount = 0; n.downPol = 0;
|
||||||
|
for (const c of [n.left, n.right]) if (c && !c.missing) {
|
||||||
|
n.downCount += 1 + (c.downCount || 0);
|
||||||
|
n.downPol = +(n.downPol + (c.earnedPol || 0) + (c.downPol || 0)).toFixed(2);
|
||||||
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
const root = node(1, 0);
|
const root = node(1, 0);
|
||||||
|
|||||||
+3
-2
@@ -77,7 +77,8 @@ function mtBadge(n){return n.tier===2?'<span class="mt-badge mt-prem">P</span>':
|
|||||||
const mtFmt=n=>Number(n||0).toLocaleString(undefined,{maximumFractionDigits:0});
|
const mtFmt=n=>Number(n||0).toLocaleString(undefined,{maximumFractionDigits:0});
|
||||||
function mtCard(n){
|
function mtCard(n){
|
||||||
if(!n)return '<div class="mtp-card mtp-open">open<br>slot</div>';
|
if(!n)return '<div class="mtp-card mtp-open">open<br>slot</div>';
|
||||||
return `<button class="mtp-card${n.id===matrixUI.rootId?' mtp-focus':''}" data-mid="${n.id}">${mtBadge(n)} <span class="mt-id">#${n.id}</span><span class="mtp-lvl">${esc(n.levelName)}</span><span class="mtp-sub">${n.directCount}/2 · ${mtFmt(n.earnedPol)} POL</span></button>`;
|
const down=n.downCount?`<span class="mtp-down">⬇ ${n.downCount} below · ${mtFmt(n.downPol)} POL</span>`:'<span class="mtp-down mtp-down-none">no downline yet</span>';
|
||||||
|
return `<button class="mtp-card${n.id===matrixUI.rootId?' mtp-focus':''}" data-mid="${n.id}">${mtBadge(n)} <span class="mt-id">#${n.id}</span><span class="mtp-lvl">${esc(n.levelName)}</span><span class="mtp-sub">${n.directCount}/2 · ${mtFmt(n.earnedPol)} POL</span>${down}</button>`;
|
||||||
}
|
}
|
||||||
function renderPyramid(){
|
function renderPyramid(){
|
||||||
const out=document.getElementById('matrixTree'),nav=document.getElementById('matrixNav');
|
const out=document.getElementById('matrixTree'),nav=document.getElementById('matrixNav');
|
||||||
@@ -107,7 +108,7 @@ function renderList(){
|
|||||||
const ch=[n.left,n.right].filter(Boolean);
|
const ch=[n.left,n.right].filter(Boolean);
|
||||||
const kids=ch.length?`<ul class="mt-kids">${ch.map(c=>node(c,depth+1)).join('')}</ul>`:'';
|
const kids=ch.length?`<ul class="mt-kids">${ch.map(c=>node(c,depth+1)).join('')}</ul>`:'';
|
||||||
const open=depth<4?' open':'';
|
const open=depth<4?' open':'';
|
||||||
const label=`${mtBadge(n)} <span class="mt-id">#${n.id}</span> <span class="mt-meta">${esc(n.levelName)} · ${n.directCount}/2 directs · ${mtFmt(n.earnedPol)} POL earned${n.referrerId?` · ref #${n.referrerId}`:''}</span>`;
|
const label=`${mtBadge(n)} <span class="mt-id">#${n.id}</span> <span class="mt-meta">${esc(n.levelName)} · ${n.directCount}/2 directs · ${mtFmt(n.earnedPol)} POL earned${n.downCount?` · ⬇ ${n.downCount} below (${mtFmt(n.downPol)} POL)`:''}${n.referrerId?` · ref #${n.referrerId}`:''}</span>`;
|
||||||
return ch.length?`<li class="mt-node"><details${open}><summary>${label}</summary>${kids}</details></li>`:`<li class="mt-node mt-leaf">${label}</li>`;
|
return ch.length?`<li class="mt-node"><details${open}><summary>${label}</summary>${kids}</details></li>`:`<li class="mt-node mt-leaf">${label}</li>`;
|
||||||
};
|
};
|
||||||
const unplaced=d.unplaced?`<p class="micro" style="color:var(--danger)">Not reachable from root: ${d.unplaced.map(i=>'#'+i).join(', ')}</p>`:'';
|
const unplaced=d.unplaced?`<p class="micro" style="color:var(--danger)">Not reachable from root: ${d.unplaced.map(i=>'#'+i).join(', ')}</p>`:'';
|
||||||
|
|||||||
+101
-98
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user