mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 10:32:35 +01:00
History view will no longer hit the DB with the same request so many times.
This commit is contained in:
parent
e934e71b3b
commit
3572855c34
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using NzbDrone.Core.Model;
|
using NzbDrone.Core.Model;
|
||||||
@ -44,20 +45,30 @@ public ActionResult _AjaxBinding()
|
|||||||
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
|
//TODO: possible subsonic bug, IQuarible causes some issues so ToList() is called
|
||||||
//https://github.com/subsonic/SubSonic-3.0/issues/263
|
//https://github.com/subsonic/SubSonic-3.0/issues/263
|
||||||
|
|
||||||
var history = _historyProvider.AllItems().ToList().Select(h => new HistoryModel
|
var historyDb = _historyProvider.AllItems().ToList();
|
||||||
{
|
|
||||||
HistoryId = h.HistoryId,
|
var history = new List<HistoryModel>();
|
||||||
SeasonNumber = h.Episode.SeasonNumber,
|
|
||||||
EpisodeNumber = h.Episode.EpisodeNumber,
|
foreach (var item in historyDb)
|
||||||
EpisodeTitle = h.Episode.Title,
|
{
|
||||||
EpisodeOverview = h.Episode.Overview,
|
var episode = item.Episode;
|
||||||
SeriesTitle = h.Episode.Series.Title,
|
var series = episode.Series;
|
||||||
NzbTitle = h.NzbTitle,
|
|
||||||
Quality = h.Quality.ToString(),
|
history.Add(new HistoryModel
|
||||||
IsProper = h.IsProper,
|
{
|
||||||
Date = h.Date,
|
HistoryId = item.HistoryId,
|
||||||
Indexer = h.Indexer
|
SeasonNumber = episode.SeasonNumber,
|
||||||
});
|
EpisodeNumber = episode.EpisodeNumber,
|
||||||
|
EpisodeTitle = episode.Title,
|
||||||
|
EpisodeOverview = episode.Overview,
|
||||||
|
SeriesTitle = series.Title,
|
||||||
|
NzbTitle = item.NzbTitle,
|
||||||
|
Quality = item.Quality.ToString(),
|
||||||
|
IsProper = item.IsProper,
|
||||||
|
Date = item.Date,
|
||||||
|
Indexer = item.Indexer
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return View(new GridModel(history));
|
return View(new GridModel(history));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user