|
1 | | -function trackFinished(exerciseId, solutionId, element) { |
2 | | - element.addEventListener('click', () => { |
3 | | - const xhr = new XMLHttpRequest(); |
4 | | - xhr.open('POST', `/checked/${exerciseId}/${solutionId}`, true); |
5 | | - xhr.setRequestHeader('Content-Type', 'application/json'); |
6 | | - xhr.responseType = 'json'; |
7 | | - xhr.onreadystatechange = () => { |
8 | | - if (xhr.readyState === 4) { |
9 | | - if (xhr.status === 200) { |
10 | | - if (xhr.response.next !== null) { |
11 | | - window.location.href = `/view/${xhr.response.next}`; |
12 | | - } else { |
13 | | - alert("Yay! That's it!"); |
14 | | - } |
15 | | - } else { |
16 | | - console.log(xhr.status); |
17 | | - } |
18 | | - } |
19 | | - }; |
20 | | - |
21 | | - xhr.send(JSON.stringify({})); |
22 | | - }); |
23 | | -} |
24 | | - |
25 | 1 | function sendComment(kind, fileId, line, commentData) { |
26 | 2 | const xhr = new XMLHttpRequest(); |
27 | 3 | xhr.open('POST', '/comments'); |
@@ -211,13 +187,11 @@ window.deleteComment = deleteComment; |
211 | 187 | window.sendExistsComment = sendExistsComment; |
212 | 188 | window.addEventListener('lines-numbered', () => { |
213 | 189 | const codeView = document.getElementById('code-view'); |
214 | | - const exerciseId = codeView.dataset.exercise; |
215 | 190 | const lineItems = codeView.getElementsByClassName('line'); |
216 | 191 | addNewCommentButtons(lineItems); |
217 | 192 | const addCommentItems = codeView.querySelectorAll('.grader-add'); |
218 | 193 | trackDragAreas(lineItems, addCommentItems); |
219 | 194 | trackDraggables(document.getElementsByClassName('known-comment')); |
220 | | - trackFinished(exerciseId, window.solutionId, document.getElementById('save-check')); |
221 | 195 | if (!window.isUserGrader()) { |
222 | 196 | sessionStorage.setItem('role', 'grader'); |
223 | 197 | } |
|
0 commit comments