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:
team3
2026-06-12 08:08:26 +02:00
parent 5702108d28
commit f4c16eed84
4 changed files with 127 additions and 78 deletions

View File

@@ -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(