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

Import of multichoice questions in Moodle XML format doesn't use shuffle option. Fix included

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.3
    • Component/s: Questions
    • Labels:
      None
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE

      Description

      The Moodle XML import (1.6.1+) for multichoice questions does not take into account if
      <shuffleanswers>1</shuffleanswers>
      exists in XML file. The problem is in function import_multichoice in format/xml/format.php.
      I took the code from import_matching function in that file. The diff is shown below and resolves the problem.

      — format.php 2006-09-07 14:12:24.124627200 +0200
      +++ format.php.2 2006-08-27 14:15:39.515446400 +0200
      @@ -120,15 +120,10 @@

      // 'header' parts particular to multichoice
      $qo->qtype = MULTICHOICE;
      $single = $question'#'['single'][0]'#';
      $qo->single = $this->trans_single( $single );

      • if (!empty($question'#'['shuffleanswers'])) { - $qo->shuffleanswers = $question['#']['shuffleanswers'][0]['#']; - }

        else

        { - $qo->shuffleanswers = false; - }

      // run through the answers
      $answers = $question'#'['answer'];
      $a_count = 0;
      foreach ($answers as $answer) {

        Attachments

          Activity

            People

            Assignee:
            timhunt Tim Hunt
            Reporter:
            fikar Miroslav Fikar
            Tester:
            Nobody Nobody
            Participants:
            Component watchers:
            Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              10/Oct/06