Fixed: Monitored status being reset after refresh when series is edited manually

This commit is contained in:
Mark McDowall 2019-05-12 16:03:31 -07:00
parent 488967c6ef
commit 98b1a7681b
1 changed files with 11 additions and 5 deletions

View File

@ -169,16 +169,22 @@ namespace NzbDrone.Core.Tv
{
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));