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

Errors in Aiken format import can create corrupt questions

    XMLWordPrintable

Details

    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • MDL-63456-master
    • Hide

      Before moving to this code:
      (can do git reset --hard 3cced42eb37a1e92a2ff38feb1c099ec54cc4e20 to run last week master code, think testing these 1-7 steps only once in last week master is enough)
      _Note:_34 Resetting code to last week's release for stables:

      • 35

        git reset --hard 18c5565a1e8110c822ee488c566071fb89cd6c2d

      • 34

        git reset --hard 0dfa4a3c18eda5d6ec7dcc7b7770361f75533b8e

      1. Go into a course
      2. Head to the Question bank > Import
      3. Set Aiken format, and import the attached Test Aiken.txt file.
      4. You expect there to be an import error.
      5. Go to the question bank.
      6. Confirm you have one normal question "A good question 1", which you can edit and view regularly.
      7. Confirm you have a one normal question "A corrupt question". You should not be able to edit, view, or delete it. Getting an exception every time.

      Now, move to this code, then:
      (can do git reset --hard origin/master to be back to current master code, should be tested in all branches)

      1. Go and import that Aiken file again. Make sure Stop on error is set to yes.
      2. Confirm you see the messages:
        • "Error importing question A corrupt question"
        • "Question must have at least 2 answers on line 8"
        • Error(s) found parsing the import file. No questions have been imported.
      3. Click Continue.
      4. Confirm you still have your "A good question 1" and "A corrupt question", and no others.
      5. Confirm you can go to the edit page of "A corrupt question", with a debugging message.
      6. Go back to the question bank without saving, and delete both questions.
      7. Confirm you get a debugging message, but that both questions end up deleted.
      8. Go back to Import, and import the Aiken file, but setting Stop on Error to No.
      9. Confirm you see the messages:
        • "Error importing question A corrupt question"
        • "Question must have at least 2 answers on line 8"
        • "Importing 2 questions from file"
      10. Click continue
      11. Confirm you have two questions, "A good question 1", "A good question 2", and not "A corrupt question"
      Show
      Before moving to this code : (can do git reset --hard 3cced42eb37a1e92a2ff38feb1c099ec54cc4e20 to run last week master code, think testing these 1-7 steps only once in last week master is enough) _Note:_34 Resetting code to last week's release for stables: 35 git reset --hard 18c5565a1e8110c822ee488c566071fb89cd6c2d 34 git reset --hard 0dfa4a3c18eda5d6ec7dcc7b7770361f75533b8e Go into a course Head to the Question bank > Import Set Aiken format, and import the attached Test Aiken.txt file. You expect there to be an import error. Go to the question bank. Confirm you have one normal question "A good question 1", which you can edit and view regularly. Confirm you have a one normal question "A corrupt question". You should not be able to edit, view, or delete it. Getting an exception every time. Now, move to this code, then: (can do git reset --hard origin/master to be back to current master code, should be tested in all branches) Go and import that Aiken file again. Make sure Stop on error is set to yes. Confirm you see the messages: "Error importing question A corrupt question" "Question must have at least 2 answers on line 8" Error(s) found parsing the import file. No questions have been imported. Click Continue. Confirm you still have your "A good question 1" and "A corrupt question", and no others. Confirm you can go to the edit page of "A corrupt question", with a debugging message. Go back to the question bank without saving, and delete both questions. Confirm you get a debugging message, but that both questions end up deleted. Go back to Import, and import the Aiken file, but setting Stop on Error to No. Confirm you see the messages: "Error importing question A corrupt question" "Question must have at least 2 answers on line 8" "Importing 2 questions from file" Click continue Confirm you have two questions, "A good question 1", "A good question 2", and not "A corrupt question"

    Description

      If you have a mistake in an Aiken file, it can create a multi-choice question that is corrupt, having no record in qtype_multichoice_options, has no answers, and that you can't delete or edit. It can be added to a quiz via a random question, which will then break the quiz.

      An example bit of Aiken looks like this:

      Which LMS has the most quiz import formats?
      A) Moodle
      B)ATutor
      ANSWER: A

      Which will create a question with the title B)ATuror which is corrupt as talked about above. Now the importer does report an error This type of question requires at least 2 choices, but obviously the partial question is still saved.

      Attachments

        Activity

          People

            emerrill Eric Merrill
            emerrill Eric Merrill
            Tim Hunt Tim Hunt
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Safat Shahin, Tim Hunt, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Kevin Percy, Laurent David, Mathew May, Mihail Geshoski, Sabina Abellan, Sara Arjona (@sarjona), Shamim Rezaie
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              12/Nov/18

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h