Fixed: Incorrectly grabbing revision downgrades (#6194)

pull/6225/head
Robin Dadswell 4 years ago committed by GitHub
parent 7807e2e13a
commit ce6f52552a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -87,5 +87,13 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
_parseResultSingle.ParsedMovieInfo.Quality = new QualityModel(Quality.WEBDL1080p);
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
}
[Test]
public void should_not_be_upgradable_if_revision_downgrade_if_propers_are_preferred()
{
_firstFile.Quality = new QualityModel(Quality.WEBDL1080p, new Revision(2));
_parseResultSingle.ParsedMovieInfo.Quality = new QualityModel(Quality.WEBDL1080p);
_upgradeDisk.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
}
}
}

@ -32,6 +32,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
var qualityComparer = new QualityModelComparer(profile);
var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality);
var downloadPropersAndRepacks = _configService.DownloadPropersAndRepacks;
if (qualityCompare > 0)
{
@ -45,10 +46,12 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
return false;
}
var qualityRevisionCompare = newQuality?.Revision.CompareTo(currentQuality.Revision);
// Accept unless the user doesn't want to prefer propers, optionally they can
// use preferred words to prefer propers/repacks over non-propers/repacks.
if (_configService.DownloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
newQuality?.Revision.CompareTo(currentQuality.Revision) > 0)
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionCompare > 0)
{
return true;
}
@ -56,6 +59,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
var currentFormatScore = profile.CalculateCustomFormatScore(currentCustomFormats);
var newFormatScore = profile.CalculateCustomFormatScore(newCustomFormats);
// Reject unless the user does not prefer propers/repacks and it's a revision downgrade.
if (downloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
qualityRevisionCompare < 0)
{
_logger.Debug("Existing item has a better quality revision, skipping");
return false;
}
if (newFormatScore <= currentFormatScore)
{
_logger.Debug("New item's custom formats [{0}] do not improve on [{1}], skipping",

Loading…
Cancel
Save