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 @@ public PagingSpec MoviesWhereCutoffUnmet(PagingSpec pagingSpec) //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 @@ public MovieFileResource EnsureMovieFile(MovieResource movie, Quality quality) 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); }