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
1 changed files with 4 additions and 4 deletions

View File

@ -205,12 +205,12 @@ namespace NzbDrone.Core.Providers
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)