1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Missing will not include series and episodes that are not monitored

This commit is contained in:
Mark McDowall 2013-07-15 14:53:35 -07:00
parent 8388e0a77c
commit 92bab993ae
4 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@ public void Setup()
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;

View File

@ -49,6 +49,7 @@ public static void Map()
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);

View File

@ -25,6 +25,8 @@ public class Episode : ModelBase
public String SeriesTitle { get; private set; }
public LazyLoaded<EpisodeFile> EpisodeFile { get; set; }
public Series Series { get; set; }
public Boolean HasFile
{

View File

@ -84,9 +84,12 @@ public PagingSpec<Episode> EpisodesWithoutFiles(PagingSpec<Episode> pagingSpec,
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);