|
|
@ -75,14 +75,15 @@ namespace NzbDrone.Core.Tv
|
|
|
|
startingSeasonNumber = 0;
|
|
|
|
startingSeasonNumber = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pagingSpec.Records = Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
|
|
|
var pagingQuery = Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
|
|
|
.Where(e => e.EpisodeFileId == 0)
|
|
|
|
.Where(e => e.EpisodeFileId == 0)
|
|
|
|
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
|
|
|
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
|
|
|
.AndWhere(e => e.AirDate <= currentTime)
|
|
|
|
.AndWhere(e => e.AirDate <= currentTime)
|
|
|
|
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
|
|
|
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
|
|
|
.Skip(pagingSpec.PagingOffset())
|
|
|
|
.Skip(pagingSpec.PagingOffset())
|
|
|
|
.Take(pagingSpec.PageSize)
|
|
|
|
.Take(pagingSpec.PageSize);
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
pagingSpec.Records = pagingQuery.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: Use the same query for count and records
|
|
|
|
//TODO: Use the same query for count and records
|
|
|
|
pagingSpec.TotalRecords = Query.Where(e => e.EpisodeFileId == 0 && e.SeasonNumber >= startingSeasonNumber && e.AirDate <= currentTime).Count();
|
|
|
|
pagingSpec.TotalRecords = Query.Where(e => e.EpisodeFileId == 0 && e.SeasonNumber >= startingSeasonNumber && e.AirDate <= currentTime).Count();
|
|
|
|