mirror of
https://github.com/Radarr/Radarr
synced 2024-12-22 07:52:34 +00:00
Fixed: Custom Format upgrading not respecting 'Upgrades Allowed'
(cherry picked from commit 91c5e6f12292e522ceb9094825525fb3684b97c6) Closes #10691
This commit is contained in:
parent
1526bf29f4
commit
a626b4f3c4
2 changed files with 37 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.CustomFormats;
|
||||
|
@ -303,5 +304,38 @@ public void should_return_false_if_quality_profile_does_not_allow_upgrades_but_c
|
|||
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_quality_profile_does_not_allow_upgrades_but_format_cutoff_is_above_current_score()
|
||||
{
|
||||
var customFormat = new CustomFormat("My Format", new ResolutionSpecification { Value = (int)Resolution.R1080p }) { Id = 1 };
|
||||
|
||||
GivenProfile(new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.SDTV.Id,
|
||||
MinFormatScore = 0,
|
||||
CutoffFormatScore = 10000,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
FormatItems = CustomFormatsTestHelpers.GetSampleFormatItems("My Format"),
|
||||
UpgradeAllowed = false
|
||||
});
|
||||
|
||||
_parseResultSingle.Series.QualityProfile.Value.FormatItems = new List<ProfileFormatItem>
|
||||
{
|
||||
new ProfileFormatItem
|
||||
{
|
||||
Format = customFormat,
|
||||
Score = 50
|
||||
}
|
||||
};
|
||||
|
||||
GivenFileQuality(new QualityModel(Quality.WEBDL1080p));
|
||||
GivenNewQuality(new QualityModel(Quality.WEBDL1080p));
|
||||
|
||||
GivenOldCustomFormats(new List<CustomFormat>());
|
||||
GivenNewCustomFormats(new List<CustomFormat> { customFormat });
|
||||
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,9 @@ public bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQual
|
|||
private bool CustomFormatCutoffNotMet(QualityProfile profile, List<CustomFormat> currentFormats)
|
||||
{
|
||||
var score = profile.CalculateCustomFormatScore(currentFormats);
|
||||
return score < profile.CutoffFormatScore;
|
||||
var cutoff = profile.UpgradeAllowed ? profile.CutoffFormatScore : profile.MinFormatScore;
|
||||
|
||||
return score < cutoff;
|
||||
}
|
||||
|
||||
public bool CutoffNotMet(QualityProfile profile, QualityModel currentQuality, List<CustomFormat> currentFormats, QualityModel newQuality = null)
|
||||
|
|
Loading…
Reference in a new issue