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

Restoring a matched question in a lesson leads to answers being processed in incorrect order

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.4, 2.2.1, 2.3
    • 2.1.5, 2.2.2
    • Backup, Lesson
    • MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • MDL-31386-master-1
    • Hide

      Preparation

      • Create a new course
      • Create a new lesson within that course
      • Choose Edit
      • Create a new 'Question Page'
      • Choose 'Matching' as the type
      • Set some answers for each field

      Backup

      • Create a new backup of the course

      Restore

      • Restore into the new course
      • Confirm that the question definition is correct for the restored question
      Show
      Preparation Create a new course Create a new lesson within that course Choose Edit Create a new 'Question Page' Choose 'Matching' as the type Set some answers for each field Backup Create a new backup of the course Restore Restore into the new course Confirm that the question definition is correct for the restored question

    Description

      When using a matched answer question in a lesson, the fields (Correct Answer, Wrong Answer, Answer 1, Answer n) are determined by the order of the answers in the database. That's to say that when they're retrieved, they are sorted by id ascending. As a result you get:

      • id 0: Correct Answer: "Correct Answer text"
      • id 1: Wrong Answer: "Wrong Answer text"
      • id 2: Answer 1: "Answer 1 text"
      • id 3: Answer 2: "Answer 2 text"
      • id 4: Answer 3: "Answer 3 text"

      When backing up a course with a lesson, these are ordered n reverse:

      <answer id="5">
      </answer>
      <answer id="4">
      </answer>
      <answer id="3">
      </answer>
      <answer id="2">
      </answer>
      <answer id="1">
      </answer>

      As a result, when the restore takes place, the questions are taken out of order and reversed:

      • id 0: Correct Answer: "Answer 3 text"
      • id 1: Wrong Answer: "Answer 2 text"
      • id 2: Answer 1: "Answer 1 text"
      • id 3: Answer 2: "Wrong Answer text"
      • id 4: Answer 3: "Correct Answer text"

      And you end up with the

      I can't decide whether the issue lies with:

      • the backup process reversing the order of the answers; or
      • the restore process not ordering the answers by the id in the XML structure.

      Attachments

        Issue Links

          Activity

            People

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Adrian Greeve Adrian Greeve
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Ankit Agarwal Ankit Agarwal
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Mar/12