Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-7698

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 1.6.3
    • Questions, Quiz
    • None
    • MOODLE_16_STABLE

      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.

            timhunt Tim Hunt
            rosiva Kurt Rosivatz
            Nobody Nobody
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.