Missing will not include series and episodes that are not monitored

pull/4/head
Mark McDowall 12 years ago
parent 8388e0a77c
commit 92bab993ae

@ -16,6 +16,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
var series = Builder<Series>.CreateNew()
.With(s => s.Id = 0)
.With(s => s.Runtime = 30)
.With(s => s.Monitored = true)
.Build();
series.Id = Db.Insert(series).Id;

@ -49,6 +49,7 @@ namespace NzbDrone.Core.Datastore
Mapper.Entity<Episode>().RegisterModel("Episodes")
.Ignore(e => e.SeriesTitle)
.Ignore(e => e.Series)
.Ignore(e => e.HasFile)
.Relationship()
.HasOne(episode => episode.EpisodeFile, episode => episode.EpisodeFileId);

@ -25,6 +25,8 @@ namespace NzbDrone.Core.Tv
public String SeriesTitle { get; private set; }
public LazyLoaded<EpisodeFile> EpisodeFile { get; set; }
public Series Series { get; set; }
public Boolean HasFile
{

@ -84,9 +84,12 @@ namespace NzbDrone.Core.Tv
startingSeasonNumber = 0;
}
var pagingQuery = Query.Where(e => e.EpisodeFileId == 0)
var pagingQuery = Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
.Where(e => e.EpisodeFileId == 0)
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
.AndWhere(e => e.AirDate <= currentTime)
.AndWhere(e => e.Monitored)
.AndWhere(e => e.Series.Monitored)
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
.Skip(pagingSpec.PagingOffset())
.Take(pagingSpec.PageSize);

Loading…
Cancel
Save