1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-22 18:52:50 +01:00

Fixed: New episodes in season follow season's monitored status

Closes #7401
This commit is contained in:
Mark McDowall 2024-11-21 17:08:50 -08:00
parent ca0bb14027
commit 779644c77b
2 changed files with 61 additions and 1 deletions

View File

@ -396,5 +396,65 @@ namespace NzbDrone.Core.Test.TvTests
_insertedEpisodes.Any(e => e.AbsoluteEpisodeNumberAdded).Should().BeFalse();
}
[Test]
public void should_monitor_new_episode_if_season_is_monitored()
{
var series = GetSeries();
series.Seasons = new List<Season>();
series.Seasons.Add(new Season { SeasonNumber = 1, Monitored = true });
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.SeasonNumber = 1)
.Build()
.ToList();
var existingEpisode = new Episode
{
SeasonNumber = episodes[0].SeasonNumber,
EpisodeNumber = episodes[0].EpisodeNumber,
Monitored = true
};
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodeBySeries(It.IsAny<int>()))
.Returns(new List<Episode> { existingEpisode });
Subject.RefreshEpisodeInfo(series, episodes);
_updatedEpisodes.Should().HaveCount(1);
_insertedEpisodes.Should().HaveCount(1);
_insertedEpisodes.Should().OnlyContain(e => e.Monitored == true);
}
[Test]
public void should_not_monitor_new_episode_if_season_is_not_monitored()
{
var series = GetSeries();
series.Seasons = new List<Season>();
series.Seasons.Add(new Season { SeasonNumber = 1, Monitored = false });
var episodes = Builder<Episode>.CreateListOfSize(2)
.All()
.With(e => e.SeasonNumber = 1)
.Build()
.ToList();
var existingEpisode = new Episode
{
SeasonNumber = episodes[0].SeasonNumber,
EpisodeNumber = episodes[0].EpisodeNumber,
Monitored = true
};
Mocker.GetMock<IEpisodeService>().Setup(c => c.GetEpisodeBySeries(It.IsAny<int>()))
.Returns(new List<Episode> { existingEpisode });
Subject.RefreshEpisodeInfo(series, episodes);
_updatedEpisodes.Should().HaveCount(1);
_insertedEpisodes.Should().HaveCount(1);
_insertedEpisodes.Should().OnlyContain(e => e.Monitored == false);
}
}
}

View File

@ -145,7 +145,7 @@ namespace NzbDrone.Core.Tv
private bool GetMonitoredStatus(Episode episode, IEnumerable<Season> seasons, Series series)
{
if ((episode.EpisodeNumber == 0 && episode.SeasonNumber != 1) || series.MonitorNewItems == NewItemMonitorTypes.None)
if (episode.EpisodeNumber == 0 && episode.SeasonNumber != 1)
{
return false;
}