update
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user