Missions reset with the Central day: a find blocks a mission only for that day (member id or wallet); tag reads Done today
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
+11
-5
@@ -38,11 +38,17 @@ function paidToday(day) {
|
||||
return store.read('payouts', []).filter(p => p.day === day && p.status !== 'failed' && !p.prize).reduce((n, p) => n + p.pol, 0);
|
||||
}
|
||||
|
||||
// has this member completed this mission already?
|
||||
// by member id, and also by wallet: two accounts sharing a wallet get one drip per mission between them
|
||||
// has this member completed this mission TODAY (Central)? Missions reset at midnight Central with the codes and
|
||||
// the pool (Marty, 2026-09-20: yesterday's finds showed as done today). Checked by member id, and also by wallet:
|
||||
// two accounts sharing a wallet get one drip per mission per day between them.
|
||||
function completed(memberId, missionId, wallet) {
|
||||
const w = wallet ? String(wallet).toLowerCase() : null;
|
||||
return store.read('payouts', []).some(p => p.missionId === missionId && p.status !== 'failed' && (p.memberId === Number(memberId) || (w && p.wallet && String(p.wallet).toLowerCase() === w)));
|
||||
const w = wallet ? String(wallet).toLowerCase() : null; const day = ctDay();
|
||||
return store.read('payouts', []).some(p => p.missionId === missionId && p.day === day && p.status !== 'failed' && !p.prize && (p.memberId === Number(memberId) || (w && p.wallet && String(p.wallet).toLowerCase() === w)));
|
||||
}
|
||||
// the mission ids this member (or wallet) has done today
|
||||
function doneToday(memberId, wallet) {
|
||||
const w = wallet ? String(wallet).toLowerCase() : null; const day = ctDay();
|
||||
return new Set(store.read('payouts', []).filter(p => p.day === day && p.status !== 'failed' && !p.prize && (p.memberId === Number(memberId) || (w && p.wallet && String(p.wallet).toLowerCase() === w))).map(p => p.missionId));
|
||||
}
|
||||
|
||||
// record a completion; decide paid-today vs queued
|
||||
@@ -96,4 +102,4 @@ function totals() {
|
||||
return { paid: paid.length, pol: Math.round(paid.reduce((n, p) => n + p.pol, 0) * 10000) / 10000, queued: all.filter(p => p.status === 'queued').length, today: paidToday(ctDay()), hunters: new Set(paid.map(p => p.memberId)).size };
|
||||
}
|
||||
|
||||
module.exports = { settings, setSettings, draw, grant, completed, payable, mark, ledger, mine, totals, paidToday, pool, nextResetAt, daily, findsToday };
|
||||
module.exports = { settings, setSettings, draw, grant, completed, doneToday, payable, mark, ledger, mine, totals, paidToday, pool, nextResetAt, daily, findsToday };
|
||||
|
||||
Reference in New Issue
Block a user