From ff2b62887cf9b230b2db88586f9573fd9da4d258 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 24 Aug 2013 18:56:19 -0700 Subject: [PATCH] Episodes without dates but file will be included in count Unmonitored episodes with files will be included in the episode count --- NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs b/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs index 8181cd343..22df938b1 100644 --- a/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs +++ b/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs @@ -54,8 +54,8 @@ namespace NzbDrone.Core.SeriesStats { return @"SELECT SeriesId, - SUM(CASE WHEN Monitored = 1 AND AirdateUtc <= @currentDate THEN 1 ELSE 0 END) AS EpisodeCount, - SUM(CASE WHEN Monitored = 1 AND Episodes.EpisodeFileId > 0 AND AirDateUtc <= @currentDate THEN 1 ELSE 0 END) AS EpisodeFileCount, + SUM(CASE WHEN (Monitored = 1 OR Episodes.EpisodeFileId > 0) AND (AirdateUtc <= @currentDate OR Episodes.EpisodeFileId > 0) THEN 1 ELSE 0 END) AS EpisodeCount, + SUM(CASE WHEN (Monitored = 1 OR Episodes.EpisodeFileId > 0) AND Episodes.EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount, MAX(Episodes.SeasonNumber) as SeasonCount, MIN(CASE WHEN AirDateUtc < @currentDate THEN NULL ELSE AirDateUtc END) AS NextAiringString FROM Episodes";