Cleaning Out Old #Moodle 1.9 Quiz Results

A colleague on the email list recently asked...
I have an industrial arts teacher that now uses Moodle 1.9 quizzes for all of his shop safety tests. He uses the same quizzes for 3 grade levels, thus the students are removed and re-enroll yearly. Now that we've rolled over to a new year, he reset the course, effectively removing all students. The issue that we're having is that when students enroll for a second time, their prior quiz scores reappear. Sure, the teacher can select all scores and delete them, but I am wondering if there isn't a method for achieving this in bulk, clearing all attempts for all quizzes with a single action.

Below is my response:
I'm sure there is a better solution than the one I'm going to offer but...

What about backing up the course and restoring it? Backup the previous course with user info and save it somewhere so you have it. 
You've probably already thought of that solution.

Some related discussions happening here for Moodle 2.0 but I found the following two excerpts informative:
Version 2.0 deletes all grades information for students unenrolled from a course.  This is opposite from previous behavior and IMO very undesireable.  A moderate number of times each term a student will get accidentally unenrolled from a course.  Retention of grades information permits them to be re-enrolled without issue.
Moodle courses are not designed to be reused for each new year while keeping all the old history in there. It may work in some cases but it is recommended to create a fresh copy of the course each year and at the end either hide the course are disable all enrolments.The keeping of all course info after full unenrolment is not a real solution because it causes problems in other scenarios. Source for remarks:

Another possibility might be to edit the MySQL dbase to remove quiz results. Hmm...just playing here:

You could find the quiz you want to modify in the course like this:

SELECT id, course,name
FROM `mdl_quiz` 
WHERE name = 'Module 1 Test'
AND course =27
LIMIT 0 , 30

name=Module 1 Test

Note that ID in mdl_quiz is the quiz in mdl_quiz_grades...

FROM `mdl_quiz_grades`
WHERE quiz =34
LIMIT 0 , 30

To remove these results:
DELETE FROM mdl_quiz_gradesWHERE quiz=34
That would remove all the quiz grades.

Before trying anything suggested here, make backups. Even better, duplicate your moodle instance and then experiment on the duplicate rather than the original.

Get Blog Updates via Email!
Enter your email address:
Delivered by FeedBurner

Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure


Popular posts from this blog

#Chromecast Add-Ons to Play Various Video File Formats

Free Professional Learning! Education On Air #googleedu

10 Steps to a Blended Learning Classroom #MIEexpert #MIE #tceamie1