Details
Description
We've created a quiz with randomly added questions. When we try to override the grade of an individual answer via the "Make comment or override grade" link, we cannot save the modified grade but get the error message "Could not insert entry in question_sessions".
It seems that the link "Make comment or ovveride grade" uses the wrong question-id for overriding the grade and therefore choses incorrect (or non-existent) question_state entries in the question_states table which later causes the described error message ($state->id is null).
Our solution was to change line 481 in moodle/question/type/questiontype.php
$commentlink = '<div class="commentlink">'.link_to_popup_window ($options->questioncommentlink.'?attempt='.$state->attempt.'&question='.$question->id,
'commentquestion', $strcomment, 450, 650, $strcomment, 'none', true).'</div>';
to
$commentlink = '<div class="commentlink">'.link_to_popup_window ($options->questioncommentlink.'?attempt='.$state->attempt.'&question='.$state->question,
'commentquestion', $strcomment, 450, 650, $strcomment, 'none', true).'</div>';
i.e.: $question->id was replaced by $state->question.
As far as we could figure out, $state->question holds the correct questionid for randomly added questions.
which seems to work.
Issue Links
| This issue duplicates: | ||||
| MDL-4004 | Make the manual grading report work with random questions that pick manually graded questions |
|
|
|
I noticed a similar issue on 1.6.3 and still have it after upgrading to 1.6.4
It's described here: http://moodle.org/mod/forum/discuss.php?d=62696 but if differs in that there is no error message about not being able to save the comment.
If the grade on a question is changed it *does show up in the total for that attempt, but the question itself does *not show any sign that the grade has been changed or a comment made.
This is on moodle 1.6.3, and now 1.6.4, with php 4.4.4 and Mysql 5.0.24
I have not tried the above suggestion but will do so today.