This commit is contained in:
team3
2026-06-27 00:58:46 +02:00
parent 2a2026c9ae
commit f018ca5048
44 changed files with 3070 additions and 379 deletions

View File

@@ -11,9 +11,9 @@ Query-Schleifen mehr pro Guide.
import json
from database import list_baustein_scores_all, subs_count_alle, list_guides, list_progress_all
from database import list_baustein_scores_all, subs_je_ebene_alle, list_guides, list_progress_all
from guide import guide_slot_dateien
from lernen import cap_fuer, STUFEN, _schwelle
from lernen import cap_final, STUFEN, _schwelle
from paths import bausteine_path, guide_content_path
from textkit import _norm_titel
@@ -40,12 +40,12 @@ async def lade_lernstand() -> tuple[list[dict], dict[str, set[str]], dict[str, d
Stufe je Baustein wird aus Score + cap (4×relevante Subs) abgeleitet.
"""
scores = await list_baustein_scores_all()
caps = await subs_count_alle()
ebenen = await subs_je_ebene_alle()
levels: dict[str, dict[str, set[str]]] = {key: {} for key, _ in STUFEN}
for topic, baustein, score in scores:
cap = cap_fuer(caps.get((topic, _norm_titel(baustein)), 0))
cf = cap_final(ebenen.get((topic, _norm_titel(baustein)), {}))
for key, p in STUFEN:
if score >= _schwelle(p, cap):
if cf and score >= _schwelle(p, cf):
levels[key].setdefault(topic, set()).add(_norm_titel(baustein))
return await list_guides(), await list_progress_all(), levels