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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.3, 1.7, 1.8
    • Fix Version/s: 1.6.4, 1.7.1, 1.8
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE
    • Fixed Branches:
      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

            Assignee:
            timhunt Tim Hunt
            Reporter:
            timhunt Tim Hunt
            Tester:
            Nobody
            Participants:
            Component watchers:
            Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              17/Jan/07