chore: auto-commit uncommitted changes

This commit is contained in:
James 2026-02-21 00:01:21 -05:00
parent 6779363849
commit 03371ecd80
1 changed files with 8 additions and 4 deletions

View File

@ -475,10 +475,14 @@ app.get('/api/claude-usage', async (req, res) => {
lastSat.setDate(lastSat.getDate() - daysSinceSat); lastSat.setDate(lastSat.getDate() - daysSinceSat);
lastSat.setHours(14, 0, 0, 0); lastSat.setHours(14, 0, 0, 0);
if (et < lastSat) lastSat.setDate(lastSat.getDate() - 7); if (et < lastSat) lastSat.setDate(lastSat.getDate() - 7);
const weekMs = 7 * 24 * 60 * 60 * 1000; const weekMs = 7 * 24 * 60 * 60 * 1000;
const elapsed = et - lastSat; // Exclude Sat 7AM2PM (7h dead zone — Johan asleep, can't use Claude)
const timePct = Math.min(100, Math.max(0, (elapsed / weekMs) * 100)); // Effective usable week = 168h - 7h = 161h, ending Sat 7AM instead of 2PM
const pace = timePct > 0 ? Math.round((usagePct / timePct) * 100) : null; const usableMs = 161 * 60 * 60 * 1000;
const elapsed = et - lastSat;
const effElapsed = Math.min(Math.max(0, elapsed), usableMs);
const timePct = Math.min(100, (effElapsed / usableMs) * 100);
const pace = timePct > 0 ? Math.round((usagePct / timePct) * 100) : null;
res.json({ usage: usagePct, timePct: Math.round(timePct), pace }); res.json({ usage: usagePct, timePct: Math.round(timePct), pace });
} catch(e) { } catch(e) {