From b6ffe935e86aa7eaecb4a6489e4dedf32dcf3d8b Mon Sep 17 00:00:00 2001 From: Bogdan Date: Wed, 3 Jan 2024 22:38:24 +0200 Subject: [PATCH] Fixed: Don't monitor last season if series is ended --- .../SetEpisodeMontitoredFixture.cs | 16 ++++++++++++++++ src/NzbDrone.Core/Tv/EpisodeMonitoredService.cs | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeMonitoredServiceTests/SetEpisodeMontitoredFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeMonitoredServiceTests/SetEpisodeMontitoredFixture.cs index 23d43095a..c488a8c39 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeMonitoredServiceTests/SetEpisodeMontitoredFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeMonitoredServiceTests/SetEpisodeMontitoredFixture.cs @@ -313,6 +313,22 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeMonitoredServiceTests .Verify(v => v.UpdateEpisodes(It.Is>(l => l.All(e => !e.Monitored)))); } + [Test] + public void should_not_monitor_last_season_for_future_episodes_if_all_episodes_already_aired() + { + _episodes.ForEach(e => e.AirDateUtc = DateTime.UtcNow.AddDays(-7)); + + var monitoringOptions = new MonitoringOptions + { + Monitor = MonitorTypes.Future + }; + + Subject.SetEpisodeMonitoredStatus(_series, monitoringOptions); + + VerifySeasonNotMonitored(n => n.SeasonNumber > 0); + VerifyNotMonitored(n => n.SeasonNumber > 0); + } + [Test] public void should_monitor_any_recent_and_future_episodes_if_all_episodes_aired_within_90_days() { diff --git a/src/NzbDrone.Core/Tv/EpisodeMonitoredService.cs b/src/NzbDrone.Core/Tv/EpisodeMonitoredService.cs index 41cdbcfc2..3f2acf9bf 100644 --- a/src/NzbDrone.Core/Tv/EpisodeMonitoredService.cs +++ b/src/NzbDrone.Core/Tv/EpisodeMonitoredService.cs @@ -135,11 +135,12 @@ namespace NzbDrone.Core.Tv // Monitor the last season when: // - Not specials // - The latest season - // - Set to monitor all or future episodes + // - Set to monitor all episodes + // - Set to monitor future episodes and series is continuing or not yet aired if (seasonNumber > 0 && seasonNumber == lastSeason && (monitoringOptions.Monitor == MonitorTypes.All || - monitoringOptions.Monitor == MonitorTypes.Future)) + (monitoringOptions.Monitor == MonitorTypes.Future && series.Status is SeriesStatusType.Continuing or SeriesStatusType.Upcoming))) { season.Monitored = true; }