diff --git a/NzbDrone.Api/Series/SeriesResource.cs b/NzbDrone.Api/Series/SeriesResource.cs index e9284736f..4de8a4687 100644 --- a/NzbDrone.Api/Series/SeriesResource.cs +++ b/NzbDrone.Api/Series/SeriesResource.cs @@ -35,7 +35,6 @@ public class SeriesResource : RestResource //Editing Only public Boolean SeasonFolder { get; set; } public Boolean Monitored { get; set; } - public DateTime? CustomStartDate { get; set; } public Boolean UseSceneNumbering { get; set; } public Int32 Runtime { get; set; } diff --git a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs deleted file mode 100644 index 4dc0ace87..000000000 --- a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using System.Collections.Generic; -using FizzWare.NBuilder; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Core.DecisionEngine.Specifications; -using NzbDrone.Core.Parser.Model; -using NzbDrone.Core.Tv; -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test.DecisionEngineTests -{ - [TestFixture] - - public class CustomStartDateSpecificationFixture : CoreTest - { - private CustomStartDateSpecification _customStartDateSpecification; - - private RemoteEpisode parseResultMulti; - private RemoteEpisode parseResultSingle; - private Series fakeSeries; - private Episode firstEpisode; - private Episode secondEpisode; - - [SetUp] - public void Setup() - { - _customStartDateSpecification = Mocker.Resolve(); - - firstEpisode = new Episode { AirDate = DateTime.Today }; - secondEpisode = new Episode { AirDate = DateTime.Today }; - - fakeSeries = Builder.CreateNew() - .With(c => c.Monitored = true) - .With(c => c.CustomStartDate = null) - .Build(); - - parseResultMulti = new RemoteEpisode - { - Series = fakeSeries, - Episodes = new List { firstEpisode, secondEpisode } - }; - - parseResultSingle = new RemoteEpisode - { - Series = fakeSeries, - Episodes = new List { firstEpisode } - }; - } - - private void WithFirstEpisodeLastYear() - { - firstEpisode.AirDate = DateTime.Today.AddYears(-1); - } - - private void WithSecondEpisodeYear() - { - secondEpisode.AirDate = DateTime.Today.AddYears(-1); - } - - private void WithAiredAfterYesterday() - { - fakeSeries.CustomStartDate = DateTime.Today.AddDays(-1); - } - - private void WithAiredAfterLastWeek() - { - fakeSeries.CustomStartDate = DateTime.Today.AddDays(-7); - } - - [Test] - public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_single_episode() - { - _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue(); - } - - [Test] - public void should_return_true_when_downloadEpisodesAiredAfter_is_null_for_multiple_episodes() - { - _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); - } - - [Test] - public void should_return_true_if_both_episodes_air_after_cutoff() - { - WithAiredAfterLastWeek(); - _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); - } - - [Test] - public void should_return_true_if_episode_airs_after_cutoff() - { - WithAiredAfterLastWeek(); - _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue(); - } - - [Test] - public void should_return_true_if_first_episode_aired_after_cutoff() - { - WithAiredAfterLastWeek(); - WithSecondEpisodeYear(); - _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); - } - - [Test] - public void should_return_true_if_second_episode_aired_after_cutoff() - { - WithAiredAfterLastWeek(); - WithFirstEpisodeLastYear(); - _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeTrue(); - } - - [Test] - public void should_return_false_if_both_episodes_aired_before_cutoff() - { - WithAiredAfterLastWeek(); - WithFirstEpisodeLastYear(); - WithSecondEpisodeYear(); - _customStartDateSpecification.IsSatisfiedBy(parseResultMulti).Should().BeFalse(); - } - - [Test] - public void should_return_false_if_episode_aired_before_cutoff() - { - WithAiredAfterLastWeek(); - WithFirstEpisodeLastYear(); - _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeFalse(); - } - - [Test] - public void should_return_true_if_episode_airs_the_same_day_as_the_cutoff() - { - fakeSeries.CustomStartDate = DateTime.Today; - _customStartDateSpecification.IsSatisfiedBy(parseResultSingle).Should().BeTrue(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index c63ac3318..df6b19c9d 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -176,7 +176,6 @@ - diff --git a/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs b/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs new file mode 100644 index 000000000..9b8f0ef1e --- /dev/null +++ b/NzbDrone.Core/Datastore/Migration/012_remove_custom_start_date.cs @@ -0,0 +1,15 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Tags("")] + [Migration(12)] + public class remove_custom_start_date : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + SQLiteAlter.DropColumns("Series", new[] { "CustomStartDate" }); + } + } +} diff --git a/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs deleted file mode 100644 index a1636f8e8..000000000 --- a/NzbDrone.Core/DecisionEngine/Specifications/CustomStartDateSpecification.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Linq; -using NLog; -using NzbDrone.Core.Parser.Model; - -namespace NzbDrone.Core.DecisionEngine.Specifications -{ - public class CustomStartDateSpecification : IDecisionEngineSpecification - { - private readonly Logger _logger; - - public CustomStartDateSpecification(Logger logger) - { - _logger = logger; - } - - public string RejectionReason - { - get - { - return "Aired before configured cut-off"; - } - } - - - public virtual bool IsSatisfiedBy(RemoteEpisode subject) - { - if (!subject.Series.CustomStartDate.HasValue) - { - _logger.Debug("{0} does not restrict downloads before date.", subject.Series); - return true; - } - - if (subject.Episodes.Any(episode => episode.AirDate >= subject.Series.CustomStartDate.Value)) - { - _logger.Debug("One or more episodes aired after cutoff, downloading."); - return true; - } - - _logger.Debug("Episodes aired before cutoff date: {0}", subject.Series.CustomStartDate); - return false; - } - } -} diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 65090ba22..132a8d089 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -212,6 +212,7 @@ + @@ -239,7 +240,6 @@ - diff --git a/NzbDrone.Core/Tv/Series.cs b/NzbDrone.Core/Tv/Series.cs index b9a6f0de8..55a6adb73 100644 --- a/NzbDrone.Core/Tv/Series.cs +++ b/NzbDrone.Core/Tv/Series.cs @@ -31,7 +31,6 @@ public Series() public List Images { get; set; } public SeriesTypes SeriesType { get; set; } public string Network { get; set; } - public DateTime? CustomStartDate { get; set; } public bool UseSceneNumbering { get; set; } public string TitleSlug { get; set; } public string Path { get; set; } diff --git a/NzbDrone.Core/Tv/SeriesService.cs b/NzbDrone.Core/Tv/SeriesService.cs index 0650d56fb..c6176bb65 100644 --- a/NzbDrone.Core/Tv/SeriesService.cs +++ b/NzbDrone.Core/Tv/SeriesService.cs @@ -95,7 +95,6 @@ public void UpdateFromSeriesEditor(IList editedSeries) series.Monitored = edited.Monitored; series.SeasonFolder = edited.SeasonFolder; series.Path = edited.Path; - series.CustomStartDate = edited.CustomStartDate; _seriesRepository.Update(series); } diff --git a/UI/Series/Edit/EditSeriesTemplate.html b/UI/Series/Edit/EditSeriesTemplate.html index 6102ade9c..43e99398b 100644 --- a/UI/Series/Edit/EditSeriesTemplate.html +++ b/UI/Series/Edit/EditSeriesTemplate.html @@ -61,9 +61,9 @@ {{/each}} - - - + + +