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

QE2 upgrade fails on manually graded questions that have been deleted

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1, 2.2
    • Fix Version/s: 2.1.2
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      Migration-related bug; testing is complicated. Try the following:

      • Make a clean Moodle 1.9 installation.
      • Create a course and an empty quiz.
      • Create (at least) one essay question in the main category for the quiz, and one in a subcategory.
      • Add to the quiz:
        • One essay question from the main category
        • One random question taking essay questions from the subcategory
      • Log in as a student and take the quiz. Submit answers to the essay questions. Finish the attempt.
      • Log in as a teacher and grade the essay questions.
      • Now delete the essay questions (best done manually in the DB, from mdl_questions).
      • Run the upgrade routine to MOODLE_21_STABLE.

      Verify that during this upgrade, the QE 2 upgrader does not display error messages. Also, verify the output of the migration; the deleted questions should be displayed as "This question is missing. Unable to display anything." but not lead to fatal errors. (Use latest build; note dependency on MDL-28687.)

      Show
      Migration-related bug; testing is complicated. Try the following: Make a clean Moodle 1.9 installation. Create a course and an empty quiz. Create (at least) one essay question in the main category for the quiz, and one in a subcategory. Add to the quiz: One essay question from the main category One random question taking essay questions from the subcategory Log in as a student and take the quiz. Submit answers to the essay questions. Finish the attempt. Log in as a teacher and grade the essay questions. Now delete the essay questions (best done manually in the DB, from mdl_questions). Run the upgrade routine to MOODLE_21_STABLE. Verify that during this upgrade, the QE 2 upgrader does not display error messages. Also, verify the output of the migration; the deleted questions should be displayed as "This question is missing. Unable to display anything." but not lead to fatal errors. (Use latest build; note dependency on MDL-28687 .)
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      The following error message occurred during my QE2 upgrade (1.9 -> 2.1):

      Coding error detected, it must be fixed by a programmer: Unexpected event 7 in state 46454 in question session 17385.

      Situation in the data: The quiz at hand is composed of random questions; one of the "real questions" behind them was manually graded. Students made attempts and the teacher graded these. However, at a later point, the teacher must have deleted the question. Therefore, question states with event=7 (submission for manual grading) remain in the DB.

      In the code, the problem is that question_engine_attempt_upgrader::get_converter_class_name() uses the quiz's preferred behaviour in the case of a deleted question. This behaviour converter may not be able to deal with event 7, though. (For me, this was qbehaviour_deferredfeedback_converter.)

      Proposed fix (tested against my data): Scan the question_states table for any event=7 entries for the question. If any are present, assume that the deleted question was manually graded.

      Code change to follow; remark: I consider it a safe assumption that $question->id is an integer.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Oct/11