This is my first post in the forum, so please bear with me if anything is wrong.
I have a problem I've been working on with a colleague recently. For a specific need we have to change a question type in a moodle install, but have the need to retain all the attempts and grades, in order to preserve statistics.
So far, we've worked out a procedure that would be like this:
- Add the new activities (as we have more than one quiz/activity to change);
- Run a series of queries that does the following:
- Update mdl_quiz_attempts to set quiz=$new_quiz where quiz=$old_quiz;
- update mdl_quiz_grades to set quiz=$new_quiz where quiz=$old_quiz;
- delete from mdl_grade_grades where itemid=$new_item_id;
- update mdl_grade_grades set itemid=$new_item_id where itemid=$old_item_id;
- update mdl_course_modules set instance=$new_instance where instance=$old_instance and module=16;
- update mdl_course_modules set instance=$new_instance where instance=$old_instance and module=15;
- Swap back the entries in mdl_course_modules with the $new_instance, but that have the newest value, with $old_instance. This way we have the old quiz pointing to the new questions we created with the new type of plugin, and the new quiz pointing to the old question, that we would then like to discard.
We feel there is something else we should be treating, but we've been banging our heads against this wall trying different other changes with no luck. Googling is no help, so I hope somebody here could point me in the right direction.