feat(srs): switch ladder to +3/+7 and enforce rest‑day logic

This commit is contained in:
Prad Nukala
2026-08-31 10:41:45 -04:00
parent 7e46fceb1c
commit 38fbb18f32
12 changed files with 140 additions and 161 deletions
+4 -2
View File
@@ -14,6 +14,7 @@
* badges: rounded #09090b cards, #fafafa/#a1a1aa text, GitHub dark-mode
* green ramp. Every function renders on a zero-row DB.
*/
import { STAGES } from "./srs.ts";
import { Canvas, textWidth } from "./png.ts";
// D1Database comes from the generated worker-configuration.d.ts runtime types.
@@ -43,8 +44,6 @@ const PHASES = [
{ milestone: 5, name: "V — Decision Space" },
];
const STAGES = ["new", "+2", "+5", "+10", "retired"];
// ── svg helpers ──────────────────────────────────────────────────
/** Opening tag plus the rounded dark card every chart starts with. */
@@ -159,6 +158,9 @@ export async function progressChart(db: D1Database): Promise<string> {
// ── ladder: bar per stage ────────────────────────────────────────
// One bar per rung, labelled and ordered by srs.ts's STAGES, so changing the
// ladder can never leave a stale bar here: the slot width is derived from the
// rung count, only the bar width inside a slot is fixed.
export async function ladderChart(db: D1Database): Promise<string> {
const { results } = await db
.prepare(`SELECT stage, COUNT(*) AS count FROM problems GROUP BY stage`)