Event when quiz close time has passed

Event when quiz close time has passed

by Louis-Philippe Baron -
Number of replies: 3
Hello there,

I want to automatically get all grades of all attempts when a quiz closes (when end time has passed) to do an automatic export process to an external service. I found all quiz-related events on which I can sub, but none seems to be related to this behaviour.


A workaround can be to sub to quiz_attempt_submitted and try to deal with it, no probs about it, but I would prefer dealing with all attempts at the same time.


Am I right saying there is no event related to "quiz closed"-like event or am I missing something ?


Thanks by advance,

Average of ratings: -
In reply to Louis-Philippe Baron

Re: Event when quiz close time has passed

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

There is no event for this (because no particuarl Moodle code runs at that time.

Another way to solve this would be to make a scheduled task, which queries the quiz settings table, and finds all quizzes that have timeclose between when the task last ran, and now.

In reply to Tim Hunt

Re: Event when quiz close time has passed

by Louis-Philippe Baron -

Hello Tim,

Thanks confirming what I thought. Our system is now compliant with a single on it's API so I used the "quiz_attempt_submitted" event and I'm saving every attempt when it is finished and validated by moodle ; this event is doing the job.


Thanks for your reply tho !

In reply to Louis-Philippe Baron

Re: Event when quiz close time has passed

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That makes sense. If you ever start using User overrides in the quiz settings to allow some students to submit late, you will be glad you did it that way.