Tell members when the free game allowance is used up (Marty 2026-11-03): the polgrant answer carries waiting (every game's progress POL held for the account), the member view carries caps.lifetime.done/waiting, lastCapHit records lifetime. The Overview card says "You have used your free 2 POL in the games", what the Pass gives and the POL held, with a Get the Game Pass button, and shows to anyone whose allowance is used (not only after a recent cap hit). Chatbot knows both messages. Short banner links fall back to this page's origin (http locally) when no share domain is set; my.js and promo.js ?v=20261103gp. QA member 0 bugs; gamepass the 7 known date-pinned failures, nothing new

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-03 13:15:29 -06:00
parent 0865a4967b
commit fb2383ffae
5 changed files with 27 additions and 9 deletions
+7 -2
View File
@@ -285,6 +285,8 @@ function capsFor(email, now, game) {
const out = { daily: lim.daily, total: lim.total, used, day, enforced: enforcedOn(c, day), pass };
out.lifetime = { cap: c.freeLifetime, used: r6(M && M.freeTotal != null ? M.freeTotal : (M ? Object.values(M.days).reduce((n, d) => n + ((d.tier && d.tier.free && d.tier.free.allowed) || 0), 0) : 0)) }; // the free allowance, what has been used of it
if (game && M) out.pending = r6((M.deferred[game] || []).reduce((n, x) => n + x.left, 0));
out.lifetime.done = !pass && out.lifetime.used + 1e-9 >= out.lifetime.cap; // the free allowance is used up (only a pass pays from here)
out.lifetime.waiting = M ? r6(Object.values(M.deferred).reduce((n, q) => n + (q || []).reduce((m, x) => m + (x.left || 0), 0), 0)) : 0;
return out;
}
@@ -332,10 +334,13 @@ function grant(o) {
if (!pass) M.freeTotal = r6((M.freeTotal || 0) + allowed + carried); // counts toward the free allowance only while no pass is held
// tournament activity: one point per reported grant (progress and daily weigh the same)
if (pol > 0) { const wk = weekKey(t); M.weeks[wk] = M.weeks[wk] || {}; M.weeks[wk][game] = (M.weeks[wk][game] || 0) + 1; }
if (capHit) { const p = passes.get(e) || { until: 0, bought: [] }; passes.set(e, Object.assign({}, p, { lastCapHit: { ts: t, day, game, kind: capHit, pass } })); }
if (capHit) { const p = passes.get(e) || { until: 0, bought: [] }; passes.set(e, Object.assign({}, p, { lastCapHit: { ts: t, day, game, kind: capHit, pass, lifetime: !!lifetimeHit } })); }
const out = { allowed: r6(carried + allowed), deferred, pass, day, carried, capHit, enforced, kind, pol, email: e, ts: t, own: allowed, lifetimeHit };
L.refs[key] = out; touch();
return { allowed: out.allowed, deferred, pass, day, carried, capHit, enforced, repeat: false, lifetimeHit, freeUsed: r6(M.freeTotal || 0), freeLifetime: c.freeLifetime };
// waiting = every game's progress POL deferred for this account (it pays once a pass is active, inside the pass cap); the games
// show it in the allowance note (Marty 2026-11-03: tell members at the cap to get the Pass, and what is waiting for them)
const waiting = r6(Object.values(M.deferred).reduce((n, q) => n + (q || []).reduce((m, x) => m + (x.left || 0), 0), 0));
return { allowed: out.allowed, deferred, pass, day, carried, capHit, enforced, repeat: false, lifetimeHit, freeUsed: r6(M.freeTotal || 0), freeLifetime: c.freeLifetime, waiting };
}
// POST /api/partner/polgrant/void: the game decided not to pay after all. Reverses this ref's own share (the carry it triggered