model: drop 'fix' status; mistakes now register as 'learning' (ADR-017)
This commit is contained in:
+4
-4
@@ -94,7 +94,7 @@ def ingest(conn: sqlite3.Connection, payload: dict) -> dict[str, int]:
|
||||
[{
|
||||
"id": d.get("id", ""), "category": d.get("category", ""),
|
||||
"issue": d.get("issue", ""), "rule": d.get("rule", ""),
|
||||
"examples": d.get("examples", ""), "status": d.get("status", "fix"),
|
||||
"examples": d.get("examples", ""), "status": d.get("status", "learning"),
|
||||
"count": int(d.get("count") or 0), "first": d.get("first", ""),
|
||||
"last": d.get("last", ""), "next_review": d.get("next_review", ""),
|
||||
} for d in grammar if d.get("id")])
|
||||
@@ -166,7 +166,7 @@ def export(conn: sqlite3.Connection) -> dict:
|
||||
|
||||
def overview(conn: sqlite3.Connection) -> dict:
|
||||
def counts(where):
|
||||
c = {"new": 0, "known": 0, "learning": 0, "fix": 0}
|
||||
c = {"new": 0, "known": 0, "learning": 0}
|
||||
for r in conn.execute(
|
||||
f"SELECT status, COUNT(*) n FROM items WHERE {where} GROUP BY status"):
|
||||
if r["status"] in c:
|
||||
@@ -175,13 +175,13 @@ def overview(conn: sqlite3.Connection) -> dict:
|
||||
return c
|
||||
|
||||
g = conn.execute(
|
||||
"SELECT SUM(status='fix') f, SUM(status='known') k, COUNT(*) t FROM grammar_fixes"
|
||||
"SELECT SUM(status='learning') l, SUM(status='known') k, COUNT(*) t FROM grammar_fixes"
|
||||
).fetchone()
|
||||
return {
|
||||
"word": counts("kind='word'"),
|
||||
"phrase": counts("kind='phrase'"),
|
||||
"expression": counts("kind='expression'"),
|
||||
"grammar": {"fix": g["f"] or 0, "known": g["k"] or 0, "total": g["t"] or 0},
|
||||
"grammar": {"learning": g["l"] or 0, "known": g["k"] or 0, "total": g["t"] or 0},
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user