Backend: regeln.py (Lernregeln zentral), Stats O(n), GET /guides/locks, _norm_titel gehärtet
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -216,6 +216,17 @@ async def delete_element(element_id: str) -> bool:
|
||||
|
||||
# --- Kapitel-Fortschritt ---
|
||||
|
||||
async def list_progress_all() -> dict[str, set[str]]:
|
||||
"""Kompletter Kapitel-Fortschritt in einem Query: guide_id → Kapitel-Titel."""
|
||||
db = await get_db()
|
||||
cursor = await db.execute("SELECT guide_id, chapter FROM guide_progress")
|
||||
rows = await cursor.fetchall()
|
||||
out: dict[str, set[str]] = {}
|
||||
for guide_id, chapter in rows:
|
||||
out.setdefault(guide_id, set()).add(chapter)
|
||||
return out
|
||||
|
||||
|
||||
async def list_progress(guide_id: str) -> list[str]:
|
||||
db = await get_db()
|
||||
cursor = await db.execute(
|
||||
|
||||
Reference in New Issue
Block a user