From 609c5bfc24bbce7e9ce568b594ec2d57419b3e14 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 18 Apr 2013 17:35:18 -0700 Subject: [PATCH] Calculate proper start time for double episodes Edit quality profile uses name attribute for switch --- NzbDrone.Api/Calendar/CalendarModule.cs | 15 +++++++++++++++ .../Profile/EditQualityProfileTemplate.html | 7 +------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/NzbDrone.Api/Calendar/CalendarModule.cs b/NzbDrone.Api/Calendar/CalendarModule.cs index 799b98215..7a2d2a99f 100644 --- a/NzbDrone.Api/Calendar/CalendarModule.cs +++ b/NzbDrone.Api/Calendar/CalendarModule.cs @@ -33,6 +33,21 @@ private Response GetEpisodesBetweenStartAndEndDate() if(queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); var episodes = _episodeService.EpisodesBetweenDates(start, end); + + //Todo: This should be done on episode data refresh - because it can be used in multiple places + var groups = episodes.GroupBy(e => new { e.SeriesId, e.AirDate }).Where(g => g.Count() > 1).ToList(); + + foreach (var group in groups) + { + //Order by Episode Number + int episodeCount = 0; + foreach (var episode in group.OrderBy(e => e.SeasonNumber).ThenBy(e => e.EpisodeNumber)) + { + episode.AirDate = episode.AirDate.Value.AddMinutes(episode.Series.Runtime * episodeCount); + episodeCount++; + } + } + return Mapper.Map, List>(episodes).AsResponse(); } } diff --git a/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html b/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html index 40c284060..176ab5009 100644 --- a/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html +++ b/UI/Settings/Quality/Profile/EditQualityProfileTemplate.html @@ -40,12 +40,7 @@
- {{#if allowed}} - - {{else}} - - {{/if}} - +