New: Don't search for unaired anime episodes when searching for season

Closes #2530
This commit is contained in:
Mark McDowall 2019-04-27 19:13:27 -07:00
parent 8143237d25
commit 2ee0ae1f9e
2 changed files with 20 additions and 1 deletions

View File

@ -246,6 +246,24 @@ namespace NzbDrone.Core.Test.IndexerSearchTests
criteria.Count.Should().Be(0);
}
[Test]
public void season_search_for_anime_should_not_search_for_unaired_episodes()
{
WithEpisodes();
_xemSeries.SeriesType = SeriesTypes.Anime;
_xemEpisodes.ForEach(e => e.AirDateUtc = DateTime.UtcNow.AddDays(5));
_xemEpisodes.ForEach(e => e.EpisodeFileId = 0);
var seasonNumber = 1;
var allCriteria = WatchForSearchCriteria();
Subject.SeasonSearch(_xemSeries.Id, seasonNumber, false, true, false);
var criteria = allCriteria.OfType<AnimeEpisodeSearchCriteria>().ToList();
criteria.Count.Should().Be(0);
}
[Test]
public void season_search_for_anime_should_not_search_for_episodes_with_files()
{

View File

@ -229,7 +229,8 @@ namespace NzbDrone.Core.IndexerSearch
{
var downloadDecisions = new List<DownloadDecision>();
foreach (var episode in episodes.Where(e => e.Monitored))
// Only search for aired episodes when performing a season anime search
foreach (var episode in episodes.Where(e => e.Monitored && e.AirDateUtc.HasValue && e.AirDateUtc.Value.Before(DateTime.UtcNow)))
{
downloadDecisions.AddRange(SearchAnime(series, episode, userInvokedSearch, interactiveSearch));
}