From acb70e19cb77a39b1142b175b8e64a88e6f766c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sven=20K=C3=A4stle?= <sven.kaestle@gmx.de>
Date: Tue, 4 Sep 2018 13:44:52 +0200
Subject: [PATCH] refactor: Adjust front-end REST methods

---
 .../src/main/webapp/assets/js/unstructuredAnnotation.js  | 4 ++--
 .../src/main/webapp/assets/js/unstructuredRest.js        | 9 +++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js
index ecac045a..8c770dfd 100644
--- a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js
+++ b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredAnnotation.js
@@ -12,12 +12,12 @@ $(document).ready(function() {
         getAllSubmissionParts(getSubmissionIdFromUrl(), function (response) {
 
             // iterate over response
-            for (var i = 0; i < response.length; i++) {
+            for (let i = 0; i < response.length; i++) {
                 // save current category and body
                 let category = response[i].category;
                 let body = response[i].body;
                 // iterate over body and handle every selection
-                for (var j = 0; j < body.length; j++) {
+                for (let j = 0; j < body.length; j++) {
                     handleCategorySelection(category.toLowerCase(), body[j].startCharacter, body[j].endCharacter);
                 }
             }
diff --git a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredRest.js b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredRest.js
index 819c8221..047018ef 100644
--- a/gemeinsamforschen/src/main/webapp/assets/js/unstructuredRest.js
+++ b/gemeinsamforschen/src/main/webapp/assets/js/unstructuredRest.js
@@ -68,14 +68,15 @@ function createSubmissionPart(submissionPartPostRequest, responseHandler) {
 }
 
 /**
- * GET: Get a specific submission part for a given id
+ * GET: Get a specific submission part for a given full submission id and its category
  *
- * @param id The id of the submission part
+ * @param id The id of the full submission
+ * @param category The category of the submission part
  * @param responseHandler The response handler
  * @param errorHandler The error handler
  */
-function getSubmissionPart(id, responseHandler, errorHandler) {
-    var url = "../rest/submissions/part/" + id;
+function getSubmissionPart(id, category, responseHandler, errorHandler) {
+    var url = "/full/" + id + "/category/" + category;
     $.ajax({
         url: url,
         type: "GET",
-- 
GitLab