Fixed #2802 the issue where "Issues" were not being deleted correctly.

pull/2814/head
tidusjar 6 years ago
parent e83a8d045d
commit 5b1f326854

@ -49,7 +49,6 @@ namespace Ombi.Core.Senders
{ {
try try
{ {
var cpSettings = await CouchPotatoSettings.GetSettingsAsync(); var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
//var watcherSettings = await WatcherSettings.GetSettingsAsync(); //var watcherSettings = await WatcherSettings.GetSettingsAsync();
var radarrSettings = await RadarrSettings.GetSettingsAsync(); var radarrSettings = await RadarrSettings.GetSettingsAsync();
@ -76,7 +75,7 @@ namespace Ombi.Core.Senders
} }
catch (Exception e) catch (Exception e)
{ {
Log.LogError(e, "Error when seing movie to DVR app, added to the request queue"); Log.LogError(e, "Error when sending movie to DVR app, added to the request queue");
// Check if already in request quee // Check if already in request quee
var existingQueue = await _requestQueuRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id); var existingQueue = await _requestQueuRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);

@ -57,7 +57,7 @@ namespace Ombi.Core.Senders
var sonarr = await SonarrSettings.GetSettingsAsync(); var sonarr = await SonarrSettings.GetSettingsAsync();
if (sonarr.Enabled) if (sonarr.Enabled)
{ {
var result = await SendToSonarr(model); var result = await SendToSonarr(model, sonarr);
if (result != null) if (result != null)
{ {
return new SenderResult return new SenderResult
@ -109,7 +109,7 @@ namespace Ombi.Core.Senders
catch (Exception e) catch (Exception e)
{ {
Logger.LogError(e, "Exception thrown when sending a movie to DVR app, added to the request queue"); Logger.LogError(e, "Exception thrown when sending a movie to DVR app, added to the request queue");
// Check if already in request quee // Check if already in request queue
var existingQueue = await _requestQueueRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id); var existingQueue = await _requestQueueRepository.FirstOrDefaultAsync(x => x.RequestId == model.Id);
if (existingQueue != null) if (existingQueue != null)
{ {
@ -134,7 +134,7 @@ namespace Ombi.Core.Senders
return new SenderResult return new SenderResult
{ {
Success = false, Success = false,
Message = "Something wen't wrong!" Message = "Something went wrong!"
}; };
} }
@ -150,13 +150,8 @@ namespace Ombi.Core.Senders
/// <param name="s"></param> /// <param name="s"></param>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
public async Task<NewSeries> SendToSonarr(ChildRequests model) public async Task<NewSeries> SendToSonarr(ChildRequests model, SonarrSettings s)
{ {
var s = await SonarrSettings.GetSettingsAsync();
if (!s.Enabled)
{
return null;
}
if (string.IsNullOrEmpty(s.ApiKey)) if (string.IsNullOrEmpty(s.ApiKey))
{ {
return null; return null;

@ -28,9 +28,9 @@ namespace Ombi.Schedule.Jobs.Ombi
return; return;
} }
var now = DateTime.Now.AddDays(-settings.DaysAfterResolvedToDelete).Date; var now = DateTime.Now.AddDays(settings.DaysAfterResolvedToDelete).Date;
var resolved = _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved); var resolved = _issuesRepository.GetAll().Where(x => x.Status == IssueStatus.Resolved);
var toDelete = resolved.Where(x => x.ResovledDate.HasValue && x.ResovledDate.Value.Date <= now); var toDelete = resolved.Where(x => x.ResovledDate.HasValue && x.ResovledDate.Value.Date >= now);
foreach (var d in toDelete) foreach (var d in toDelete)
{ {

@ -162,7 +162,7 @@ namespace Ombi.Schedule.Jobs.Ombi
_plexRepo.UpdateWithoutSave(show); _plexRepo.UpdateWithoutSave(show);
} }
tvCount++; tvCount++;
if (tvCount >= 20) if (tvCount >= 75)
{ {
await _plexRepo.SaveChangesAsync(); await _plexRepo.SaveChangesAsync();
tvCount = 0; tvCount = 0;
@ -202,7 +202,7 @@ namespace Ombi.Schedule.Jobs.Ombi
_embyRepo.UpdateWithoutSave(show); _embyRepo.UpdateWithoutSave(show);
} }
tvCount++; tvCount++;
if (tvCount >= 20) if (tvCount >= 75)
{ {
await _embyRepo.SaveChangesAsync(); await _embyRepo.SaveChangesAsync();
tvCount = 0; tvCount = 0;
@ -233,7 +233,7 @@ namespace Ombi.Schedule.Jobs.Ombi
_plexRepo.UpdateWithoutSave(movie); _plexRepo.UpdateWithoutSave(movie);
} }
movieCount++; movieCount++;
if (movieCount >= 20) if (movieCount >= 75)
{ {
await _plexRepo.SaveChangesAsync(); await _plexRepo.SaveChangesAsync();
movieCount = 0; movieCount = 0;
@ -292,7 +292,7 @@ namespace Ombi.Schedule.Jobs.Ombi
_embyRepo.UpdateWithoutSave(movie); _embyRepo.UpdateWithoutSave(movie);
} }
movieCount++; movieCount++;
if (movieCount >= 20) if (movieCount >= 75)
{ {
await _embyRepo.SaveChangesAsync(); await _embyRepo.SaveChangesAsync();
movieCount = 0; movieCount = 0;

@ -267,6 +267,11 @@ namespace Ombi.Controllers
} }
issue.Status = model.Status; issue.Status = model.Status;
if (model.Status == IssueStatus.Resolved)
{
issue.ResovledDate = DateTime.UtcNow;
}
await _issues.SaveChangesAsync(); await _issues.SaveChangesAsync();
if (issue.Status == IssueStatus.Resolved) if (issue.Status == IssueStatus.Resolved)

Loading…
Cancel
Save