1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Calculate proper start time for double episodes

Edit quality profile uses name attribute for switch
This commit is contained in:
Mark McDowall 2013-04-18 17:35:18 -07:00 committed by markus101
parent 2687cd60ed
commit 609c5bfc24
2 changed files with 16 additions and 6 deletions

View File

@ -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<Episode>, List<CalendarResource>>(episodes).AsResponse();
}
}

View File

@ -40,12 +40,7 @@
<div class="controls">
<div class="switch" data-on-label="Yes" data-off-label="No">
{{#if allowed}}
<input type="checkbox" checked="checked" />
{{else}}
<input type="checkbox" />
{{/if}}
<input type="checkbox" name="allowed" />
</div>
</div>
</div>