1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Fixed: Profiles with upgrades disabled incorrectly allowing upgrades in some cases

Closes #4898
This commit is contained in:
Mark McDowall
2022-02-16 17:55:14 -08:00
parent b3d90d903a
commit 210768d7d6
4 changed files with 126 additions and 24 deletions
@@ -98,7 +98,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
{
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, profile.Cutoff);
var cutoff = profile.UpgradeAllowed ? profile.Cutoff : profile.FirststAllowedQuality().Id;
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, cutoff);
if (cutoffCompare < 0)
{
@@ -115,7 +116,11 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public bool LanguageCutoffNotMet(LanguageProfile languageProfile, Language currentLanguage)
{
var languageCompare = new LanguageComparer(languageProfile).Compare(currentLanguage, languageProfile.Cutoff);
var cutoff = languageProfile.UpgradeAllowed
? languageProfile.Cutoff
: languageProfile.FirstAllowedLanguage();
var languageCompare = new LanguageComparer(languageProfile).Compare(currentLanguage, cutoff);
return languageCompare < 0;
}