fix(sonarr): Fixed where requesting all seasons would only mark the latest as monitored #4496

pull/4500/head
tidusjar 3 years ago
parent 1d488e7b02
commit cfb85c23d7

@ -239,7 +239,7 @@ namespace Ombi.Core.Senders
languageProfileId = languageProfile; languageProfileId = languageProfile;
} }
} }
try try
{ {
// Does the series actually exist? // Does the series actually exist?
@ -358,7 +358,7 @@ namespace Ombi.Core.Senders
} }
} }
var sonarrEpisodeList = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber).ToList(); var sonarrEpisodeList = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber).ToList();
var sonarrEpCount = sonarrEpisodeList.Count; var sonarrEpCount = sonarrEpisodeList.Count;
var ourRequestCount = season.Episodes.Count; var ourRequestCount = season.Episodes.Count;
var ourEpisodes = season.Episodes.Select(x => x.EpisodeNumber).ToList(); var ourEpisodes = season.Episodes.Select(x => x.EpisodeNumber).ToList();
@ -374,17 +374,12 @@ namespace Ombi.Core.Senders
if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/) if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/)
{ {
// We have the same amount of requests as all of the episodes in the season. // We have the same amount of requests as all of the episodes in the season.
existingSeason.monitored = true;
seriesChanges = true;
if (!existingSeason.monitored) // We do not need to update the episodes as marking the season as monitored will mark the episodes as monitored.
{ var seasonToUpdate = result.seasons.FirstOrDefault(x => x.seasonNumber == season.SeasonNumber);
existingSeason.monitored = true; seasonToUpdate.monitored = true; // Update by ref
seriesChanges = true;
}
// Now update the episodes that need updating
foreach (var epToUpdate in episodesToUpdate.Where(x => x.seasonNumber == season.SeasonNumber))
{
await SonarrApi.UpdateEpisode(epToUpdate, s.ApiKey, s.FullUri);
}
} }
else else
{ {
@ -442,7 +437,6 @@ namespace Ombi.Core.Senders
var seasonsToUpdate = new List<Season>(); var seasonsToUpdate = new List<Season>();
for (var i = 0; i < model.ParentRequest.TotalSeasons + 1; i++) for (var i = 0; i < model.ParentRequest.TotalSeasons + 1; i++)
{ {
var index = i;
var sea = new Season var sea = new Season
{ {
seasonNumber = i, seasonNumber = i,

Loading…
Cancel
Save