How to Reopen a Completed Moodle Quiz?
Here is the ultimate guide that highlights how you can reopen your completed Moodle quiz.
October 1, 2015
Moodle is one of the top online educational portals. Students can learn specific courses and then take quizzes at the end of the course to find out how much they have learned. I was searching for how to reopen a completed quiz in Moodle directly from the database, but I couldn’t find any information. I started experimenting with Moodle database structure myself, achieving the desired result I would like to share.
First of all, to reopen any completed quiz in Moodle, we should understand how Moodle handles quiz queries. Whenever a new quiz is started, Moodle saves ’“attempt_id” in a “mdl_quiz_attempts” table. Response to a question is saved in the “mdl_question_states” table, and the latest response to a question that is viewed in the quiz is logged in the “mdl_question_sessions” table. When a quiz is completed, Moodle grades it, updates the event’s flag, and puts the finish time against “ATTEMPT_ID”.
Since we want to allow a user to update his mistakes after completing a quiz, the following steps should be performed. First of all, set “timefinish” column value to zero (0) in “mdl_quiz_attempts” table against provided “attempt_id”. Now the attempt is marked open, but green and red marks will be shown along the questions and answers. To eliminate the grading, we need to reset the “event” column value to two (2) in “mdl_question_states” table. Now, updating the event status will remove the grades option along the questions. Now you can correct your answers from a completed quiz and mark it as completed again.