Admin: payment-routing / leak map for the org
New chain.getOrgRouting(rootId, ownerIds) simulates the contract's _payUpline routing for every member below the org root on their NEXT upgrade, classifying where the POL lands: your positions, a teammate in-org (healthy), an outsider above the org (true LEAK), or fees. Surfaced on /api/admin/income and rendered as a panel in "My Positions — Income": 4-stat summary + expandable list of payments escaping the org. Distinguishes real leaks (money leaving the team) from teammates earning — which the old upgrade-needs alert conflated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -457,7 +457,8 @@ async function handleApi(req,res,pathname){
|
||||
}
|
||||
rows.sort((a,b)=>(b.ts||0)-(a.ts||0));
|
||||
let upgradeNeeds=[];try{upgradeNeeds=chain.getOwnerUpgradeNeeds(ids).needs;}catch(e){}
|
||||
return json(res,200,{ids,perId,rows:rows.slice(0,500),grandEarnedPol:+grand.toFixed(2),grandListedPol:+grandListed.toFixed(2),upgradeNeeds});
|
||||
let routing=null;try{routing=chain.getOrgRouting(Number(getConfig().orgRootId)||21,ids);}catch(e){}
|
||||
return json(res,200,{ids,perId,rows:rows.slice(0,500),grandEarnedPol:+grand.toFixed(2),grandListedPol:+grandListed.toFixed(2),upgradeNeeds,routing});
|
||||
}catch(e){return json(res,502,{error:e.message||'Lookup failed'})}
|
||||
}
|
||||
if(req.method==='GET'&&pathname==='/api/admin/member-lookup'){
|
||||
|
||||
Reference in New Issue
Block a user