This commit is contained in:
team3
2026-07-04 03:25:02 +02:00
parent c4caf31ed0
commit 2f5d5b9ca1
11 changed files with 176 additions and 18 deletions

View File

@@ -1171,6 +1171,21 @@ async def list_subblocks(topic: str, block_norm: str | None = None) -> list[dict
return [_row_to_dict(row, cursor) for row in rows]
async def default_subblock_levels(topic: str, block_norm: str) -> None:
"""Classify stragglers after finalize: consensus rows without a valid level fall out of
the guide/practice/level queries (re-run resume left 25 such rows — invisible content)."""
db = await get_db()
await db.execute(
"""UPDATE subblocks SET level = 'advanced' WHERE topic = ? AND block_norm = ?
AND status = 'consensus' AND (level IS NULL OR level NOT IN ('beginner', 'advanced', 'expert'))""",
(topic, block_norm))
await db.execute(
"""UPDATE subblocks SET relevance = 'relevant' WHERE topic = ? AND block_norm = ?
AND status = 'consensus' AND relevance IS NULL""",
(topic, block_norm))
await db.commit()
async def set_subblock_fields(topic: str, block_norm: str, sub_norm: str, **fields) -> None:
"""Set fields (level/relevance/status/sub_title) of a subblock row."""
fields["updated_at"] = _now()