This commit is contained in:
team3
2026-06-18 16:45:33 +02:00
parent 9c0f622e0c
commit d067cb8b54
27 changed files with 329 additions and 327 deletions

View File

@@ -312,39 +312,6 @@ def _now() -> str:
return datetime.now(timezone.utc).isoformat()
async def get_vertiefung(topic: str, baustein: str, art: str) -> str | None:
db = await get_db()
cursor = await db.execute(
"SELECT md FROM baustein_texte WHERE topic = ? AND baustein = ? AND art = ?",
(topic, baustein, art),
)
row = await cursor.fetchone()
return row[0] if row else None
async def set_vertiefung(topic: str, baustein: str, art: str, md: str) -> None:
db = await get_db()
now = _now()
await db.execute(
"""INSERT INTO baustein_texte (topic, baustein, art, md, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?)
ON CONFLICT(topic, baustein, art) DO UPDATE SET md = excluded.md, updated_at = excluded.updated_at""",
(topic, baustein, art, md, now, now),
)
await db.commit()
async def list_vertiefungen(topic: str) -> dict[str, set[str]]:
"""Baustein-Titel → vorhandene Text-Arten ('vertiefung'/'deepdive')."""
db = await get_db()
cursor = await db.execute("SELECT baustein, art FROM baustein_texte WHERE topic = ?", (topic,))
rows = await cursor.fetchall()
out: dict[str, set[str]] = {}
for baustein, art in rows:
out.setdefault(baustein, set()).add(art)
return out
async def list_baustein_progress(topic: str) -> list[dict]:
db = await get_db()
cursor = await db.execute(