chore: auto-commit uncommitted changes

This commit is contained in:
James 2026-03-01 00:01:22 -05:00
parent 85d37323b1
commit 12e87eccfc
1 changed files with 8 additions and 9 deletions

View File

@ -470,16 +470,15 @@ app.get('/api/claude-usage', async (req, res) => {
const now = new Date(); const now = new Date();
const et = new Date(now.toLocaleString('en-US', { timeZone: 'America/New_York' })); const et = new Date(now.toLocaleString('en-US', { timeZone: 'America/New_York' }));
const day = et.getDay(); const day = et.getDay();
const daysSinceSat = day === 6 ? 0 : day + 1; // Week resets Thu 10 PM ET (changed from Sat 2PM — 2026-02-28)
const lastSat = new Date(et); const daysSinceThu = (day + 3) % 7;
lastSat.setDate(lastSat.getDate() - daysSinceSat); const lastThu = new Date(et);
lastSat.setHours(14, 0, 0, 0); lastThu.setDate(lastThu.getDate() - daysSinceThu);
if (et < lastSat) lastSat.setDate(lastSat.getDate() - 7); lastThu.setHours(22, 0, 0, 0);
if (et < lastThu) lastThu.setDate(lastThu.getDate() - 7);
const weekMs = 7 * 24 * 60 * 60 * 1000; const weekMs = 7 * 24 * 60 * 60 * 1000;
// Exclude Sat 7AM2PM (7h dead zone — Johan asleep, can't use Claude) const usableMs = weekMs;
// Effective usable week = 168h - 7h = 161h, ending Sat 7AM instead of 2PM const elapsed = et - lastThu;
const usableMs = 161 * 60 * 60 * 1000;
const elapsed = et - lastSat;
const effElapsed = Math.min(Math.max(0, elapsed), usableMs); const effElapsed = Math.min(Math.max(0, elapsed), usableMs);
const timePct = Math.min(100, (effElapsed / usableMs) * 100); const timePct = Math.min(100, (effElapsed / usableMs) * 100);
const pace = timePct > 0 ? Math.round((usagePct / timePct) * 100) : null; const pace = timePct > 0 ? Math.round((usagePct / timePct) * 100) : null;