Moodle

overriding grade of randomly added questions in quiz doesn't work

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Duplicate
  • Affects Version/s: 1.6.3
  • Fix Version/s: None
  • Component/s: Questions, Quiz
  • Labels:
    None
  • Affected Branches:
    MOODLE_16_STABLE

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

Activity

Hide
Taum Hanlon added a comment -

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.

Show
Taum Hanlon added a comment - 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.
Hide
Taum Hanlon added a comment -

I made the suggested changes and it mostly worked.

I started seeing the comments and grade change that had been made on the particular question... but I still wasn't seeing anything for "History of Responses" to the question.

So I made the same change ( swapping $question->id with $state->question ) in the history function a couple lines down (in both parts of the for loop)

Comments/Overrides now seem to show up as they do on non-random quizes... *but the comments in the "History of Responses" section are now all prepended with stuff like 'dataset14'.

Show
Taum Hanlon added a comment - I made the suggested changes and it mostly worked. I started seeing the comments and grade change that had been made on the particular question... but I still wasn't seeing anything for "History of Responses" to the question. So I made the same change ( swapping $question->id with $state->question ) in the history function a couple lines down (in both parts of the for loop) Comments/Overrides now seem to show up as they do on non-random quizes... *but the comments in the "History of Responses" section are now all prepended with stuff like 'dataset14'.
Hide
Taum Hanlon added a comment -

I overlooked that making these changes to the history function resulted in a "Wrongly formatted raw response answer" error being displayed under the top information block.

Show
Taum Hanlon added a comment - I overlooked that making these changes to the history function resulted in a "Wrongly formatted raw response answer" error being displayed under the top information block.
Hide
P Sunthar added a comment -
Show
P Sunthar added a comment - MDL-7698 is similar to MDL-5192 (see comments in MDL-5192) http://tracker.moodle.org/browse/MDL-5192#action_25810

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: