Change question behavior for submitted quizzes

Change question behavior for submitted quizzes

by Zvonko Martinović -
Number of replies: 2

Hello, what would be the easiest way to change question behavior for submitted quizzes?

One of our teacher has created a quiz and set it "Manually graded". Lots of students have completed the test but now he would like to be able to auto grade all question. Of course, setting quiz to "Deferred feedback" is not doing anything for submitted quizzes.

I guess this can be changed in DB but what tables and records do I need to edit? Maybe a short sql to do it for the entire quiz would be nice :D

Thanks,
Zvonko

Average of ratings: -
In reply to Zvonko Martinović

Re: Change question behavior for submitted quizzes

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 easy way to do this.

See this forum thread https://moodle.org/mod/forum/discuss.php?d=221113#p965242 for the scary details of fixing this in the database.

Once you have made these changes in the database, you need to go to Quiz administration -> Results -> Grades, and regrade the quiz.

In reply to Tim Hunt

Re: Change question behavior for submitted quizzes

by Zvonko Martinović -

Nice smile

We only need to skip essay questions as they need to be manually graded, so for me this seems to work:

UPDATE mdl_question_attempts
SET behaviour = 'deferredfeedback'
FROM mdl_question
WHERE questionusageid IN (
    SELECT uniqueid
    FROM mdl_quiz_attempts
    WHERE quiz = {quiz_id}
)
AND questionid = mdl_question.id
AND qtype <> 'essay'
AND behaviour = 'manualgraded'

Thanks Tim!