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
+14
View File
@@ -263,6 +263,20 @@ test('story list stacks on a narrow screen instead of scrolling sideways', async
assert.deepEqual(dataLabels, [undefined, 'Author', 'Site', 'Chapters', 'Status', 'Last check']);
});
test('the story list shows removed and revised chapter counts, only when there are any', async () => {
details.story.offsite_count = 0;
details.story.revised_count = 0;
await mountStories();
assert.doesNotMatch(main.textContent, /removed/);
assert.doesNotMatch(main.textContent, /revised/);
cleanups.pop()();
details.story.offsite_count = 2;
details.story.revised_count = 3;
await mountStories();
assert.match(main.textContent, /2 removed/);
assert.match(main.textContent, /3 revised/);
});
test('story download modes send selected chapters and clear forced fields after success', async () => {
await mountStory();
api.on('POST', 'stories/1/download', { mode_label: 'Queued' });
+14
View File
@@ -33,6 +33,20 @@ def test_chapters_revisions_and_rules(tmp_path):
assert store.rules(None) != []
def test_list_stories_counts_offsite_and_revised_chapters(tmp_path):
store = Store(tmp_path / "db.sqlite")
sid = store.create_story("https://example/s/1", "example", "T", "A", [])
c1 = store.add_chapter(sid, "u1", "One", "<p>1</p>", "h1", "new", 0)
c2 = store.add_chapter(sid, "u2", "Two", "<p>2</p>", "h2", "new", 1)
store.add_chapter(sid, "u3", "Three", "<p>3</p>", "h3", "new", 2)
store.update_chapter(c1, on_site=0)
store.add_revision(c2, "<p>2b</p>", "h2b", "recheck")
story = store.list_stories()[0]
assert story["offsite_count"] == 1
assert story["revised_count"] == 1
def test_cover_replaces_previous_cover(tmp_path):
store = Store(tmp_path / "db.sqlite")
sid = store.create_story("u", "s", "T", "A", [])