fix(exam-correct): fix attended values and submit on only exam-result
This commit is contained in:
parent
2ca56fb8b1
commit
df0aaca759
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user