diff --git a/frontend/src/utils/exam-correct/exam-correct.js b/frontend/src/utils/exam-correct/exam-correct.js index 6a4d5ad24..f29fcaf52 100644 --- a/frontend/src/utils/exam-correct/exam-correct.js +++ b/frontend/src/utils/exam-correct/exam-correct.js @@ -105,13 +105,13 @@ export class ExamCorrect { ); this._resultSelect.addEventListener('change', () => { - if (this._resultSelect.value !== 'result') + if (this._resultSelect.value !== 'attended') this._resultGradeSelect.classList.add('grade-hidden'); else this._resultGradeSelect.classList.remove('grade-hidden'); }); - if (this._resultSelect.value !== 'result') + if (this._resultSelect.value !== 'attended') this._resultGradeSelect.classList.add('grade-hidden'); this._lastColumnIndex = this._element.querySelector('thead > tr').querySelectorAll('th').length - 1; @@ -206,8 +206,8 @@ export class ExamCorrect { const result = this._resultSelect.value !== 'none' && this._resultSelect.value; - // abort send if there are no results (after validation) - if (Object.keys(results).length <= 0) return; + // abort send if there are neither part-results nor an exam-result (after validation) + if (Object.keys(results).length <= 0 && result === 'none') return; const rowInfo = { users: [user], @@ -225,7 +225,7 @@ export class ExamCorrect { const body = { user: userId || user, }; - if (results) body.results = results; + if (results && results !== {}) body.results = results; if (result) { switch (result) { case 'delete': { @@ -233,7 +233,7 @@ export class ExamCorrect { break; } case 'attended': { - body.grade = { status: result, result: this._resultGradeSelect.value }; + body.grade = { status: this._resultGradeSelect.value }; break; } default: { @@ -242,8 +242,6 @@ export class ExamCorrect { } } - console.log('request body', body); - this._app.httpClient.post({ url: EXAM_CORRECT_URL_POST, headers: EXAM_CORRECT_HEADERS,