Wire defaultClaimAmount to mobile and bulk-update allowances on config change#6
Wire defaultClaimAmount to mobile and bulk-update allowances on config change#6darthnithin wants to merge 5 commits intomainfrom
Conversation
Active codes with expiresAt < now are excluded from all claim count and sum queries using or(ne(status,'active'), gte(expiresAt, now)). This fixes Pool Available, Allocated, Utilization %, Claims This Week, All-time Claims, and Avg Pts/Requester being inflated by expired codes. Also removes the Expired status bucket from the Claims This Week breakdown UI since that status is never written to the DB. https://claude.ai/code/session_017in4tv2Nd1kg39cy5qrWV7
Issue 3 (option A): Pool history bars now show real redeemed amounts derived from claim codes grouped by weeklyPoolId, rather than the always- zero stored values in weeklyPools.totalAmount / allocatedAmount. The estimatedWeeklyTotal (current active donors) is used as a consistent capacity baseline across all historical weeks. Issue 4 (option C): Rename 'Total Pool' to 'Live Capacity' and change '(estimated)' / '(est)' annotations to '(current donors)' to make it clear the figure reflects today's active donor set, not a week-start snapshot. https://claude.ai/code/session_017in4tv2Nd1kg39cy5qrWV7
Apply the same read-time expiry inference used by the mobile history endpoint: if status='active' and expiresAt < now, return 'expired' instead of the raw DB value. The DB intentionally never writes 'expired' since expiresAt is the ground truth; the admin stats endpoint just wasn't applying the conversion. https://claude.ai/code/session_017in4tv2Nd1kg39cy5qrWV7
…g change - Admin config save now bulk-updates all existing userAllowances for the current week when defaultWeeklyAllowance changes, adjusting weeklyLimit and remaining (usedAmount preserved). Returns allowancesUpdated count. - Requester allowance endpoint always fetches config and returns defaultClaimAmount alongside allowance data. - Mobile requester screen replaces hardcoded DEFAULT_CLAIM_AMOUNT=10 with state driven from the API, so changing the config takes effect immediately. - lib/api.ts: typed getRequesterAllowance return as RequesterAllowance. https://claude.ai/code/session_017in4tv2Nd1kg39cy5qrWV7
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@claude how do I even test this? |
|
Claude finished @darthnithin's task in 1m 20s —— View job Testing Instructions
What This PR DoesThis PR implements two key features:
Testing GuidePart 1: Test Mobile App Receives
|
…llow admin access to user APIs - Remove stored remainingAmount from userAllowances; derive it as max(0, weeklyLimit - usedAmount) at read time everywhere so allowance changes are always accurate without extra writes - Switch requesters/allowance and claims/generate pool lookup from exact weekStart match to lte/gte range query, matching the admin dashboard approach so all endpoints always find the same pool record - Add resolveRequestIdentity() to admin-auth that falls back to the admin session cookie when no Bearer token is present, allowing admin to call /api/requesters/allowance and /api/users/* without 401 - Support ?userId= override in /api/requesters/allowance when called with admin session, skipping user-sync and querying any user directly - Fix /api/users/me to look up the authenticated user instead of a hardcoded example email Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
not relevant anymore |
No description provided.