Update episodes monitored state only when season changes

pull/2/head
Mark McDowall 11 years ago
parent a81ca798a7
commit 6850d77dd2

@ -189,6 +189,7 @@
<Compile Include="MediaFiles\DownloadedEpisodesImportServiceFixture.cs" />
<Compile Include="SeriesStatsTests\SeriesStatisticsFixture.cs" />
<Compile Include="TvTests\SeriesRepositoryTests\QualityProfileRepositoryFixture.cs" />
<Compile Include="TvTests\SeriesServiceTests\UpdateSeriesFixture.cs" />
<Compile Include="UpdateTests\UpdateServiceFixture.cs" />
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetSceneTvdbMappingsFixture.cs" />
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetXemSeriesIdsFixture.cs" />
@ -211,7 +212,7 @@
<Compile Include="ParserTests\ParserFixture.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Qualities\QualityProfileServiceFixture.cs" />
<Compile Include="TvTests\SeriesServiceFixture.cs" />
<Compile Include="TvTests\SeriesServiceTests\AddSeriesFixture.cs" />
<Compile Include="UpdateTests\UpdatePackageProviderFixture.cs" />
<Compile Include="XbmcVersionTests.cs" />
</ItemGroup>

@ -119,6 +119,18 @@ namespace NzbDrone.Core.Tv
public Series UpdateSeries(Series series)
{
var storedSeries = GetSeries(series.Id);
foreach (var season in series.Seasons)
{
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);
}
}
return _seriesRepository.Update(series);
}

Loading…
Cancel
Save