fix: downloaded episodes no longer appear as missing
Use the database as the authoritative source for missing-episode lists so that episodes marked is_downloaded=True are never shown as missing, even when the in-memory state is stale. Key changes: - EpisodeService.get_by_series() gains only_missing flag - AnimeService uses DB-backed episodeDict and preserves downloaded episodes during sync, skipping them when adding/removing missing episodes - DownloadService broadcasts series_updated after marking an episode downloaded so the frontend reflects the change immediately - Frontend filters out series with zero missing episodes client-side and fixes renderSeries to respect the active filter - Unit tests updated to assert the broadcast is sent
This commit is contained in:
@@ -101,6 +101,7 @@ def mock_anime_service():
|
||||
service = MagicMock(spec=AnimeService)
|
||||
service.download = AsyncMock(return_value=True)
|
||||
service._directory = "/mock/anime/directory"
|
||||
service._broadcast_series_updated = AsyncMock(return_value=None)
|
||||
return service
|
||||
|
||||
|
||||
@@ -848,6 +849,10 @@ class TestRemoveEpisodeFromMissingList:
|
||||
assert serie.episodeDict[1] == [1, 3]
|
||||
# Cache was cleared
|
||||
download_service._anime_service._cached_list_missing.cache_clear.assert_called()
|
||||
# Broadcast was sent so frontend gets real-time update
|
||||
download_service._anime_service._broadcast_series_updated.assert_awaited_once_with(
|
||||
"test-series"
|
||||
)
|
||||
assert result is True
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user