Fixed: Delay profile being ignored for non-revision upgrades

Signed-off-by: Robin Dadswell <robin@dadswell.email>
pull/770/head
Qstick 4 years ago
parent e30c078962
commit 17b5187729

@ -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;

@ -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();

Loading…
Cancel
Save