From 1f2e460f6d1b2979e9dfe3661076371679a73076 Mon Sep 17 00:00:00 2001 From: Chris Lees Date: Fri, 29 Apr 2016 14:46:39 -0400 Subject: [PATCH] Added Released propety to RequestViewModel. Added Released filter to the Requests page --- PlexRequests.UI/Content/requests.js | 1 + PlexRequests.UI/Models/RequestViewModel.cs | 3 ++- PlexRequests.UI/Modules/RequestsModule.cs | 5 ++++- PlexRequests.UI/Views/Requests/Index.cshtml | 6 ++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PlexRequests.UI/Content/requests.js b/PlexRequests.UI/Content/requests.js index f36967c7c..fbff4a934 100644 --- a/PlexRequests.UI/Content/requests.js +++ b/PlexRequests.UI/Content/requests.js @@ -540,6 +540,7 @@ function buildRequestContext(result, type) { requestedUsers: result.requestedUsers ? result.requestedUsers.join(', ') : '', requestedDate: Humanize(result.requestedDate), requestedDateTicks: result.requestedDateTicks, + released: result.released, available: result.available, admin: result.admin, issues: result.issues, diff --git a/PlexRequests.UI/Models/RequestViewModel.cs b/PlexRequests.UI/Models/RequestViewModel.cs index e5dc09746..136c511aa 100644 --- a/PlexRequests.UI/Models/RequestViewModel.cs +++ b/PlexRequests.UI/Models/RequestViewModel.cs @@ -38,7 +38,8 @@ namespace PlexRequests.UI.Models public string Title { get; set; } public string PosterPath { get; set; } public DateTime ReleaseDate { get; set; } - public long ReleaseDateTicks { get; set; } + public bool Released { get; set; } + public long ReleaseDateTicks { get; set; } public RequestType Type { get; set; } public string Status { get; set; } public bool Approved { get; set; } diff --git a/PlexRequests.UI/Modules/RequestsModule.cs b/PlexRequests.UI/Modules/RequestsModule.cs index afb98b454..bb3bd7b49 100644 --- a/PlexRequests.UI/Modules/RequestsModule.cs +++ b/PlexRequests.UI/Modules/RequestsModule.cs @@ -163,6 +163,7 @@ namespace PlexRequests.UI.Modules ReleaseDate = movie.ReleaseDate, ReleaseDateTicks = movie.ReleaseDate.Ticks, RequestedDate = movie.RequestedDate, + Released = DateTime.Now > movie.ReleaseDate, RequestedDateTicks = DateTimeHelper.OffsetUTCDateTime(movie.RequestedDate, DateTimeOffset).Ticks, Approved = movie.Available || movie.Approved, Title = movie.Title, @@ -246,6 +247,7 @@ namespace PlexRequests.UI.Modules ReleaseDateTicks = tv.ReleaseDate.Ticks, RequestedDate = tv.RequestedDate, RequestedDateTicks = DateTimeHelper.OffsetUTCDateTime(tv.RequestedDate, DateTimeOffset).Ticks, + Released = DateTime.Now > tv.ReleaseDate, Approved = tv.Available || tv.Approved, Title = tv.Title, Overview = tv.Overview, @@ -288,6 +290,7 @@ namespace PlexRequests.UI.Modules ReleaseDateTicks = album.ReleaseDate.Ticks, RequestedDate = album.RequestedDate, RequestedDateTicks = DateTimeHelper.OffsetUTCDateTime(album.RequestedDate, DateTimeOffset).Ticks, + Released = DateTime.Now > album.ReleaseDate, Approved = album.Available || album.Approved, Title = album.Title, Overview = album.Overview, @@ -411,4 +414,4 @@ namespace PlexRequests.UI.Modules : new JsonResponseModel { Result = false, Message = "Could not update the notes, please try again or check the logs" }); } } -} \ No newline at end of file +} diff --git a/PlexRequests.UI/Views/Requests/Index.cshtml b/PlexRequests.UI/Views/Requests/Index.cshtml index b6fe26214..27565156e 100644 --- a/PlexRequests.UI/Views/Requests/Index.cshtml +++ b/PlexRequests.UI/Views/Requests/Index.cshtml @@ -62,7 +62,9 @@
  • Approved
  • Not Approved
  • Available
  • -
  • Not Available
  • +
  • Not Available
  • +
  • Released
  • +
  • Not Released
  • @@ -125,7 +127,7 @@