From 79cd2b2346cc8931a140d9091218f99e974cf882 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 23 May 2022 20:52:27 -0700 Subject: [PATCH] Fixed: Cutoff Unmet showing items above lowest accepted quality when upgrades are disabled (cherry picked from commit c1e5b7f642d03414f7c5587d4db377ef979f2067) Fixes #7301 Fixes #7305 --- src/NzbDrone.Core/Movies/MovieCutoffService.cs | 3 ++- .../IntegrationTestBase.cs | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Movies/MovieCutoffService.cs b/src/NzbDrone.Core/Movies/MovieCutoffService.cs index 65fd9d362..1258b198d 100644 --- a/src/NzbDrone.Core/Movies/MovieCutoffService.cs +++ b/src/NzbDrone.Core/Movies/MovieCutoffService.cs @@ -31,7 +31,8 @@ namespace NzbDrone.Core.Movies //Get all items less than the cutoff foreach (var profile in profiles) { - var cutoffIndex = profile.GetIndex(profile.Cutoff); + var cutoff = profile.UpgradeAllowed ? profile.Cutoff : profile.FirststAllowedQuality().Id; + var cutoffIndex = profile.GetIndex(cutoff); var belowCutoff = profile.Items.Take(cutoffIndex.Index).ToList(); if (belowCutoff.Any()) diff --git a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs index 0ab73e5bf..d7b6eb6a7 100644 --- a/src/NzbDrone.Integration.Test/IntegrationTestBase.cs +++ b/src/NzbDrone.Integration.Test/IntegrationTestBase.cs @@ -303,13 +303,25 @@ namespace NzbDrone.Integration.Test return result.MovieFile; } - public QualityProfileResource EnsureProfileCutoff(int profileId, Quality cutoff) + public QualityProfileResource EnsureProfileCutoff(int profileId, Quality cutoff, bool upgradeAllowed) { + var needsUpdate = false; var profile = Profiles.Get(profileId); if (profile.Cutoff != cutoff.Id) { profile.Cutoff = cutoff.Id; + needsUpdate = true; + } + + if (profile.UpgradeAllowed != upgradeAllowed) + { + profile.UpgradeAllowed = upgradeAllowed; + needsUpdate = true; + } + + if (needsUpdate) + { profile = Profiles.Put(profile); }