From 2e8bb783d9dd4a08a3061562a378eac82d2c7095 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Fri, 18 Mar 2016 13:52:10 +0000 Subject: [PATCH] Fixed #16 and #30 We are now using the new request service and storing the requests as json blobs Added the db migration code. This can be removed in the next few builds. --- PlexRequests.Core/Setup.cs | 17 +++++++++++++++-- PlexRequests.UI/Content/requests.js | 2 +- PlexRequests.UI/Views/Requests/Index.cshtml | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/PlexRequests.Core/Setup.cs b/PlexRequests.Core/Setup.cs index 1d50794aa..4681dd3b4 100644 --- a/PlexRequests.Core/Setup.cs +++ b/PlexRequests.Core/Setup.cs @@ -68,7 +68,7 @@ namespace PlexRequests.Core s.SaveSettings(defaultSettings); } - private void MigrateDb() + private void MigrateDb() // TODO: Remove when no longer needed { var repo = new GenericRepository(Db); var records = repo.GetAll(); @@ -88,7 +88,20 @@ namespace PlexRequests.Core { throw new SqliteException("Could not migrate the DB!"); } - + + + if (result.Count != requestedModels.Length) + { + throw new SqliteException("Could not migrate the DB! count is different"); + } + + + // Now delete the old requests + foreach (var oldRequest in requestedModels) + { + repo.Delete(oldRequest); + } + } } } diff --git a/PlexRequests.UI/Content/requests.js b/PlexRequests.UI/Content/requests.js index 8c83f3328..5e26fc4a7 100644 --- a/PlexRequests.UI/Content/requests.js +++ b/PlexRequests.UI/Content/requests.js @@ -108,7 +108,7 @@ $(".theNoteSaveButton").click(function (e) { if (checkJsonResponse(response)) { generateNotify("Success! Added Note.", "success"); $("#myModal").modal("hide"); - $('#adminNotesArea').html("
Note from Admin: " + comment + "
"); + $('#adminNotesArea' + e.target.value).html("
Note from Admin: " + comment + "
"); } }, error: function (e) { diff --git a/PlexRequests.UI/Views/Requests/Index.cshtml b/PlexRequests.UI/Views/Requests/Index.cshtml index 7de26fd08..5181b38c0 100644 --- a/PlexRequests.UI/Views/Requests/Index.cshtml +++ b/PlexRequests.UI/Views/Requests/Index.cshtml @@ -102,7 +102,7 @@
Issue: {{issues}}
{{/if}} -
+
{{#if adminNote}}
Note from Admin: {{adminNote}}
{{/if}}