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

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

@ -239,7 +239,7 @@ namespace Ombi.Core.Senders
languageProfileId = languageProfile;
}
}
try
{
// Does the series actually exist?
@ -358,7 +358,7 @@ namespace Ombi.Core.Senders
}
}
var sonarrEpisodeList = sonarrEpList.Where(x => x.seasonNumber == season.SeasonNumber).ToList();
var sonarrEpCount = sonarrEpisodeList.Count;
var sonarrEpCount = sonarrEpisodeList.Count;
var ourRequestCount = season.Episodes.Count;
var ourEpisodes = season.Episodes.Select(x => x.EpisodeNumber).ToList();
@ -374,17 +374,12 @@ namespace Ombi.Core.Senders
if (sonarrEpCount == ourRequestCount /*|| !missingEpisodes.Any()*/)
{
// We have the same amount of requests as all of the episodes in the season.
existingSeason.monitored = true;
seriesChanges = true;
if (!existingSeason.monitored)
{
existingSeason.monitored = true;
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);
}
// 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);
seasonToUpdate.monitored = true; // Update by ref
}
else
{
@ -442,7 +437,6 @@ namespace Ombi.Core.Senders
var seasonsToUpdate = new List<Season>();
for (var i = 0; i < model.ParentRequest.TotalSeasons + 1; i++)
{
var index = i;
var sea = new Season
{
seasonNumber = i,

Loading…
Cancel
Save