1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-20 01:42:35 +01:00

Fixed: Don't reject revision upgrades if profile doesn't allow upgrades

(cherry picked from commit 4f0e1c54c167f5123a33d19b76653450401adb6d)
This commit is contained in:
Mark McDowall 2024-09-27 16:42:39 -07:00 committed by Bogdan
parent 5893d88058
commit e33e45ec73
2 changed files with 20 additions and 0 deletions

View File

@ -206,5 +206,19 @@ public void should_return_true_for_lower_quality_when_upgrading_is_not_allowed()
new List<CustomFormat>()) new List<CustomFormat>())
.Should().BeTrue(); .Should().BeTrue();
} }
[Test]
public void should_returntrue_when_quality_is_revision_upgrade_for_same_quality()
{
_qualityProfile.UpgradeAllowed = false;
Subject.IsUpgradeAllowed(
_qualityProfile,
new QualityModel(Quality.DVD, new Revision(1)),
new List<CustomFormat> { _customFormatOne },
new QualityModel(Quality.DVD, new Revision(2)),
new List<CustomFormat> { _customFormatOne })
.Should().BeTrue();
}
} }
} }

View File

@ -177,6 +177,12 @@ public bool IsUpgradeAllowed(QualityProfile qualityProfile, QualityModel current
var isQualityUpgrade = new QualityModelComparer(qualityProfile).Compare(newQuality, currentQuality) > 0; var isQualityUpgrade = new QualityModelComparer(qualityProfile).Compare(newQuality, currentQuality) > 0;
var isCustomFormatUpgrade = qualityProfile.CalculateCustomFormatScore(newCustomFormats) > qualityProfile.CalculateCustomFormatScore(currentCustomFormats); var isCustomFormatUpgrade = qualityProfile.CalculateCustomFormatScore(newCustomFormats) > qualityProfile.CalculateCustomFormatScore(currentCustomFormats);
if (IsRevisionUpgrade(currentQuality, newQuality))
{
_logger.Debug("New quality '{0}' is a revision upgrade for '{1}'", newQuality, currentQuality);
return true;
}
if ((isQualityUpgrade || isCustomFormatUpgrade) && qualityProfile.UpgradeAllowed) if ((isQualityUpgrade || isCustomFormatUpgrade) && qualityProfile.UpgradeAllowed)
{ {
_logger.Debug("Quality profile allows upgrading"); _logger.Debug("Quality profile allows upgrading");