Skip to content

Commit

Permalink
Fixed: Monitored status being reset after refresh when series is edit…
Browse files Browse the repository at this point in the history
…ed manually
  • Loading branch information
markus101 committed May 12, 2019
1 parent 488967c commit 98b1a76
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/NzbDrone.Core/Tv/SeriesService.cs
Expand Up @@ -169,16 +169,22 @@ public Series UpdateSeries(Series series, bool updateEpisodesToMatchSeason = tru
{
var storedSeries = GetSeries(series.Id);

foreach (var season in series.Seasons)
if (updateEpisodesToMatchSeason)
{
var storedSeason = storedSeries.Seasons.SingleOrDefault(s => s.SeasonNumber == season.SeasonNumber);

if (storedSeason != null && season.Monitored != storedSeason.Monitored && updateEpisodesToMatchSeason)
foreach (var season in series.Seasons)
{
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
var storedSeason = storedSeries.Seasons.SingleOrDefault(s => s.SeasonNumber == season.SeasonNumber);

if (storedSeason != null && season.Monitored != storedSeason.Monitored)
{
_episodeService.SetEpisodeMonitoredBySeason(series.Id, season.SeasonNumber, season.Monitored);
}
}
}

// Never update AddOptions when updating a series, keep it the same as the existing stored series.
series.AddOptions = storedSeries.AddOptions;

var updatedSeries = _seriesRepository.Update(series);
_eventAggregator.PublishEvent(new SeriesEditedEvent(updatedSeries, storedSeries));

Expand Down

0 comments on commit 98b1a76

Please sign in to comment.