Allow Discography to be grabbed automatically if all albums will be released within 24 hours

(cherry picked from commit 87795708b5caf63e63570cb62c6043a781ee89ae)

Closes #3181
pull/4546/head
Mark McDowall 2 years ago committed by Bogdan
parent abefdca0fc
commit 2f0d02b3bc

@ -57,6 +57,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
}
[Test]
public void should_return_true_if_all_albums_will_have_released_in_the_next_24_hours()
{
_remoteAlbum.Albums.Last().ReleaseDate = DateTime.UtcNow.AddHours(23);
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
}
[Test]
public void should_return_false_if_one_album_has_not_released()
{

@ -25,7 +25,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{
_logger.Debug("Checking if all albums in discography release have released. {0}", subject.Release.Title);
if (subject.Albums.Any(e => !e.ReleaseDate.HasValue || e.ReleaseDate.Value.After(DateTime.UtcNow)))
if (subject.Albums.Any(e => !e.ReleaseDate.HasValue || e.ReleaseDate.Value.After(DateTime.UtcNow.AddHours(24))))
{
_logger.Debug("Discography release {0} rejected. All albums haven't released yet.", subject.Release.Title);
return Decision.Reject("Discography release rejected. All albums haven't released yet.");

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

Loading…
Cancel
Save