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

QE2 upgrade fails on bogus second start state when questiontype is 'multichoice'

    Details

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

      This bug can only be tested in a particular data state, which cannot be produced in the UI for all I know.

      You need to start from a Moodle 1.9 installation. This installation must contain a quiz with a multichoice question included. In an attempt on that question, there must be a non-start state (i.e., not the first state in the attempt) with empty answer, for example: "8917,8918,8919,8920:"

      Run the 1.9 -> 2.1 migration routine on this data. Verify that the particular attempt gets converted, and conversion does not fail with an error message.

      To make this more transparent, I have attached a piece of unit test code generated with the QE upgrade helper. I'm not sure whether you use unit tests in integration testing, but it should make clear what the state of the data is.

      Show
      This bug can only be tested in a particular data state, which cannot be produced in the UI for all I know. You need to start from a Moodle 1.9 installation. This installation must contain a quiz with a multichoice question included. In an attempt on that question, there must be a non-start state (i.e., not the first state in the attempt) with empty answer, for example: "8917,8918,8919,8920:" Run the 1.9 -> 2.1 migration routine on this data. Verify that the particular attempt gets converted, and conversion does not fail with an error message. To make this more transparent, I have attached a piece of unit test code generated with the QE upgrade helper. I'm not sure whether you use unit tests in integration testing, but it should make clear what the state of the data is.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      I ran into the following error message during the QE2 upgrade from Moodle 1.9 to 2.1

      "Coding error detected, it must be fixed by a programmer: Two inconsistent open states for question session 36362."

      Situation in the data: The affected question is a multichoice question. The question session turned out to have two start states (event=0), with sequence numbers 0 and 2. The answer in the second one was empty, with the answer string being "8917,8918,8919,8920:" .

      The code deals with these bogus start states with empty answers, in question_behaviour_attempt_updater::process0(). However, for determining whether the answer of state is empty, it checks whether the answer is an empty string. This is incorrect in the case of multichoice questions, where the answer string internally records the order of answers. In this case, the code should check whether the answer string ends in ":".

      Proposed fix will follow shortly.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

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