1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-25 17:17:02 +00:00

Using .ToList() to get around IEnumerable multi-DB calls and possible SubSonic bug with IQueryable.

This commit is contained in:
Mark McDowall 2011-06-14 16:39:09 -07:00
parent c8ae3de292
commit 1fbf9a1416

View file

@ -205,12 +205,12 @@ public virtual IEnumerable<EpisodeFile> GetSeriesFiles(int seriesId)
public virtual Tuple<int, int> GetEpisodeFilesCount(int seriesId)
{
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId);
var allEpisodes = _episodeProvider.GetEpisodeBySeries(seriesId).ToList();
var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900);
var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0);
var episodeTotal = allEpisodes.Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).ToList();
var avilableEpisodes = episodeTotal.Where(e => e.EpisodeFileId > 0).ToList();
return new Tuple<int, int>(avilableEpisodes.Count(), episodeTotal.Count());
return new Tuple<int, int>(avilableEpisodes.Count, episodeTotal.Count);
}
private List<string> GetMediaFileList(string path)