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

Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
pull/900/head
Qstick 5 years ago
parent a7e94a0b2a
commit 0496e6afc2

@ -101,5 +101,23 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
new QualityModel(Quality.FLAC, 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.MP3_320.Id,
Items = Qualities.QualityFixture.GetDefaultQualities(),
};
Subject.CutoffNotMet(
_profile,
new List<QualityModel> { new QualityModel(Quality.FLAC, new Revision(version: 1)) },
NoPreferredWordScore,
new QualityModel(Quality.FLAC, new Revision(version: 2)),
NoPreferredWordScore).Should().BeTrue();
}
}
}

@ -94,14 +94,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;
}

Loading…
Cancel
Save