When a QCM is open, a student can access it.
If the teacher closes the QCM, the student can't submit anymore. The student would have no point even if the answer is sent 1 second too late.
Solution
Record partial answers as soon as a student types something or selects an answer.
It allows us to have 'partial' answers for a student who started the QCM on time (when it was opened) and finished it late (when it was closed).
A js function is called every time a radio is clicked or a textarea lose focus and send an AJAX request with the student answers as a JSON object.
It is then recorded normally since the format is the same.
The only difference with a "Envoyer" answer is this work isn't marked as "submitted" (on purpose).
It will generate A LOT of requests, which is bad...
I had to add a "Je ne sais pas" answer for every radio choice in first position (ie. selected by default). It may go if I find a better way.
I had to write a lot of "dynamic JS" ie. JS with Jinja elements... which is prone to errors.
I would like to change that, but I'll have to serialize the (questions, answers) object. Might not be that difficult.
Other solutions
Ignore the submission completely ie. what we already have. Disappointing for the student.
Accept late answers, marked as "x mins late". It will require us to set a "due" date and will complicate the teacher task. It is definitely simpler. I fear the almost impossible situation where a student get the id_qcm and forge a request at home...
This simpler solution only requires a few database changes.
Record partial answers.
It's a heavy one.
Problem
When a QCM is open, a student can access it. If the teacher closes the QCM, the student can't submit anymore. The student would have no point even if the answer is sent 1 second too late.
Solution
Record partial answers as soon as a student types something or selects an answer.
It allows us to have 'partial' answers for a student who started the QCM on time (when it was opened) and finished it late (when it was closed).
A js function is called every time a radio is clicked or a textarea lose focus and send an AJAX request with the student answers as a JSON object.
It is then recorded normally since the format is the same.
The only difference with a "Envoyer" answer is this work isn't marked as "submitted" (on purpose).
It will generate A LOT of requests, which is bad...
I had to add a "Je ne sais pas" answer for every radio choice in first position (ie. selected by default). It may go if I find a better way.
I had to write a lot of "dynamic JS" ie. JS with Jinja elements... which is prone to errors. I would like to change that, but I'll have to serialize the (questions, answers) object. Might not be that difficult.
Other solutions
id_qcm
and forge a request at home... This simpler solution only requires a few database changes.