Fixed series grid after save so it has proper counts.

pull/2/head
Mark McDowall 14 years ago
parent 56fdf1a040
commit 3a065b86f1

@ -42,11 +42,11 @@ namespace NzbDrone.Core.Providers
return series; return series;
} }
public virtual IList<Series> GetAllSeriesWithEpisodeCount(bool ignoreSpecials) public virtual IList<Series> GetAllSeriesWithEpisodeCount(bool ignoreSpecialsInSeasonCount)
{ {
var seasonNumber = 0; var seasonNumber = 0;
if (!ignoreSpecials) if (!ignoreSpecialsInSeasonCount)
seasonNumber = -1; seasonNumber = -1;
var series = _database.Fetch<Series, QualityProfile>(@"SELECT Series.*, COUNT (NULLIF(Ignored, 1)) AS EpisodeCount, var series = _database.Fetch<Series, QualityProfile>(@"SELECT Series.*, COUNT (NULLIF(Ignored, 1)) AS EpisodeCount,

@ -80,7 +80,7 @@ namespace NzbDrone.Web.Controllers
[GridAction] [GridAction]
public ActionResult _AjaxSeriesGrid() public ActionResult _AjaxSeriesGrid()
{ {
var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount(true).ToList()); var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount(true));
return View(new GridModel(series)); return View(new GridModel(series));
} }
@ -96,7 +96,7 @@ namespace NzbDrone.Web.Controllers
_seriesProvider.UpdateSeries(oldSeries); _seriesProvider.UpdateSeries(oldSeries);
var series = GetSeriesModels(_seriesProvider.GetAllSeries().ToList()); var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount(true));
return View(new GridModel(series)); return View(new GridModel(series));
} }
@ -192,7 +192,7 @@ namespace NzbDrone.Web.Controllers
return RedirectToAction("Details", new { seriesId }); return RedirectToAction("Details", new { seriesId });
} }
private List<SeriesModel> GetSeriesModels(List<Series> seriesInDb) private List<SeriesModel> GetSeriesModels(IList<Series> seriesInDb)
{ {
var series = seriesInDb.Select(s => new SeriesModel var series = seriesInDb.Select(s => new SeriesModel
{ {

Loading…
Cancel
Save