WARNING Moodle 1.6 users: beware the regrade function !!

WARNING Moodle 1.6 users: beware the regrade function !!

par Jean-Michel Védrine,
Nombre de réponses : 8
Hello to all
While studying bug 5889 and bug 5890, I discovered a problem in the regrade code.
This problem was introduced in lib/questionlib.php in
revision 1.49, Sat May 13 16:57:17 2006 UTC so if you are running an older version of Moolde 1.6 you should not worry about this problem.
But if you are running a recent Moodle 1.6 version (and in particular if you are running Moodle 1.6 final version), don't use the regarde tab or you will loose all your students responses !!!
The bug is only a typo and the fix is very easy (1 line change). Look at bug 5889 to learn about fixing it yourself if you are in a hurry to have the regrade function working.
Moyenne des évaluations  -
En réponse à Jean-Michel Védrine

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Tim Allen,
Thanks a lot for the warning and debugging Jean-michel, it is appreciated!  sourire
En réponse à Jean-Michel Védrine

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Stephan Becker,
Thank you Jean-MIchel - given my very low programming capabilities, I think I will have to wait with installing Moodle 1.6 for a little bit.

Stephan
En réponse à Stephan Becker

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Peter Möbius,
Hi Jean-Michel,

It looks like I just did what you warned about. I seem to have lost results from a real exam using regrade this morning. I guess I should have read the forum first thing in the morning rather started working right away.

Is there any way whatsoever to get the data back, is it still somewhere in the database or will I have a lot of explaining to do with the vice chancellor? If anyone sees any way of restoring at least the raw data from essay-type responses, could you let me know as soon as possible, please?

Not just "a bit" panicked,

Peter
En réponse à Peter Möbius

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Tim Hunt,
Avatar Core developers Avatar Documentation writers Avatar Particularly helpful Moodlers Avatar Peer reviewers Avatar Plugin developers
The effect of the bug is to destroy the column event in table question_states. Basically it sets this column to 9, whereas it should be one of the other QUESTION_EVENT* constants listed at the top of questionlib.php, proably 3 or 6. Sorry, I am not sure which.

En réponse à Tim Hunt

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Peter Möbius,
Many thx, Tim. It is very reassuring to receive a response at this time. What you said seems to mean that the raw reponse data are still sitting somewhere and could be retrieved.(?) I will hang around the forum for a bit and see whether there are any other suggestions. If not I will have to tinker with a backup version of the database and question_states, and I will let everyone know how it went. Hope that not too many people need that information, though... Peter

P.S. This is my event table. Should I reset the value of event in row 490 to 3 or 6? Thx, Peter


SQL result

Host: localhost
Database: moodleexam
Generation Time: Jun 26, 2006 at 01:52 PM
SQL query: SELECT COUNT( * ) AS `Rows` , `event` FROM `mdl_question_states` GROUP BY `event` ORDER BY `Rows` ASC LIMIT 0, 30 ;
Rows: 5

Rows event
2 3
99 2
133 6
490 9
3501 0
En réponse à Tim Hunt

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Jean-Michel Védrine,
Hello Tim,
unfortunately this is not the only drawback of this bug because as the code was:
            if ($action->event = QUESTION_EVENTMANUALGRADE) {
                question_process_comment($question, $replaystate, $attempt, $states[$j]->comment, $states[$j]->grade);
            } else {
the question_process_comment function was executed IN ALL CASES and this resulted in a complete erasure of a lot of fields (seqnumber, answer, event, grade, rawgrade and penalty) in the question_states tables including all students responses stored in the answer field (I must admit that I don't still fully understand why this happend so maybe there is a chance they are still there in your case)
So I hope to be wrong but based on my tests I would say that all your students responses (including responses for essay questions) were erased in the database for all quizes were the Regrade function was used.
Sorry to report such bad news.
I was just fearing this on saturday when I discovered the problem and this is the reason why I posted in this forum with a capital warning.
En réponse à Jean-Michel Védrine

Re: WARNING Moodle 1.6 users: beware the regrade function !!

par Peter Möbius,
Hi Jean-Michel,

Thanks for the update and for spotting the bug. Looking at the tables (without really knowing much about the finer workings) I suspected as much. I still believe that MOODLE is the way to go, though. The exam will be repeated if need be, and I'm bracing for impactclin d’œil

You might wonder why I didn't have a proper backup of the course. The problem seems to be that I imported the qs from 1.5+, but 1.6 refused to back up the quiz telling me "Cannot quickly initialize page: empty course id." (which doesn' make much sense) I know I should have done a database dump as the next best thing, but I didn't. That's my fault.

Pete