mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 00:06:05 -07:00
Fixed #2801 this is when a season is not correctly monitored in sonarr when approved by an admin
This commit is contained in:
parent
d834b96b4b
commit
ada38a0c30
7 changed files with 1309 additions and 63 deletions
|
@ -385,6 +385,7 @@ namespace Ombi.Core.Engine
|
|||
foreach (var ep in s.Episodes)
|
||||
{
|
||||
ep.Approved = true;
|
||||
ep.Requested = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ using Ombi.Settings.Settings.Models.External;
|
|||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Entities.Requests;
|
||||
using Ombi.Store.Repository;
|
||||
using Remotion.Linq.Parsing.Structure.IntermediateModel;
|
||||
|
||||
namespace Ombi.Core.Senders
|
||||
{
|
||||
|
@ -314,10 +315,19 @@ namespace Ombi.Core.Senders
|
|||
|
||||
foreach (var season in model.SeasonRequests)
|
||||
{
|
||||
var sonarrSeason = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber);
|
||||
var sonarrEpCount = sonarrSeason.Count();
|
||||
var sonarrEpisodeList = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber).ToList();
|
||||
var sonarrEpCount = sonarrEpisodeList.Count;
|
||||
var ourRequestCount = season.Episodes.Count;
|
||||
|
||||
var ourEpisodes = season.Episodes.Select(x => x.EpisodeNumber).ToList();
|
||||
var unairedEpisodes = sonarrEpisodeList.Where(x => x.airDateUtc > DateTime.UtcNow).Select(x => x.episodeNumber).ToList();
|
||||
|
||||
//// Check if we have requested all the latest episodes, if we have then monitor
|
||||
//// NOTE, not sure if needed since ombi ui displays future episodes anyway...
|
||||
//ourEpisodes.AddRange(unairedEpisodes);
|
||||
//var distinctEpisodes = ourEpisodes.Distinct().ToList();
|
||||
//var missingEpisodes = Enumerable.Range(distinctEpisodes.Min(), distinctEpisodes.Count).Except(distinctEpisodes);
|
||||
|
||||
var existingSeason =
|
||||
result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
|
||||
if (existingSeason == null)
|
||||
|
@ -327,7 +337,7 @@ namespace Ombi.Core.Senders
|
|||
}
|
||||
|
||||
|
||||
if (sonarrEpCount == ourRequestCount)
|
||||
if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/)
|
||||
{
|
||||
// We have the same amount of requests as all of the episodes in the season.
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@ namespace Ombi.Store.Entities.Requests
|
|||
public DateTime ReleaseDate { get; set; }
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is so we can correctly send the right amount of seasons to Sonarr
|
||||
/// </summary>
|
||||
[NotMapped]
|
||||
public int TotalSeasons { get; set; }
|
||||
|
||||
public List<ChildRequests> ChildRequests { get; set; }
|
||||
|
|
1214
src/Ombi.Store/Migrations/20190216231519_TvRequestsTotalSeasons.Designer.cs
generated
Normal file
1214
src/Ombi.Store/Migrations/20190216231519_TvRequestsTotalSeasons.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,23 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class TvRequestsTotalSeasons : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TotalSeasons",
|
||||
table: "TvRequests",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalSeasons",
|
||||
table: "TvRequests");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -819,6 +819,8 @@ namespace Ombi.Store.Migrations
|
|||
|
||||
b.Property<string>("Title");
|
||||
|
||||
b.Property<int>("TotalSeasons");
|
||||
|
||||
b.Property<int>("TvDbId");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features.Authentication;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ombi.Api.Emby;
|
||||
using Ombi.Api.Plex;
|
||||
using Ombi.Controllers;
|
||||
using Ombi.Core.Authentication;
|
||||
using Ombi.Core.Settings;
|
||||
using Ombi.Core.Settings.Models.External;
|
||||
using Ombi.Models.Identity;
|
||||
using Ombi.Notifications;
|
||||
using Ombi.Schedule.Jobs.Ombi;
|
||||
using Ombi.Settings.Settings.Models;
|
||||
using Ombi.Settings.Settings.Models.Notifications;
|
||||
using Ombi.Store.Context;
|
||||
using Ombi.Store.Entities;
|
||||
using Ombi.Store.Repository;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
using Microsoft.AspNetCore.TestHost;
|
||||
using Newtonsoft.Json;
|
||||
using Ombi.Models;
|
||||
//using System.Net.Http;
|
||||
//using System.Threading.Tasks;
|
||||
//using AutoMapper;
|
||||
//using Microsoft.AspNetCore.Hosting;
|
||||
//using Microsoft.AspNetCore.Http;
|
||||
//using Microsoft.AspNetCore.Http.Features.Authentication;
|
||||
//using Microsoft.AspNetCore.Identity;
|
||||
//using Microsoft.Extensions.DependencyInjection;
|
||||
//using Microsoft.Extensions.Options;
|
||||
//using Moq;
|
||||
//using NUnit.Framework;
|
||||
//using Ombi.Api.Emby;
|
||||
//using Ombi.Api.Plex;
|
||||
//using Ombi.Controllers;
|
||||
//using Ombi.Core.Authentication;
|
||||
//using Ombi.Core.Settings;
|
||||
//using Ombi.Core.Settings.Models.External;
|
||||
//using Ombi.Models.Identity;
|
||||
//using Ombi.Notifications;
|
||||
//using Ombi.Schedule.Jobs.Ombi;
|
||||
//using Ombi.Settings.Settings.Models;
|
||||
//using Ombi.Settings.Settings.Models.Notifications;
|
||||
//using Ombi.Store.Context;
|
||||
//using Ombi.Store.Entities;
|
||||
//using Ombi.Store.Repository;
|
||||
//using Microsoft.AspNetCore.Hosting.Server;
|
||||
//using Microsoft.AspNetCore.TestHost;
|
||||
//using Newtonsoft.Json;
|
||||
//using Ombi.Models;
|
||||
|
||||
namespace Ombi.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
[Ignore("TODO")]
|
||||
public class TokenControllerTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_testServer = new TestServer(new WebHostBuilder()
|
||||
.UseStartup<TestStartup>());
|
||||
_client = _testServer.CreateClient();
|
||||
}
|
||||
//namespace Ombi.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// [Ignore("TODO")]
|
||||
// public class TokenControllerTests
|
||||
// {
|
||||
// [SetUp]
|
||||
// public void Setup()
|
||||
// {
|
||||
// _testServer = new TestServer(new WebHostBuilder()
|
||||
// .UseStartup<TestStartup>());
|
||||
// _client = _testServer.CreateClient();
|
||||
// }
|
||||
|
||||
private TestServer _testServer;
|
||||
private HttpClient _client;
|
||||
// private TestServer _testServer;
|
||||
// private HttpClient _client;
|
||||
|
||||
|
||||
[Test]
|
||||
public async Task GetToken_FromValid_LocalUser()
|
||||
{
|
||||
var model = new UserAuthModel
|
||||
{
|
||||
Password = "a",
|
||||
Username = "a"
|
||||
};
|
||||
HttpResponseMessage response = await _client.PostAsync("/api/v1/token", new StringContent(JsonConvert.SerializeObject(model)) );
|
||||
}
|
||||
}
|
||||
}
|
||||
// [Test]
|
||||
// public async Task GetToken_FromValid_LocalUser()
|
||||
// {
|
||||
// var model = new UserAuthModel
|
||||
// {
|
||||
// Password = "a",
|
||||
// Username = "a"
|
||||
// };
|
||||
// HttpResponseMessage response = await _client.PostAsync("/api/v1/token", new StringContent(JsonConvert.SerializeObject(model)) );
|
||||
// }
|
||||
// }
|
||||
//}
|
Loading…
Add table
Add a link
Reference in a new issue