Numbas
Numbas copied to clipboard
Issue 515 confirm end
#515
This pull request was created in response to issue 515 "Force students to type something to enter exam"
The goal of this pull request was to make sure that students did not carelessly end the exam.
In order to fix this issue, I made it mandatory to type "end" into a text box before you could click the "ok" button when you end the exam
I made 3 majors changes as suggested by the origin poster
- In themes/default/files/scripts/display-base.js, I added a new modal, which includes a text box where a student can type "end" before ending the exam
- I added a new function to themes/default/files/scripts/display-base.js called confirmEndExam. This function is called in runtime/scripts/exam.js rather than the function showConfirm.
- I edited runtime/scripts/exam.js in two places. First, I changed the showConfirm function to confirmEndExam, and next I created a guard so that the end function could only trigger if the word "end" was written in the text box.
Hello! I would like to make two comments: Ideally, I think, this feature could be switched on (or off) for each exam individually in the editor. (I think that for most of my exams I would prefer not to use it, since there is already a confirmation dialog which should be sufficient for students who are familiar with the system, in particular for exams where further attempts are allowed.) In addition, the string "end" should probably not be hard-coded, but should be translated to the display language of the exam. Thanks for considering this!
Those are both great points, I will look into them! Thank you! Just wondering, do you know how to set it up, so it can be translated easily?
You can use the R
function to localise strings; a corresponding entry should be added to locales/en-GB.json
(and the others, once it's been translated)
I agree with @ugoertz that it should be an exam-level setting to turn this on or off, and to configure what you need to type.
Closed due to lack of activity.