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

Import/Export of truefalse questions in Moodle XML format is broken

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3, 1.7, 1.8
    • 1.6.4, 1.7.1, 1.8
    • Questions
    • None
    • MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE
    • MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE

    Description

      The symptom is that when you import a truefalse question, whether the correct answer is true or false gets scrambled (either sometimes or all the time).

      In the export file, there is no reliable way to tell which <answer> corresponds to true, and which to false.

      On export, it currently says: $expout .= $this->writetext(strtolower($answer->answer),3)."\n"; and it exports the two answers in the order the two records were returned by the database, which is essentially random.

      However, $answer->answer is get_string("true", "quiz"); That is, it depends on the language being used by the teacher at the time they created the question. So:

      1) It may contain unicode characters that strtolower will destroy.
      2) It cannot be reliably imported, because you don't know which language it was in.

      On import, the code seems to be assuming that the two answers will be in the file with true first then false, which I don't think can be relied on. Oh, and if it thinks the correct answer is 'false', it randomly swaps the two pieces of feedback.

      Attachments

        Activity

          People

            timhunt Tim Hunt
            timhunt Tim Hunt
            Nobody Nobody
            Safat Shahin, Tim Hunt, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              17/Jan/07