Fixed: Repack don't being grabbed when cutoff already met

Fixes #3250
This commit is contained in:
Mark McDowall 2019-08-06 18:34:23 -07:00
parent dc7b4cebf2
commit 72fa89ba76
3 changed files with 29 additions and 4 deletions

View File

@ -260,5 +260,30 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
new QualityModel(Quality.Bluray1080p, new Revision(version: 2)),
10).Should().BeTrue();
}
[Test]
public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
{
QualityProfile _profile = new QualityProfile
{
Cutoff = Quality.HDTV1080p.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
};
LanguageProfile _langProfile = new LanguageProfile
{
Cutoff = Language.English,
Languages = LanguageFixture.GetDefaultLanguages()
};
Subject.CutoffNotMet(
_profile,
_langProfile,
new QualityModel(Quality.WEBDL1080p, new Revision(version: 1)),
Language.English,
NoPreferredWordScore,
new QualityModel(Quality.WEBDL1080p, new Revision(version: 2)),
NoPreferredWordScore).Should().BeTrue();
}
}
}

View File

@ -38,7 +38,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
_logger.Debug("Comparing file quality and language with report. Existing file is {0} - {1}", file.Quality, file.Language);
if (!_upgradableSpecification.CutoffNotMet(qualityProfile,
languageProfile,
languageProfile,
file.Quality,
file.Language,
_preferredWordServiceCalculator.Calculate(subject.Series, file.GetSceneOrFileName()),

View File

@ -87,14 +87,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
public bool QualityCutoffNotMet(QualityProfile profile, QualityModel currentQuality, QualityModel newQuality = null)
{
var qualityCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, profile.Cutoff);
var cutoffCompare = new QualityModelComparer(profile).Compare(currentQuality.Quality.Id, profile.Cutoff);
if (qualityCompare < 0)
if (cutoffCompare < 0)
{
return true;
}
if (qualityCompare == 0 && newQuality != null && IsRevisionUpgrade(currentQuality, newQuality))
if (newQuality != null && IsRevisionUpgrade(currentQuality, newQuality))
{
return true;
}