Numbas icon indicating copy to clipboard operation
Numbas copied to clipboard

Issue 515 confirm end

Open vishwa58 opened this issue 3 years ago • 3 comments

#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

  1. 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
  2. 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.
  3. 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.

vishwa58 avatar Apr 22 '21 03:04 vishwa58

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!

ugoertz avatar Apr 22 '21 06:04 ugoertz

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?

vishwa58 avatar Apr 25 '21 19:04 vishwa58

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.

christianp avatar Apr 26 '21 12:04 christianp

Closed due to lack of activity.

christianp avatar May 04 '23 06:05 christianp