From 4196b7eedb8ce8c8dfa999b62f06b2f43917caa8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 4 Sep 2013 23:45:18 -0700 Subject: [PATCH] SeasonCount is fixed --- 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 eece02c35..bee28febe 100644 --- a/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs +++ b/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs @@ -54,9 +54,9 @@ namespace NzbDrone.Core.SeriesStats { return @"SELECT SeriesId, - SUM(CASE WHEN (Monitored = 1 AND AirdateUtc <= @currentDate) OR Episodes.EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeCount, + SUM(CASE WHEN (Monitored = 1 AND AirdateUtc <= @currentDate) OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeCount, SUM(CASE WHEN Episodes.EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount, - MAX(Episodes.SeasonNumber) as SeasonCount, + COUNT(DISTINCT(CASE WHEN SeasonNumber > 0 THEN SeasonNumber ELSE NULL END)) as SeasonCount, MIN(CASE WHEN AirDateUtc < @currentDate THEN NULL ELSE AirDateUtc END) AS NextAiringString FROM Episodes"; }