New: Improve logging when checking if release is an upgrade for an existing file
This commit is contained in:
parent
0f8dee7011
commit
093ed23140
|
@ -164,5 +164,31 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
NoPreferredWordScore)
|
||||
.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_release_and_existing_file_are_the_same()
|
||||
{
|
||||
var profile = new QualityProfile
|
||||
{
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
};
|
||||
|
||||
var langProfile = new LanguageProfile
|
||||
{
|
||||
Languages = LanguageFixture.GetDefaultLanguages(),
|
||||
Cutoff = Language.English
|
||||
};
|
||||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
langProfile,
|
||||
new QualityModel(Quality.HDTV720p, new Revision(version: 1)),
|
||||
Language.English,
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.HDTV720p, new Revision(version: 1)),
|
||||
Language.English,
|
||||
NoPreferredWordScore)
|
||||
.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
|
||||
private bool IsPreferredWordUpgradable(int currentScore, int newScore)
|
||||
{
|
||||
_logger.Debug("Comparing preferred word score. Current: {0} New: {1}", currentScore, newScore);
|
||||
|
||||
return newScore > currentScore;
|
||||
}
|
||||
|
||||
|
@ -40,6 +42,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
|
||||
if (qualityCompare > 0)
|
||||
{
|
||||
_logger.Debug("New item has a better quality");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -54,6 +57,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
if (_configService.DownloadPropersAndRepacks != ProperDownloadTypes.DoNotPrefer &&
|
||||
newQuality?.Revision.CompareTo(currentQuality.Revision) > 0)
|
||||
{
|
||||
_logger.Debug("New item has a better quality revision");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -61,6 +65,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
|
||||
if (languageCompare > 0)
|
||||
{
|
||||
_logger.Debug("New item has a more preferred language");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -69,13 +74,14 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
|
|||
_logger.Debug("Existing item has better language, skipping");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!IsPreferredWordUpgradable(currentScore, newScore))
|
||||
{
|
||||
_logger.Debug("Existing item has a better preferred word score, skipping");
|
||||
return false;
|
||||
}
|
||||
|
||||
_logger.Debug("New item has a better preferred word score");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue