From 7a51c3d5dceb6fd63ca0eeed161b29c7b8a8f8a0 Mon Sep 17 00:00:00 2001 From: Stevie Robinson Date: Fri, 19 May 2023 09:45:03 +0200 Subject: [PATCH] Adjusted as per @markus101 suggestion and removed the added test. --- .../TvTests/RefreshSeriesServiceFixture.cs | 17 --------------- .../Tv/Commands/RefreshSeriesCommand.cs | 21 +++++++++++++------ 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs index c35eae9e2..7a154d5fa 100644 --- a/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/RefreshSeriesServiceFixture.cs @@ -74,23 +74,6 @@ namespace NzbDrone.Core.Test.TvTests .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny(), It.IsAny())); } - [Test] - public void should_monitor_new_seasons_automatically_if_series_is_monitored_single_seriesId() - { - _series.Monitored = true; - var newSeriesInfo = _series.JsonClone(); - newSeriesInfo.Seasons.Add(Builder.CreateNew() - .With(s => s.SeasonNumber = 2) - .Build()); - - GivenNewSeriesInfo(newSeriesInfo); - - Subject.Execute(new RefreshSeriesCommand(_series.Id)); - - Mocker.GetMock() - .Verify(v => v.UpdateSeries(It.Is(s => s.Seasons.Count == 2 && s.Seasons.Single(season => season.SeasonNumber == 2).Monitored == true), It.IsAny(), It.IsAny())); - } - [Test] public void should_not_monitor_new_seasons_automatically_if_series_is_not_monitored() { diff --git a/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs b/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs index 6d9a67bf3..ce53d20cb 100644 --- a/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs +++ b/src/NzbDrone.Core/Tv/Commands/RefreshSeriesCommand.cs @@ -1,12 +1,26 @@ using System.Collections.Generic; using System.Linq; +using System.Text.Json.Serialization; +using NzbDrone.Common.Extensions; using NzbDrone.Core.Messaging.Commands; namespace NzbDrone.Core.Tv.Commands { public class RefreshSeriesCommand : Command { - public int? SeriesId { get; set; } + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] + public int SeriesId + { + get => 0; + set + { + if (SeriesIds.Empty()) + { + SeriesIds.Add(value); + } + } + } + public List SeriesIds { get; set; } public bool IsNewSeries { get; set; } @@ -15,11 +29,6 @@ namespace NzbDrone.Core.Tv.Commands SeriesIds = new List(); } - public RefreshSeriesCommand(int seriesId, bool isNewSeries = false) - { - SeriesIds = new List { seriesId }; - } - public RefreshSeriesCommand(List seriesIds, bool isNewSeries = false) { SeriesIds = seriesIds;