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