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

Fixed: Next airing on series list

This commit is contained in:
Mark McDowall 2015-06-09 00:32:17 -07:00
parent c42e322949
commit 3df5d9444b

View File

@ -37,32 +37,28 @@ public SeriesStatistics SeriesStatistics(int seriesId)
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
{
return new SeriesStatistics
{
SeasonStatistics = seasonStatistics,
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 =>
{
DateTime nextAiring;
var seriesStatistics = new SeriesStatistics
{
SeasonStatistics = seasonStatistics,
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)
};
if (!DateTime.TryParse(s.NextAiringString, out nextAiring)) return DateTime.MinValue;
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
.OrderBy(s => s.NextAiring)
.FirstOrDefault();
return nextAiring;
}).First().NextAiringString,
var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null)
.OrderBy(s => s.PreviousAiring)
.LastOrDefault();
PreviousAiringString = seasonStatistics.OrderBy(s =>
{
DateTime nextAiring;
seriesStatistics.NextAiringString = nextAiring != null ? nextAiring.NextAiringString : null;
seriesStatistics.PreviousAiringString = previousAiring != null ? previousAiring.PreviousAiringString : null;
if (!DateTime.TryParse(s.PreviousAiringString, out nextAiring)) return DateTime.MinValue;
return nextAiring;
}).Last().PreviousAiringString
};
return seriesStatistics;
}
}
}