mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-09 04:22:30 +01:00
SeriesStats are returned when fetching a single series
SeriesStats are no longer wipred from UI on update
This commit is contained in:
parent
a9dd2d2f04
commit
19b3add783
@ -75,6 +75,8 @@ private SeriesResource GetSeriesResource(Core.Tv.Series series)
|
||||
|
||||
var resource = series.InjectTo<SeriesResource>();
|
||||
MapCoversToLocal(resource);
|
||||
LinkSeriesStatistics(resource, _seriesStatisticsService.SeriesStatistics());
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
@ -83,15 +85,9 @@ private List<SeriesResource> AllSeries()
|
||||
var seriesStats = _seriesStatisticsService.SeriesStatistics();
|
||||
var seriesResources = ToListResource(_seriesService.GetAllSeries);
|
||||
|
||||
foreach (var s in seriesResources)
|
||||
foreach (var resource in seriesResources)
|
||||
{
|
||||
var stats = seriesStats.SingleOrDefault(ss => ss.SeriesId == s.Id);
|
||||
if (stats == null) continue;
|
||||
|
||||
s.EpisodeCount = stats.EpisodeCount;
|
||||
s.EpisodeFileCount = stats.EpisodeFileCount;
|
||||
s.SeasonCount = stats.SeasonCount;
|
||||
s.NextAiring = stats.NextAiring;
|
||||
LinkSeriesStatistics(resource, seriesStats);
|
||||
}
|
||||
|
||||
MapCoversToLocal(seriesResources.ToArray());
|
||||
@ -99,8 +95,6 @@ private List<SeriesResource> AllSeries()
|
||||
return seriesResources;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SeriesResource AddSeries(SeriesResource seriesResource)
|
||||
{
|
||||
return ToResource<Core.Tv.Series>(_seriesService.AddSeries, seriesResource);
|
||||
@ -108,7 +102,11 @@ private SeriesResource AddSeries(SeriesResource seriesResource)
|
||||
|
||||
private SeriesResource UpdateSeries(SeriesResource seriesResource)
|
||||
{
|
||||
return ToResource<Core.Tv.Series>(_seriesService.UpdateSeries, seriesResource);
|
||||
var resource = ToResource<Core.Tv.Series>(_seriesService.UpdateSeries, seriesResource);
|
||||
MapCoversToLocal(resource);
|
||||
LinkSeriesStatistics(resource, _seriesStatisticsService.SeriesStatistics());
|
||||
|
||||
return resource;
|
||||
}
|
||||
|
||||
private void DeleteSeries(int id)
|
||||
@ -124,6 +122,16 @@ private void MapCoversToLocal(params SeriesResource[] series)
|
||||
_coverMapper.ConvertToLocalUrls(seriesResource.Id, seriesResource.Images);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LinkSeriesStatistics(SeriesResource resource, List<SeriesStatistics> seriesStatistics)
|
||||
{
|
||||
var stats = seriesStatistics.SingleOrDefault(ss => ss.SeriesId == resource.Id);
|
||||
if (stats == null) return;
|
||||
|
||||
resource.EpisodeCount = stats.EpisodeCount;
|
||||
resource.EpisodeFileCount = stats.EpisodeFileCount;
|
||||
resource.SeasonCount = stats.SeasonCount;
|
||||
resource.NextAiring = stats.NextAiring;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace NzbDrone.Core.SeriesStats
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user