From 248e2c32f24736af88d5bea4b5bd64594a529053 Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Tue, 16 Jun 2026 09:09:10 -0700 Subject: [PATCH] Video dashboard: curated watchlist count + clear the wishlist for now The dashboard still read the old monitored-based views: watchlist from v_watchlist (every monitored show) and wishlist from v_wishlist (every missing movie/episode, since monitored defaults to 1). Repoint both: - watchlist -> the curated watchlist_counts() total (follows + airing default). - wishlist -> 0 for now. The auto-everything v_wishlist isn't the intended curated wishlist; zero it (no live-DB mutation) until 'add to wishlist' population lands, then repoint at the real source. Test updated to the new semantics (airing show counts; wishlist cleared). --- database/video_database.py | 10 ++++++++-- tests/test_video_database.py | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/database/video_database.py b/database/video_database.py index eff54bc9..fda31ebc 100644 --- a/database/video_database.py +++ b/database/video_database.py @@ -733,8 +733,14 @@ class VideoDatabase: "SELECT COALESCE(SUM(download_speed_bps), 0) FROM downloads " "WHERE status = 'downloading'"), }, - "watchlist": scalar("SELECT COUNT(*) FROM v_watchlist"), - "wishlist": scalar("SELECT COUNT(*) FROM v_wishlist"), + # Curated watchlist (explicit follows + actively-airing library + # shows), NOT the old monitored-based v_watchlist view. + "watchlist": self.watchlist_counts(server_source=server_source)["total"], + # Wishlist is intentionally 0 for now: the old v_wishlist view + # auto-listed EVERY missing movie/episode (monitored defaults to + # 1), which isn't the intended curated wishlist. Repoint this at + # the curated source once "add to wishlist" population lands. + "wishlist": 0, } finally: conn.close() diff --git a/tests/test_video_database.py b/tests/test_video_database.py index 63b1550c..6f65c3c5 100644 --- a/tests/test_video_database.py +++ b/tests/test_video_database.py @@ -149,7 +149,8 @@ def test_dashboard_stats_empty_is_all_zero(db): def test_dashboard_stats_counts_content_and_downloads(db): with db.connect() as conn: conn.execute("INSERT INTO movies(id,title,monitored,has_file) VALUES (1,'M',1,0)") - conn.execute("INSERT INTO shows(id,title,monitored) VALUES (1,'S',1)") + # airing library show → on the curated watchlist by default + conn.execute("INSERT INTO shows(id,title,monitored,tmdb_id,status) VALUES (1,'S',1,555,'continuing')") conn.execute("INSERT INTO seasons(id,show_id,season_number) VALUES (1,1,1)") conn.execute("INSERT INTO episodes(id,show_id,season_id,season_number,episode_number) " "VALUES (1,1,1,1,1)") @@ -160,7 +161,8 @@ def test_dashboard_stats_counts_content_and_downloads(db): s = db.dashboard_stats() assert s["library"] == {"movies": 1, "shows": 1, "episodes": 1, "size_bytes": 1000} assert s["downloads"]["active"] == 1 and s["downloads"]["speed_bps"] == 500 - assert s["watchlist"] == 1 and s["wishlist"] == 1 + # watchlist = the airing show (curated default); wishlist is cleared for now + assert s["watchlist"] == 1 and s["wishlist"] == 0 def test_library_selection_roundtrip(db):