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

pull/2628/head
Jamie 6 years ago
parent 4edbe249ec
commit d3c33fa804

@ -1,4 +1,5 @@
using System.Linq; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Ombi.Core.Models.Search; using Ombi.Core.Models.Search;
@ -104,6 +105,21 @@ namespace Ombi.Core.Rule.Rules.Search
{ {
search.FullyAvailable = true; 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;
}
}
}
} }
} }
} }

@ -96,6 +96,9 @@ namespace Ombi.Controllers
return new UnauthorizedResult(); return new UnauthorizedResult();
} }
/// <summary>
/// Returns the Token for the Ombi User if we can match the Plex user with a valid Ombi User
/// </summary>
[HttpPost("plextoken")] [HttpPost("plextoken")]
public async Task<IActionResult> GetTokenWithPlexToken([FromBody] PlexTokenAuthentication model) public async Task<IActionResult> GetTokenWithPlexToken([FromBody] PlexTokenAuthentication model)
{ {

Loading…
Cancel
Save