Admin polish: section fallback, live-scoped coverage, dual source status

Per Codex audit:
* Unknown ?section= values now clamp to Overview, so the page never renders the
  tabs with an empty body.
* Summary/image coverage counts join through articles+scores and require
  accepted=1 AND duplicate_of IS NULL, so percentages stay ≤100% and honest as
  rejected/duplicate rows accrue summaries over time.
* A source that's both resting and flagged now shows "⚠ resting · review"
  rather than hiding the review flag behind the resting state.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-08 13:19:15 -04:00
parent 575f562ad5
commit 13722f04a8
2 changed files with 14 additions and 4 deletions
+8 -2
View File
@@ -237,10 +237,16 @@ def content_stats(conn: sqlite3.Connection) -> dict:
"SELECT COUNT(*) FROM article_scores s JOIN articles a ON a.id=s.article_id "
"WHERE s.accepted=1 AND a.duplicate_of IS NULL AND a.image_url IS NOT NULL AND a.image_url!=''"
)
summaries = scalar("SELECT COUNT(*) FROM article_summaries")
# Coverage is scoped to LIVE articles (accepted, non-duplicate) so the
# percentages can't drift past 100% as rejected/duplicate rows accrue summaries.
summaries = scalar(
"SELECT COUNT(*) FROM article_summaries m JOIN articles a ON a.id=m.article_id "
"JOIN article_scores s ON s.article_id=a.id WHERE s.accepted=1 AND a.duplicate_of IS NULL"
)
summaries_with_image = scalar(
"SELECT COUNT(*) FROM article_summaries m JOIN articles a ON a.id=m.article_id "
"WHERE a.image_url IS NOT NULL AND a.image_url!=''"
"JOIN article_scores s ON s.article_id=a.id WHERE s.accepted=1 AND a.duplicate_of IS NULL "
"AND a.image_url IS NOT NULL AND a.image_url!=''"
)
brief_with_image = 0
if brief: