mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-25 17:17:02 +00:00
Fixed: Next airing on series list
This commit is contained in:
parent
c42e322949
commit
3df5d9444b
1 changed files with 18 additions and 22 deletions
|
@ -37,32 +37,28 @@ public SeriesStatistics SeriesStatistics(int seriesId)
|
||||||
|
|
||||||
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
|
private SeriesStatistics MapSeriesStatistics(List<SeasonStatistics> seasonStatistics)
|
||||||
{
|
{
|
||||||
return new SeriesStatistics
|
var seriesStatistics = new SeriesStatistics
|
||||||
{
|
{
|
||||||
SeasonStatistics = seasonStatistics,
|
SeasonStatistics = seasonStatistics,
|
||||||
SeriesId = seasonStatistics.First().SeriesId,
|
SeriesId = seasonStatistics.First().SeriesId,
|
||||||
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
|
EpisodeFileCount = seasonStatistics.Sum(s => s.EpisodeFileCount),
|
||||||
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
|
EpisodeCount = seasonStatistics.Sum(s => s.EpisodeCount),
|
||||||
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
|
TotalEpisodeCount = seasonStatistics.Sum(s => s.TotalEpisodeCount),
|
||||||
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk),
|
SizeOnDisk = seasonStatistics.Sum(s => s.SizeOnDisk)
|
||||||
NextAiringString = seasonStatistics.OrderBy(s =>
|
};
|
||||||
{
|
|
||||||
DateTime nextAiring;
|
|
||||||
|
|
||||||
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;
|
var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null)
|
||||||
}).First().NextAiringString,
|
.OrderBy(s => s.PreviousAiring)
|
||||||
|
.LastOrDefault();
|
||||||
|
|
||||||
PreviousAiringString = seasonStatistics.OrderBy(s =>
|
seriesStatistics.NextAiringString = nextAiring != null ? nextAiring.NextAiringString : null;
|
||||||
{
|
seriesStatistics.PreviousAiringString = previousAiring != null ? previousAiring.PreviousAiringString : null;
|
||||||
DateTime nextAiring;
|
|
||||||
|
|
||||||
if (!DateTime.TryParse(s.PreviousAiringString, out nextAiring)) return DateTime.MinValue;
|
return seriesStatistics;
|
||||||
|
|
||||||
return nextAiring;
|
|
||||||
}).Last().PreviousAiringString
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue