diff --git a/src/NzbDrone.Api/Series/SeasonStatisticsResource.cs b/src/NzbDrone.Api/Series/SeasonStatisticsResource.cs index 1aa29e9e9..aad49032c 100644 --- a/src/NzbDrone.Api/Series/SeasonStatisticsResource.cs +++ b/src/NzbDrone.Api/Series/SeasonStatisticsResource.cs @@ -8,6 +8,7 @@ public class SeasonStatisticsResource public DateTime? PreviousAiring { get; set; } public int EpisodeFileCount { get; set; } public int EpisodeCount { get; set; } + public int TotalEpisodeCount { get; set; } public long SizeOnDisk { get; set; } public decimal PercentOfEpisodes diff --git a/src/NzbDrone.Api/Series/SeriesModule.cs b/src/NzbDrone.Api/Series/SeriesModule.cs index 764cfd5b2..8763c46f8 100644 --- a/src/NzbDrone.Api/Series/SeriesModule.cs +++ b/src/NzbDrone.Api/Series/SeriesModule.cs @@ -160,6 +160,7 @@ private void LinkSeriesStatistics(List resources, List SeasonStatistics { get; set; } diff --git a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs index 5566d4dee..74a4dc658 100644 --- a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs +++ b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.SeriesStats public interface ISeriesStatisticsRepository { List SeriesStatistics(); - SeasonStatistics SeriesStatistics(Int32 seriesId); + List SeriesStatistics(Int32 seriesId); } public class SeriesStatisticsRepository : ISeriesStatisticsRepository @@ -35,7 +35,7 @@ public List SeriesStatistics() return mapper.Query(queryText); } - public SeasonStatistics SeriesStatistics(Int32 seriesId) + public List SeriesStatistics(Int32 seriesId) { var mapper = _database.GetDataMapper(); @@ -49,7 +49,7 @@ public SeasonStatistics SeriesStatistics(Int32 seriesId) sb.AppendLine(GetGroupByClause()); var queryText = sb.ToString(); - return mapper.Find(queryText); + return mapper.Query(queryText); } private String GetSelectClause() @@ -58,6 +58,7 @@ private String GetSelectClause() (SELECT Episodes.SeriesId, Episodes.SeasonNumber, + SUM(CASE WHEN AirdateUtc <= @currentDate OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS TotalEpisodeCount, SUM(CASE WHEN (Monitored = 1 AND AirdateUtc <= @currentDate) OR EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeCount, SUM(CASE WHEN EpisodeFileId > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount, MIN(CASE WHEN AirDateUtc < @currentDate OR EpisodeFileId > 0 OR Monitored = 0 THEN NULL ELSE AirDateUtc END) AS NextAiringString, diff --git a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs index d6169b68c..c03e4015c 100644 --- a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs +++ b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsService.cs @@ -30,9 +30,9 @@ public SeriesStatistics SeriesStatistics(int seriesId) { var stats = _seriesStatisticsRepository.SeriesStatistics(seriesId); - if (stats == null) return new SeriesStatistics(); + if (stats == null || stats.Count == 0) return new SeriesStatistics(); - return MapSeriesStatistics(new List { stats }); + return MapSeriesStatistics(stats); } private SeriesStatistics MapSeriesStatistics(List seasonStatistics) @@ -43,6 +43,7 @@ private SeriesStatistics MapSeriesStatistics(List seasonStatis SeriesId = seasonStatistics.First().SeriesId, EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount), EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount), + TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount), SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk), NextAiringString = seasonStatistics.OrderBy(s => { diff --git a/src/UI/Content/icons.less b/src/UI/Content/icons.less index 994ada51d..a694200e5 100644 --- a/src/UI/Content/icons.less +++ b/src/UI/Content/icons.less @@ -72,8 +72,7 @@ .icon-sonarr-spinner { .fa-icon-content(@fa-var-spinner); - //TODO: Fix icon spin - //.fa-spin + margin: 0px -0.14em; } .icon-sonarr-rename { diff --git a/src/UI/SeasonPass/SeasonsCellTemplate.hbs b/src/UI/SeasonPass/SeasonsCellTemplate.hbs index 18f8bbde1..effa38b5d 100644 --- a/src/UI/SeasonPass/SeasonsCellTemplate.hbs +++ b/src/UI/SeasonPass/SeasonsCellTemplate.hbs @@ -1,30 +1,29 @@ {{#each seasons}} - - + {{debug}} + + - {{#if_eq seasonNumber compare="0"}} Specials {{else}} S{{Pad2 seasonNumber}} {{/if_eq}} - - - - - - - - - - - - - - - - + + {{#with statistics}} + {{#if_eq totalEpisodeCount compare=0}} +   + {{else}} + {{#if_eq percentOfEpisodes compare=100}} + {{episodeFileCount}}/{{totalEpisodeCount}} + {{else}} + {{episodeFileCount}}/{{totalEpisodeCount}} + {{/if_eq}} + {{/if_eq}} + {{else}} +   + {{/with}} + {{/each}} \ No newline at end of file diff --git a/src/UI/SeasonPass/seasonpass.less b/src/UI/SeasonPass/seasonpass.less index ba0ef2584..343214eca 100644 --- a/src/UI/SeasonPass/seasonpass.less +++ b/src/UI/SeasonPass/seasonpass.less @@ -1,21 +1,49 @@ +@import "../Content/badges.less"; @import "../Shared/Styles/clickable.less"; .season { - display : inline-block; - font-size : 14px; + display : inline-block; margin-bottom : 4px; - background-color: #eee; - border: 1px solid #999; - color: #999; + + .label { + .badge-inverse(); + + display : inline-block; + padding : 4px; + + font-size : 14px; + } + + .label:first-child { + border-right : 0px; + border-top-right-radius : 0.0em; + border-bottom-right-radius : 0.0em; + color : #777; + background-color : #eee; + } + + .label:last-child { + border-left : 0px; + border-top-left-radius : 0.0em; + border-bottom-left-radius : 0.0em; + color : #999; + background-color : #f7f7f7; + } .season-monitored { - display : inline-block; - width : 16px; + width : 16px; - .clickable(); + i { + .clickable(); + } } .season-number { font-size : 12px; } + + .season-status { + display : inline-block; + vertical-align : baseline !important; + } } diff --git a/src/UI/Series/Details/SeriesDetailsLayout.js b/src/UI/Series/Details/SeriesDetailsLayout.js index 980b875da..8d77d2464 100644 --- a/src/UI/Series/Details/SeriesDetailsLayout.js +++ b/src/UI/Series/Details/SeriesDetailsLayout.js @@ -127,6 +127,7 @@ module.exports = Marionette.Layout.extend({ var monitored = this.model.get('monitored'); this.ui.monitored.removeAttr('data-idle-icon'); + this.ui.monitored.removeClass('fa-spin icon-sonarr-spinner'); if (monitored) { this.ui.monitored.addClass('icon-sonarr-monitored');