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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              rosiva Kurt Rosivatz
              Tester:
              Nobody
              Participants:
              Component watchers:
              Tim Hunt, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: