Update episodes monitored state only when season changes

This commit is contained in:
Mark McDowall 2013-09-12 23:47:40 -07:00
parent a81ca798a7
commit 6850d77dd2
4 changed files with 14 additions and 1 deletions

View File

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

View File

@ -119,6 +119,18 @@ namespace NzbDrone.Core.Tv
public Series UpdateSeries(Series series) 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); return _seriesRepository.Update(series);
} }