From 7b56711a4fad4c40ec31e1fdc3a48f7a42f122e0 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sun, 22 May 2011 10:29:10 -0700 Subject: [PATCH] Added episode status to episode grid --- NzbDrone.Core.Test/EpisodeStatusTest.cs | 17 +++++++++++++++++ NzbDrone.Core/Repository/Episode.cs | 2 +- NzbDrone.Web/Controllers/SeriesController.cs | 12 +++++------- NzbDrone.Web/Models/EpisodeModel.cs | 2 ++ NzbDrone.Web/Views/Series/Details.cshtml | 1 + 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/NzbDrone.Core.Test/EpisodeStatusTest.cs b/NzbDrone.Core.Test/EpisodeStatusTest.cs index ff162c9f4..f84c5d127 100644 --- a/NzbDrone.Core.Test/EpisodeStatusTest.cs +++ b/NzbDrone.Core.Test/EpisodeStatusTest.cs @@ -115,5 +115,22 @@ namespace NzbDrone.Core.Test Assert.AreEqual(status, episode.Status); } + + + [Test] + public void low_air_date() + { + Episode episode = Builder.CreateNew() + .With(e => e.AirDate = DateTime.Now.AddYears(-200)) + .With(e => e.Ignored = false) + .With(e => e.EpisodeFileId = 0) + .With(e=>e.GrabDate =null) + .With(e => e.Season = Builder.CreateNew() + .With(s => s.Monitored = true).Build()) + .Build(); + + + Assert.AreEqual(EpisodeStatusType.NotAired, episode.Status); + } } } \ No newline at end of file diff --git a/NzbDrone.Core/Repository/Episode.cs b/NzbDrone.Core/Repository/Episode.cs index 811945769..7f15808fe 100644 --- a/NzbDrone.Core/Repository/Episode.cs +++ b/NzbDrone.Core/Repository/Episode.cs @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Repository if (EpisodeFileId != 0) return EpisodeStatusType.Ready; - if (DateTime.Now.Date >= AirDate.Date) + if (AirDate.Date.Year > 1900 && DateTime.Now.Date >= AirDate.Date) { return EpisodeStatusType.Missing; } diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index f689cdf4d..247786d8a 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -15,10 +15,8 @@ namespace NzbDrone.Web.Controllers public class SeriesController : Controller { private readonly EpisodeProvider _episodeProvider; - private readonly MediaFileProvider _mediaFileProvider; private readonly QualityProvider _qualityProvider; private readonly RenameProvider _renameProvider; - private readonly RootDirProvider _rootDirProvider; private readonly SeriesProvider _seriesProvider; private readonly TvDbProvider _tvDbProvider; private readonly JobProvider _jobProvider; @@ -28,17 +26,16 @@ namespace NzbDrone.Web.Controllers public SeriesController(SeriesProvider seriesProvider, EpisodeProvider episodeProvider, - QualityProvider qualityProvider, MediaFileProvider mediaFileProvider, - RenameProvider renameProvider, RootDirProvider rootDirProvider, - TvDbProvider tvDbProvider, JobProvider jobProvider, + QualityProvider qualityProvider, + RenameProvider renameProvider, + TvDbProvider tvDbProvider, + JobProvider jobProvider, SeasonProvider seasonProvider) { _seriesProvider = seriesProvider; _episodeProvider = episodeProvider; _qualityProvider = qualityProvider; - _mediaFileProvider = mediaFileProvider; _renameProvider = renameProvider; - _rootDirProvider = rootDirProvider; _tvDbProvider = tvDbProvider; _jobProvider = jobProvider; _seasonProvider = seasonProvider; @@ -137,6 +134,7 @@ namespace NzbDrone.Web.Controllers Overview = c.Overview, AirDate = c.AirDate, Path = GetEpisodePath(c.EpisodeFile), + Status = c.Status.ToString(), Quality = c.EpisodeFile == null ? String.Empty : c.EpisodeFile.Quality.ToString() diff --git a/NzbDrone.Web/Models/EpisodeModel.cs b/NzbDrone.Web/Models/EpisodeModel.cs index f43e60a27..cb4af6434 100644 --- a/NzbDrone.Web/Models/EpisodeModel.cs +++ b/NzbDrone.Web/Models/EpisodeModel.cs @@ -1,4 +1,5 @@ using System; +using NzbDrone.Core.Model; namespace NzbDrone.Web.Models { @@ -10,6 +11,7 @@ namespace NzbDrone.Web.Models public int SeasonNumber { get; set; } public string Overview { get; set; } public string Path { get; set; } + public String Status { get; set; } public DateTime AirDate { get; set; } public String Quality { get; set; } diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 1e32134de..c48482e49 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -77,6 +77,7 @@ columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); columns.Bound(c => c.Quality).Width(10); columns.Bound(c => c.Path); + columns.Bound(c => c.Status); }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) .ClientEvents(clientEvents =>