From 7910fa55cefe700492b659ca1df94c376d551910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Sun, 15 Sep 2019 10:39:31 -0400 Subject: [PATCH] Fix for history when series/movies have been deleted. --- bazarr/main.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/bazarr/main.py b/bazarr/main.py index 80e7f52fd..5f1e7efb1 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1124,7 +1124,13 @@ def history(): def historyseries(): authorize() - row_count = TableHistory.select().count() + row_count = TableHistory.select( + + ).join_from( + TableHistory, TableShows, JOIN.LEFT_OUTER + ).where( + TableShows.title.is_null(False) + ).count() page = request.GET.page if page == "": page = "1" @@ -1168,6 +1174,8 @@ def historyseries(): TableHistory, TableShows, JOIN.LEFT_OUTER ).join_from( TableHistory, TableEpisodes, JOIN.LEFT_OUTER + ).where( + TableShows.title.is_null(False) ).order_by( TableHistory.timestamp.desc() ).paginate( @@ -1229,7 +1237,13 @@ def historyseries(): def historymovies(): authorize() - row_count = TableHistoryMovie.select().count() + row_count = TableHistoryMovie.select( + + ).join_from( + TableHistoryMovie, TableMovies, JOIN.LEFT_OUTER + ).where( + TableMovies.title.is_null(False) + ).count() page = request.GET.page if page == "": page = "1" @@ -1269,6 +1283,8 @@ def historymovies(): TableMovies.forced ).join_from( TableHistoryMovie, TableMovies, JOIN.LEFT_OUTER + ).where( + TableMovies.title.is_null(False) ).order_by( TableHistoryMovie.timestamp.desc() ).paginate(