mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-03 13:27:36 +00:00
feat(srs): switch ladder to +3/+7 and enforce rest‑day logic
This commit is contained in:
1 parent
7e46fceb1c
commit
38fbb18f32
12 files changed
+140
-161
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
campaignDay,
|
||||
campaignWeek,
|
||||
isoWeek,
|
||||
STAGES,
|
||||
streak,
|
||||
} from "./srs.ts";
|
||||
|
||||
@@ -59,7 +60,8 @@ export async function buildStats(db: D1Database, today: string): Promise<object>
|
||||
const { results: ladderRows } = await db
|
||||
.prepare("SELECT stage, COUNT(*) AS n FROM problems GROUP BY stage")
|
||||
.all<{ stage: string; n: number }>();
|
||||
const ladder: Record<string, number> = { new: 0, "+2": 0, "+5": 0, "+10": 0, retired: 0 };
|
||||
// Every rung is present even at zero: the page's bar list is this object.
|
||||
const ladder: Record<string, number> = Object.fromEntries(STAGES.map((s) => [s, 0]));
|
||||
for (const row of ladderRows) ladder[row.stage] = row.n;
|
||||
|
||||
// gates rows are keyed by ISO week (that's the digest/gate contract), but
|
||||
|
||||
Reference in new issue
Block a user