Autosubmission of quizzes

Autosubmission of quizzes

av H Singh -
Galle vástádusa: 7

In this lockdown period, many of us are using Moodle (ver. 3.5) to conduct exams and other assessments for students who are away from campus.

I noticed something really odd today. I had a quiz activity closing at 11:59 PM (open attempts submitted automatically).  I found that in a class of 147, 11 students' attempts had not been closed automatically by 12:07 AM, and 1 is open as late 12:36 AM. I have googled for this, and it seems that there is a housekeeping job that is supposed to close abandoned or other quiz attempts.

This is not expected behavior, is it? I get that no student is really getting extra time, but we are now talking about students accessing Moodle from a variety of different networking environments (2G hotspot, to high-speed internet and everything in between). We cannot rely on the students logging in to try to close the attempts (which was mentioned as one of the triggers for the quiz finally closing). So, what is the recommended SOP?

Gjennomsnittlig vurdering: -
Vástádussan geasa: H Singh

Re: Autosubmission of quizzes

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers
There is a housekeeping job which will close the attempts. However, the time it runs and does that is a bit meaningless, and that is the time which is recorded (MDL-54907).

However, in addition to the housekeeping job, if the student tries to access their attempt after the close time, then that also causes the attempt to be closed immediately.
Vástádussan geasa: Tim Hunt

Re: Autosubmission of quizzes

av H Singh -
Thanks. I already had gone through that link. However, neither of those two options is ideal, is it?

We cannot rely on student logins, as one might be talking of the last exam before summer hols. In that case, no one is going to login for two months after the end of the last exam. Or screening exams for interviews, where the candidate is a one-time visitor to your campus, and the evals on the quiz are needed immediately. And impersonating as individual students is also out of the question as we have very large classes. My colleagues are finding that sometimes as many 15-20 students leave without clicking submit (which is probably the genesis of the problem).

In cases where the results of a public exam (and associated logs) are taxpayer property, the end time of the exam becomes very significant in reporting and quality assurance. It would be next to impossible for me to explain to an unamused external reviewer that an exam for some candidates closing 9 hours after the purported end of the exam is harmless. This is a particularly rich area in terms of litigation, where even the appearance of impropriety can land you in trouble since the level of public scrutiny is so high.

Why doesn't Moodle quiz end activity trigger a forced closure of all open quiz attempts? At least that is what it says on the tin (open attempts are submitted automatically), doesn't it?
Vástádussan geasa: H Singh

Re: Autosubmission of quizzes

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers

Why can't we do [a bunch of simplistic things]? Because the world is complex and messy.

As, you say, there are big classes. So, if you try to process all attempts simultaneously the second time expires, what happens? You almost certainly crash the Moodle server (and hence lose the data belonging to some students). What Moodle does, have the scheduled task process the attempts one at a time in a measured way, is a much better choice.

Also, what do you mean by 'the second time expires'. Your students are not working on the Moodle server. They are working on some other computer over the internet. How fast is that connection. Dealing with one request from one user can often take more than a second. If you are too strict with enforcing the time-limit, then you can throw away responses that legitimately left the student's computer before time expired. (But, if you are too lax, you can open up the possibility for students to cheat by manipulating the clock on their local computer.)

Moodle never relies on students logging in. The attempts will be closed by the scheduled task when time allows. The point is: if there is a delay between the time limit passing and the attempt being processed how to you ensure there is no way for the student to submit any more answers, and the  answer is what Moodle does. If the student goes anywhere near the quiz attempt, then it is processed right then, without waiting for the scheduled task.

So, yes, what Moodle does is a messy compromise, but a necessary one that has been tuned over the years to actually work in the real world with finite servers and sometimes slow internet.

Being a messy compromise, there are bound to be ways it could be tweaked further to make it a little better. Moodle is open source. Patches welcome.

In addition to MDL-54907 and probably even more significant, the change I would like to get done is MDL-68806.

Vástádussan geasa: Tim Hunt

Re: Autosubmission of quizzes

av H Singh -
I greatly appreciate your help with Moodle over the years - the deferred question type with explanation has been a hit with my colleagues. You had coded this in 2015 upon my urging. Whenever I train colleagues, I always put you prominently in the acks.

I understand the history. Thanks for sharing it. Let me share a bit of experience. I have held close to 50 proctored exams with Moodle, each with 50-1000 students. Normally (before this lockdown), the students worked on on-campus machines, and they were very careful in logging out after clicking submit. Over the last 4-5 years of use, not even once have we had this problem in proctored exams. Reason - students are careful, and they always click submit, which manually triggers the exam close activity, or they are still on the quiz page when their clock runs out on them.

Moodle has never crashed for us even under simultaneous loads of as many as 15 different courses with assignment/quiz submission deadlines with anywhere between 40-500 students each. Our connections are fairly good on campus (10 Gbps backbone with optical data links for hostels).

Let us say the exam closes. And as you say, Moodle closes attempts one by one. Say it takes 2-3 milliseconds to close each attempt (I am probably being conservative here, this is probably faster than that). In a class of 50 students, that is 150 milliseconds of closing time. No one rational expects simultaneous closure. If someone even got a minute extra this way (and I am being generous), no one will bat an eyelid at it. That is still (a lot) better than pen and paper exams where it takes time to get all the sheets in, and such differentials can rise to as much as 5 minutes.

What I am talking about is quizzes being found partially ungraded anywhere between 9-36 hours later. That is what our problem is, and it is a complete mess now that students are working from home over all kinds of networks, ranging from 2G to high-speed broadband. No matter what the network is, what we do have are responses that Moodle saved (I can see these when I click on review attempt for a quiz attempt that is in progress). Moodle already has those saved on the server. If I wanted to, I could manually grade such a student (not possible in large classes). I am not connecting to a client when I see those attempts, am I? That means that Moodle is not waiting for any more information. It is, to all intents and purposes, stuck in a zombie state when it comes to that student's attempt. Maybe students could be nicer to us and click submit, but sometimes students just get sidetracked when they have completed the attempt early - they close the browser window after saving their answers, and do something else - it is their own machine that they are working on, so they are not worried about someone else butting in on an open session. Maybe they think they will come in later (before the closing time) to review their answers, but don't get the time - I can only guess. So, we end up with a more than a painful number of zombie attempts every quiz/assignment (lot of colleagues are using the quiz activity to create "assignments" because of auto-grading).

Can't the Moodle quiz close activity have a hook (call it a housekeeping hook) that checks whether a quiz is closed, say 1-5 minutes after the exam is supposed to have closed? Reason for those numbers  - I can justify the credibility of the exam if all students get roughly equal time to within a few minutes of each other. If the log says that a student's quiz attempt closed 10 hours later, then that is what the reviewer/judge (yes, exams do get litigated upon here) is going to believe - I cannot point him or her to you and say that "Please ignore the suspicious-looking log, and trust me/Moodle developers when we tell you that this student did not get any extra time.".

I guess what I am trying to say - because of the lockdown situation, we have uncovered a problem with the way Moodle handles quizzes. We are not looking for submissions simultaneous within microseconds - a few minutes is perfectly fine. Just not hours, or days later, please?
Vástádussan geasa: H Singh

Re: Autosubmission of quizzes

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers

I am really surprised it is adding up to hourse, not just minutes. Can you check some things:

1) Admin -> Plugins -> Activity modules -> Quiz -> (General settings ->) what is 'Last submission grace period' set to. That should not be siginificantly more than the default of 1 minute.

2) Under Admin -> ... No, you are on Moodle 3.5, so you can't just check this on the admin screens. (The UI Andrew Nicols added in 37 is really nice MDL-49399.)

Can you ask your server admins to find where the output from the Cron runs go, and look through it. It should contain snippets like

Execute scheduled task: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)
... started 21:15:09. Current memory use 13.7MB.
  Looking for quiz overdue quiz attempts...
  Considered 3 attempts in 3 quizzes.
... used 131 dbqueries
... used 0.3891921043396 seconds
Scheduled task complete: Updating overdue quiz attempts (mod_quiz\task\update_overdue_attempts)

That would let you see what this schedule task is doing, which would be helpful.

By the way, your estimate of "2-3 milliseconds to close each attempt" is very wrong. I would not be surprised if it was ~1s. Acutally, I just checked what the OU system does, it it seems to be about 0.5s per quiz attept.

Vástádussan geasa: Tim Hunt

Re: Autosubmission of quizzes

av H Singh -
Thanks.

It took some time to hear back from our overworked server admin. He has sent me a log file. I am including stuff related to autosubmission, that looks suspicious.
"Processing 7 assignment submissions ...
Processing assignment submission 83741 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 83740 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 78530 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 83252 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 83238 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 83222 ...
ERROR: handle_notification_sent - incomplete settings
Done
Processing assignment submission 83233 ...
ERROR: handle_notification_sent - incomplete settings
Done
Done processing 7 assignment submissions
... used 77 dbqueries
... used 1.9326550960541 seconds
done."

and

"Processing module function quiz_cron ...

  Looking for quiz overdue quiz attempts...
Error while processing attempt 32928 at 325 quiz:
Illegal formula syntax starting with '{L1}'
#0 /var/www/html/moodle/question/type/calculated/question.php(71): qtype_calculated_variable_substituter->calculate('(1-exp(-(1.1)*0...', '6', '1')
#1 /var/www/html/moodle/question/type/calculated/question.php(170): qtype_calculated_question->calculate_all_expressions()
#2 /var/www/html/moodle/question/type/calculated/question.php(60): qtype_calculated_question_helper::apply_attempt_state(Object(qtype_calculated_question), Object(question_attempt_step_read_only))
#3 /var/www/html/moodle/question/engine/questionattempt.php(1517): qtype_calculated_question->apply_attempt_state(Object(question_attempt_step_read_only))
#4 /var/www/html/moodle/question/engine/questionusage.php(941): question_attempt::load_from_records(Object(mysqli_native_moodle_recordset), '489785', Object(question_engine_unit_of_work), 'deferredfeedbac...')
#5 /var/www/html/moodle/question/engine/datalib.php(469): question_usage_by_activity::load_from_records(Object(mysqli_native_moodle_recordset), '41724')
#6 /var/www/html/moodle/question/engine/lib.php(84): question_engine_data_mapper->load_questions_usage_by_activity('41724')
#7 /var/www/html/moodle/mod/quiz/attemptlib.php(569): question_engine::load_questions_usage_by_activity('41724')
#8 /var/www/html/moodle/mod/quiz/cronlib.php(78): quiz_attempt->__construct(Object(stdClass), Object(stdClass), Object(stdClass), Object(stdClass))
#9 /var/www/html/moodle/mod/quiz/lib.php(598): mod_quiz_overdue_attempt_updater->update_overdue_attempts(1598097890, 1598097830)
#10 /var/www/html/moodle/lib/classes/task/legacy_plugin_cron_task.php(93): quiz_cron()
#11 /var/www/html/moodle/lib/cronlib.php(105): core\task\legacy_plugin_cron_task->execute()
#12 /var/www/html/moodle/lib/cronlib.php(67): cron_run_inner_scheduled_task(Object(core\task\legacy_plugin_cron_task))
#13 /var/www/html/moodle/admin/cli/cron.php(61): cron_run()
#14 {main}
...
...
...
  Considered 35 attempts in 3 quizzes.
Starting quiz reports
Processing cron function for quiz_statistics...
... started 17:34:52. Current memory use 195.6MB.

  Cleaning up old quiz statistics cache records...done. (1 dbqueries, 0 seconds)
Finished quiz reports
... used 2262 dbqueries
... used 2.0344040393829 seconds
done."


I do not know which course it corresponds to, but it sounds like one of my colleagues has an error in this quiz. There is nothing else in the file pertaining to quizzes (just some deletion of quizzes in one particular course). Unfortunately, the problems (happened this morning for several courses as well) were not captured in the log as the sysadmins had switched off logging earlier (they are concerned about the size of old logs), and they finally switched it on only on my request after the previous problems had resolved over a period of 4-5 hours:

One thing they noted was that the overall Moodle cron job is taking 150 minutes (isn't that high?). The University is running around 650 courses (as gleaned from Insights analysis error messages in the log).




Vástádussan geasa: H Singh

Re: Autosubmission of quizzes

av Tim Hunt -
Bilde av Core developers Bilde av Documentation writers Bilde av Particularly helpful Moodlers Bilde av Peer reviewers Bilde av Plugin developers
Cron definitely should not be taking 2.5 hours. The recommendation in modern Moodle versions is to have cron run every minute or so (and therefore each cron run should only last under a minute, and do a bit of work).

So, it is not that cron is being slow to close overdue quiz attempts. It is that cron is busy doing other stuff, and so does not get around to processing quiz attempts.

Anyway, this bad cron performance is something your server admins probably want to get to the bottom of.

In the logs you copied above, only the "Looking for quiz overdue quiz attempts..." bit is relevant - but it is part of a whole lot of processing related to the quiz, which it total took used 2.0344040393829 seconds. So, the quiz is not your problem. Once you sort out whatever is the problem with cron, then your quiz attempts will be closed punctually.