MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / weeklyReport

Function weeklyReport

src/cli/maintain-stats.ts:133–150  ·  view source on GitHub ↗
(runs: MaintainRun[], nowMs: number)

Source from the content-addressed store, hash-verified

131
132/** Week-over-week self-improvement report from run timestamps. PURE (pass `nowMs`). */
133export function weeklyReport(runs: MaintainRun[], nowMs: number): MaintainWeekly {
134 const DAY = 86_400_000;
135 const inWindow = (r: MaintainRun, from: number, to: number) => {
136 const t = r.at ? Date.parse(r.at) : NaN;
137 return Number.isFinite(t) && t >= from && t < to;
138 };
139 const thisWeek = runs.filter(r => inWindow(r, nowMs - 7 * DAY, nowMs));
140 const priorWeek = runs.filter(r => inWindow(r, nowMs - 14 * DAY, nowMs - 7 * DAY));
141 const opened = thisWeek.filter(r => r.status === 'opened');
142 return {
143 opened: opened.length,
144 blocked: thisWeek.filter(r => r.status === 'blocked').length,
145 filesCleaned: opened.reduce((a, r) => a + (r.filesChanged || 0), 0),
146 minutesSaved: opened.length * 5,
147 priorOpened: priorWeek.filter(r => r.status === 'opened').length,
148 openedDelta: opened.length - priorWeek.filter(r => r.status === 'opened').length,
149 };
150}

Callers 4

index.tsFile · 0.85
gatherDashboardDataFunction · 0.85

Calls 1

inWindowFunction · 0.85

Tested by

no test coverage detected