Refuel income: a reported 0 credits (house-ad visit) stays 0, never falls back to the visit price

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-03 15:48:08 -05:00
parent 60f1148efa
commit 08e70d6a16
+2 -1
View File
@@ -51,7 +51,8 @@ function poolAdd(field, pol) { store.update('pool', {}, p => { p[field] = r4((p[
// ---- refuels: the income --------------------------------------------------------------------
async function refuel(me, info) {
const s = settings();
const credits = Math.max(0, Number(info.credits) || Number(s.creditsPerVisit) || 3);
// IAP reports 0 for a house-ad visit (nobody paid): keep it 0, never fall back to the visit price (2026-10-03)
const credits = Math.max(0, (info.credits != null && info.credits !== '' && isFinite(Number(info.credits))) ? Number(info.credits) : (Number(s.creditsPerVisit) || 3));
const usd = credits * Number(s.usdPerCredit);
const share = usd * Number(s.poolSharePct) / 100;
const rate = await usdPerPol();