Show the TV show as available when we have all the episodes but future episodes have not aired. #2585

This commit is contained in:
Jamie 2018-10-26 22:29:29 +01:00
commit d3c33fa804
2 changed files with 20 additions and 1 deletions

View file

@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Ombi.Core.Models.Search;
@ -104,6 +105,21 @@ namespace Ombi.Core.Rule.Rules.Search
{
search.FullyAvailable = true;
}
else
{
var airedButNotAvailable = search.SeasonRequests.Any(x =>
x.Episodes.Any(c => !c.Available && c.AirDate <= DateTime.Now.Date));
if (!airedButNotAvailable)
{
var unairedEpisodes = search.SeasonRequests.Any(x =>
x.Episodes.Any(c => !c.Available && c.AirDate > DateTime.Now.Date));
if (unairedEpisodes)
{
search.FullyAvailable = true;
}
}
}
}
}
}