This commit is contained in:
team3
2026-06-24 07:52:05 +02:00
parent 12125d0f2d
commit 3b1e84e17d
13 changed files with 46 additions and 224 deletions

View File

@@ -492,17 +492,6 @@ async def set_baustein_score(topic: str, baustein: str, score: int) -> int:
return score
async def set_baustein_streak(topic: str, baustein: str, streak: int) -> None:
"""Persistiert die Streak-Folge (Bonus) absolut — überlebt Reload/Session-Wechsel."""
db = await get_db()
await db.execute(
"""INSERT INTO baustein_progress (topic, baustein, streak, updated_at)
VALUES (?, ?, ?, ?)
ON CONFLICT(topic, baustein) DO UPDATE SET
streak = excluded.streak, updated_at = excluded.updated_at""",
(topic, baustein, streak, _now()),
)
await db.commit()
async def set_baustein_verstanden(topic: str, baustein: str) -> bool:
@@ -793,11 +782,6 @@ async def get_step_status(topic: str, schritt: str) -> str:
return row[0] if row else "offen"
async def list_pipeline_state(topic: str) -> dict[str, str]:
db = await get_db()
cursor = await db.execute("SELECT schritt, status FROM pipeline_state WHERE topic = ?", (topic,))
rows = await cursor.fetchall()
return {s: st for s, st in rows}
async def delete_pipeline_state(topic: str, schritte: list[str] | None = None) -> None:
@@ -810,24 +794,8 @@ async def delete_pipeline_state(topic: str, schritte: list[str] | None = None) -
await db.commit()
async def set_quelle(topic: str, type: str, ort: str = "", spec: str = "") -> None:
db = await get_db()
await db.execute(
"""INSERT INTO quelle (topic, type, ort, spec, updated_at) VALUES (?, ?, ?, ?, ?)
ON CONFLICT(topic) DO UPDATE SET
type = excluded.type, ort = excluded.ort, spec = excluded.spec, updated_at = excluded.updated_at""",
(topic, type, ort, spec, _now()),
)
await db.commit()
async def get_quelle(topic: str) -> dict | None:
db = await get_db()
cursor = await db.execute("SELECT type, ort, spec FROM quelle WHERE topic = ?", (topic,))
row = await cursor.fetchone()
if row is None:
return None
return {"type": row[0], "ort": row[1], "spec": row[2]}
async def delete_quelle(topic: str) -> None: