Calculate proper start time for double episodes

Edit quality profile uses name attribute for switch
pull/4/head
Mark McDowall 12 years ago committed by markus101
parent 2687cd60ed
commit 609c5bfc24

@ -33,6 +33,21 @@ namespace NzbDrone.Api.Calendar
if(queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value); if(queryEnd.HasValue) end = DateTime.Parse(queryEnd.Value);
var episodes = _episodeService.EpisodesBetweenDates(start, end); 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(); return Mapper.Map<List<Episode>, List<CalendarResource>>(episodes).AsResponse();
} }
} }

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

Loading…
Cancel
Save