mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
SeriesProvider gets QualityProfile in single call to DB.
SeriesProvider.GetAllSeriesWithEpisodeCount gets seasonCount(with or without specials), total episode count & episodeWithFile count (excluding ignored episodes). Added tests for SeriesWithEpisodeCount.
This commit is contained in:
parent
5a99d374d9
commit
431d850d32
6 changed files with 197 additions and 91 deletions
|
@ -80,8 +80,7 @@ namespace NzbDrone.Web.Controllers
|
|||
[GridAction]
|
||||
public ActionResult _AjaxSeriesGrid()
|
||||
{
|
||||
var series = GetSeriesModels(_seriesProvider.GetAllSeries().ToList());
|
||||
|
||||
var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount(true).ToList());
|
||||
return View(new GridModel(series));
|
||||
}
|
||||
|
||||
|
@ -124,17 +123,6 @@ namespace NzbDrone.Web.Controllers
|
|||
return View(new GridModel(episodes));
|
||||
}
|
||||
|
||||
public JsonResult GetEpisodeCount(int seriesId)
|
||||
{
|
||||
var count = _mediaFileProvider.GetEpisodeFilesCount(seriesId);
|
||||
|
||||
return Json(new
|
||||
{
|
||||
Episodes = count.Item1,
|
||||
EpisodeTotal = count.Item2
|
||||
}, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public ActionResult SearchForSeries(string seriesName)
|
||||
{
|
||||
var model = new List<SeriesSearchResultModel>();
|
||||
|
@ -206,25 +194,22 @@ namespace NzbDrone.Web.Controllers
|
|||
|
||||
private List<SeriesModel> GetSeriesModels(List<Series> seriesInDb)
|
||||
{
|
||||
var series = new List<SeriesModel>();
|
||||
|
||||
foreach (var s in seriesInDb)
|
||||
{
|
||||
series.Add(new SeriesModel
|
||||
{
|
||||
SeriesId = s.SeriesId,
|
||||
Title = s.Title,
|
||||
AirsDayOfWeek = s.AirsDayOfWeek.ToString(),
|
||||
Monitored = s.Monitored,
|
||||
Overview = s.Overview,
|
||||
Path = s.Path,
|
||||
QualityProfileId = s.QualityProfileId,
|
||||
QualityProfileName = s.QualityProfile.Name,
|
||||
SeasonFolder = s.SeasonFolder,
|
||||
Status = s.Status,
|
||||
SeasonsCount = _episodeProvider.GetSeasons(s.SeriesId).Where(n => n != 0).Count()
|
||||
});
|
||||
}
|
||||
var series = seriesInDb.Select(s => new SeriesModel
|
||||
{
|
||||
SeriesId = s.SeriesId,
|
||||
Title = s.Title,
|
||||
AirsDayOfWeek = s.AirsDayOfWeek.ToString(),
|
||||
Monitored = s.Monitored,
|
||||
Overview = s.Overview,
|
||||
Path = s.Path,
|
||||
QualityProfileId = s.QualityProfileId,
|
||||
QualityProfileName = s.QualityProfile.Name,
|
||||
SeasonFolder = s.SeasonFolder,
|
||||
Status = s.Status,
|
||||
SeasonsCount = s.SeasonCount,
|
||||
EpisodeCount = s.EpisodeCount,
|
||||
EpisodeFileCount = s.EpisodeFileCount
|
||||
}).ToList();
|
||||
|
||||
return series;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue