Show a revised-chapters count on the story list

This commit is contained in:
tim
2026-09-27 23:38:28 +02:00
parent 1246816ab8
commit ce19035689
4 changed files with 32 additions and 1 deletions
+1
View File
@@ -172,6 +172,7 @@ function storyRow(s) {
{ 'data-label': 'Chapters' },
String(s.chapter_count),
s.offsite_count > 0 && [' ', badge('warn', `${s.offsite_count} removed`, 'Chapters the site no longer lists')],
s.revised_count > 0 && [' ', badge('info', `${s.revised_count} revised`, 'Chapters the site changed since Bindery added them')],
),
h(
'td',
+3 -1
View File
@@ -187,7 +187,9 @@ class Store:
s.message, s.last_checked, s.last_changed, s.ingested_at, s.locked_fields,
(SELECT COUNT(*) FROM chapters c WHERE c.story_id = s.id AND c.included = 1) AS chapter_count,
(SELECT COUNT(*) FROM chapters c WHERE c.story_id = s.id AND c.included = 1
AND c.on_site = 0) AS offsite_count
AND c.on_site = 0) AS offsite_count,
(SELECT COUNT(*) FROM chapters c WHERE c.story_id = s.id AND c.included = 1
AND (SELECT COUNT(*) FROM revisions r WHERE r.chapter_id = c.id) > 1) AS revised_count
FROM stories s ORDER BY s.title COLLATE NOCASE""").fetchall()
return [_story(r) for r in rows]