mirror of https://github.com/Radarr/Radarr
Fixed: Next airing on series list
This commit is contained in:
parent
c42e322949
commit
3df5d9444b
|
@ -37,32 +37,28 @@ namespace NzbDrone.Core.SeriesStats
|
|||
|
||||
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
|
||||
{
|
||||
return new SeriesStatistics
|
||||
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),
|
||||
NextAiringString = seasonStatistics.OrderBy(s =>
|
||||
{
|
||||
DateTime nextAiring;
|
||||
|
||||
if (!DateTime.TryParse(s.NextAiringString, out nextAiring)) return DateTime.MinValue;
|
||||
|
||||
return nextAiring;
|
||||
}).First().NextAiringString,
|
||||
|
||||
PreviousAiringString = seasonStatistics.OrderBy(s =>
|
||||
{
|
||||
DateTime nextAiring;
|
||||
|
||||
if (!DateTime.TryParse(s.PreviousAiringString, out nextAiring)) return DateTime.MinValue;
|
||||
|
||||
return nextAiring;
|
||||
}).Last().PreviousAiringString
|
||||
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk)
|
||||
};
|
||||
|
||||
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null)
|
||||
.OrderBy(s => s.NextAiring)
|
||||
.FirstOrDefault();
|
||||
|
||||
var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null)
|
||||
.OrderBy(s => s.PreviousAiring)
|
||||
.LastOrDefault();
|
||||
|
||||
seriesStatistics.NextAiringString = nextAiring != null ? nextAiring.NextAiringString : null;
|
||||
seriesStatistics.PreviousAiringString = previousAiring != null ? previousAiring.PreviousAiringString : null;
|
||||
|
||||
return seriesStatistics;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue