1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

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="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>

View File

@ -119,6 +119,18 @@ public List<Series> GetAllSeries()
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);
}