numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
202 stars 117 forks source link

Issue 515 confirm end #823

Closed vishwa58 closed 1 year ago

vishwa58 commented 3 years ago

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.
ugoertz commented 3 years ago

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!

vishwa58 commented 3 years ago

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?

christianp commented 3 years ago

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 commented 1 year ago

Closed due to lack of activity.