fix(exam-correct): fix usage for non-lecturer
This commit is contained in:
parent
cd479e2f0c
commit
dd7fe84ffd
@ -78,8 +78,10 @@ export class ExamCorrect {
|
|||||||
this._userInputStatus = document.getElementById(EXAM_CORRECT_USER_INPUT_STATUS_ID);
|
this._userInputStatus = document.getElementById(EXAM_CORRECT_USER_INPUT_STATUS_ID);
|
||||||
this._userInputCandidates = document.getElementById(EXAM_CORRECT_USER_INPUT_CANDIDATES_ID);
|
this._userInputCandidates = document.getElementById(EXAM_CORRECT_USER_INPUT_CANDIDATES_ID);
|
||||||
this._partInputs = [...this._element.querySelectorAll(`input[${EXAM_CORRECT_PART_INPUT_ATTR}]`)];
|
this._partInputs = [...this._element.querySelectorAll(`input[${EXAM_CORRECT_PART_INPUT_ATTR}]`)];
|
||||||
this._resultSelect = document.getElementById('uw-exam-correct__result').querySelector('select');
|
const resultCell = document.getElementById('uw-exam-correct__result');
|
||||||
this._resultGradeSelect = document.getElementById('uw-exam-correct__result__grade').querySelector('select');
|
this._resultSelect = resultCell && resultCell.querySelector('select');
|
||||||
|
const resultGradeCell = document.getElementById('uw-exam-correct__result__grade');
|
||||||
|
this._resultGradeSelect = resultGradeCell && resultGradeCell.querySelector('select');
|
||||||
this._partDeleteBoxes = [...this._element.querySelectorAll('input.uw-exam-correct--delete-exam-part')];
|
this._partDeleteBoxes = [...this._element.querySelectorAll('input.uw-exam-correct--delete-exam-part')];
|
||||||
|
|
||||||
if (this._sendBtn)
|
if (this._sendBtn)
|
||||||
@ -114,15 +116,17 @@ export class ExamCorrect {
|
|||||||
.map((header) => [header.getAttribute('uw-exam-correct-header'), header.cellIndex])
|
.map((header) => [header.getAttribute('uw-exam-correct-header'), header.cellIndex])
|
||||||
);
|
);
|
||||||
|
|
||||||
this._resultSelect.addEventListener('change', () => {
|
if (this._resultSelect && this._resultGradeSelect) {
|
||||||
|
this._resultSelect.addEventListener('change', () => {
|
||||||
|
if (this._resultSelect.value !== 'attended')
|
||||||
|
this._resultGradeSelect.classList.add('grade-hidden');
|
||||||
|
else
|
||||||
|
this._resultGradeSelect.classList.remove('grade-hidden');
|
||||||
|
});
|
||||||
|
|
||||||
if (this._resultSelect.value !== 'attended')
|
if (this._resultSelect.value !== 'attended')
|
||||||
this._resultGradeSelect.classList.add('grade-hidden');
|
this._resultGradeSelect.classList.add('grade-hidden');
|
||||||
else
|
}
|
||||||
this._resultGradeSelect.classList.remove('grade-hidden');
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this._resultSelect.value !== 'attended')
|
|
||||||
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;
|
||||||
|
|
||||||
@ -235,7 +239,7 @@ export class ExamCorrect {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let result;
|
let result;
|
||||||
if (this._resultSelect) {
|
if (this._resultSelect && this._resultGradeSelect) {
|
||||||
switch (this._resultSelect.value) {
|
switch (this._resultSelect.value) {
|
||||||
case 'none':
|
case 'none':
|
||||||
result = undefined;
|
result = undefined;
|
||||||
@ -421,7 +425,7 @@ export class ExamCorrect {
|
|||||||
if (v === null) {
|
if (v === null) {
|
||||||
resultCell.innerHTML = '<i class="fas fa-fw fa-trash"></i>';
|
resultCell.innerHTML = '<i class="fas fa-fw fa-trash"></i>';
|
||||||
resultCell.classList.remove('exam-correct--result-unconfirmed');
|
resultCell.classList.remove('exam-correct--result-unconfirmed');
|
||||||
} else if (v && v.result) {
|
} else if (v && v.result !== undefined && v.result !== null) {
|
||||||
resultCell.innerHTML = v.result;
|
resultCell.innerHTML = v.result;
|
||||||
resultCell.classList.remove('exam-correct--result-unconfirmed');
|
resultCell.classList.remove('exam-correct--result-unconfirmed');
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user