diff --git a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs index 5e7e9b8a4..c768906d2 100644 --- a/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/DecisionEngineTests/RssSync/DelaySpecificationFixture.cs @@ -185,10 +185,17 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync [Test] public void should_be_false_when_release_is_proper_for_existing_album_of_different_quality() { +<<<<<<< HEAD _remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2)); _remoteBook.Release.PublishDate = DateTime.UtcNow; GivenExistingFile(new QualityModel(Quality.PDF)); +======= + _remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)); + _remoteAlbum.Release.PublishDate = DateTime.UtcNow; + + GivenExistingFile(new QualityModel(Quality.MP3_256)); +>>>>>>> Fixed: Delay profile being ignored for non-revision upgrades _delayProfile.UsenetDelay = 720; diff --git a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/DelaySpecification.cs b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/DelaySpecification.cs index c1e965383..2e7761485 100644 --- a/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/DelaySpecification.cs +++ b/src/NzbDrone.Core/DecisionEngine/Specifications/RssSync/DelaySpecification.cs @@ -64,16 +64,13 @@ namespace NzbDrone.Core.DecisionEngine.Specifications.RssSync { var bookFiles = _mediaFileService.GetFilesByBook(book.Id); - if (bookFiles.Any()) + foreach (var file in bookFiles) { - var currentQualities = bookFiles.Select(c => c.Quality).Distinct().ToList(); - - var upgradable = _upgradableSpecification.IsUpgradable(qualityProfile, - currentQualities, - _preferredWordServiceCalculator.Calculate(subject.Author, bookFiles[0].GetSceneOrFileName()), - subject.ParsedBookInfo.Quality, - subject.PreferredWordScore); - if (upgradable) + var currentQuality = file.Quality; + var newQuality = subject.ParsedBookInfo.Quality; + var qualityCompare = qualityComparer.Compare(newQuality?.Quality, currentQuality.Quality); + + if (qualityCompare == 0 && newQuality?.Revision.CompareTo(currentQuality.Revision) > 0) { _logger.Debug("New quality is a better revision for existing quality, skipping delay"); return Decision.Accept();