chore: auto-commit uncommitted changes
This commit is contained in:
parent
6779363849
commit
03371ecd80
12
server.js
12
server.js
|
|
@ -475,10 +475,14 @@ app.get('/api/claude-usage', async (req, res) => {
|
|||
lastSat.setDate(lastSat.getDate() - daysSinceSat);
|
||||
lastSat.setHours(14, 0, 0, 0);
|
||||
if (et < lastSat) lastSat.setDate(lastSat.getDate() - 7);
|
||||
const weekMs = 7 * 24 * 60 * 60 * 1000;
|
||||
const elapsed = et - lastSat;
|
||||
const timePct = Math.min(100, Math.max(0, (elapsed / weekMs) * 100));
|
||||
const pace = timePct > 0 ? Math.round((usagePct / timePct) * 100) : null;
|
||||
const weekMs = 7 * 24 * 60 * 60 * 1000;
|
||||
// Exclude Sat 7AM–2PM (7h dead zone — Johan asleep, can't use Claude)
|
||||
// Effective usable week = 168h - 7h = 161h, ending Sat 7AM instead of 2PM
|
||||
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 });
|
||||
} catch(e) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue