mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 01:38:24 +00:00
Fixed a big where Season 0 wasn't being ignored for new seasons + a test to confirm it.
This commit is contained in:
parent
bae2cdc1c7
commit
fbc0a561ca
2 changed files with 45 additions and 4 deletions
|
@ -414,6 +414,46 @@ public void RefreshEpisodeInfo_ignore_episode_zero()
|
|||
result.Where(e => e.EpisodeNumber == 0 && e.SeasonNumber == 15).Single().Ignored.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RefreshEpisodeInfo_ignore_season_zero()
|
||||
{
|
||||
//Arrange
|
||||
const int seriesId = 71663;
|
||||
const int episodeCount = 10;
|
||||
|
||||
var fakeEpisodes = Builder<TvdbSeries>.CreateNew().With(
|
||||
c => c.Episodes =
|
||||
new List<TvdbEpisode>(Builder<TvdbEpisode>.CreateListOfSize(episodeCount).
|
||||
All()
|
||||
.With(l => l.Language = new TvdbLanguage(0, "eng", "a"))
|
||||
.With(e => e.SeasonNumber = 0)
|
||||
.Build())
|
||||
).With(c => c.Id = seriesId).Build();
|
||||
|
||||
var fakeSeries = Builder<Series>.CreateNew().With(c => c.SeriesId = seriesId).Build();
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
var db = TestDbHelper.GetEmptyDatabase();
|
||||
mocker.SetConstant(db);
|
||||
|
||||
db.Insert(fakeSeries);
|
||||
|
||||
mocker.GetMock<TvDbProvider>()
|
||||
.Setup(c => c.GetSeries(seriesId, true))
|
||||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
mocker.Resolve<EpisodeProvider>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
var result = mocker.Resolve<EpisodeProvider>().GetEpisodeBySeries(seriesId).ToList();
|
||||
mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
result.Should().HaveCount(episodeCount);
|
||||
result.Where(e => e.Ignored).Should().HaveCount(episodeCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void new_episodes_only_calls_Insert()
|
||||
{
|
||||
|
|
|
@ -278,12 +278,13 @@ public virtual void RefreshEpisodeInfo(Series series)
|
|||
episodeToUpdate = new Episode();
|
||||
newList.Add(episodeToUpdate);
|
||||
|
||||
//We need to check if this episode should be ignored based on IsIgnored rules
|
||||
IsIgnored(series.SeriesId, episode.SeasonNumber);
|
||||
|
||||
//If it is Episode Zero Ignore it, since it is new
|
||||
if (episode.EpisodeNumber == 0)
|
||||
episodeToUpdate.Ignored = true;
|
||||
|
||||
//Else we need to check if this episode should be ignored based on IsIgnored rules
|
||||
else
|
||||
episodeToUpdate.Ignored = IsIgnored(series.SeriesId, episode.SeasonNumber);
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -436,7 +437,7 @@ public virtual void DeleteInvalidEpisodes(Series series, TvdbSeries tvDbSeriesIn
|
|||
var tvDbIdQuery = String.Format("DELETE FROM Episodes WHERE SeriesId = {0} AND TvDbEpisodeId > 0 AND TvDbEpisodeId NOT IN ({1})",
|
||||
series.SeriesId, tvDbIdString);
|
||||
|
||||
Logger.Trace("Deleting nivalid episodes by TvDbId for {0}", series.SeriesId);
|
||||
Logger.Trace("Deleting invalid episodes by TvDbId for {0}", series.SeriesId);
|
||||
_database.Execute(tvDbIdQuery);
|
||||
|
||||
Logger.Trace("Finished deleting invalid episodes for {0}", series.SeriesId);
|
||||
|
|
Loading…
Reference in a new issue