Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions htdocs/js/apps/GatewayQuiz/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
// Gateway timer
const timerDiv = document.getElementById('gwTimer'); // The timer div element
let actuallySubmit = false; // This needs to be set to true to allow an actual submission.
const submitAnswers = document.gwquiz.elements.submitAnswers; // The 'Grade Test' submit button.
// The 'Grade Test' submit button.
const submitAnswers = document.gwquiz.elements.submitAnswers instanceof NodeList
? document.gwquiz.elements.submitAnswers[document.gwquiz.elements.submitAnswers.length - 1]
: document.gwquiz.elements.submitAnswers;
let timeDelta; // The difference between the browser time and the server time
let serverDueTime; // The time the test is due
let gracePeriod; // The grace period
Expand Down Expand Up @@ -115,7 +118,7 @@
};

// Show a confirmation dialog when a student clicks 'Grade Test'.
if (typeof submitAnswers?.dataset.confirmDialogMessage !== 'undefined') {
if (typeof submitAnswers?.dataset?.confirmDialogMessage !== 'undefined') {
submitAnswers.addEventListener('click', (evt) => {
// Don't show the dialog if the test is timed and in the last 90 seconds.
// The alerts above are now being shown telling the student to submit the test.
Expand Down