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

Calculated questions should allow more than one unit with multiplier equal to 1

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.1, 2.6.1, 3.3.3, 3.4
    • Fix Version/s: 3.3.4, 3.4.1
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide
      1. Go to a course.
      2. Add a quiz activity.
      3. Click on the quiz activity.
      4. Under the settings cog choose 'Import' under 'Question bank'.
      5. Set "File format" to "Moodle XML format" and "Import questions from file" attach the file "questions-Physics-Default for zzz-20120206-1453.xml" and press "Import".
      6. Click "Continue" on the next page.
      7. Stay in question bank but go to questions.
      8. Select category "Default for zzz".
      9. Edit the question "zzz Force of two 1 kg masses..." (clicking on the gear).
      10. At the bottom of the following page, click "Save changes".
      11. In the next page, leave "Synchronise the data from shared datasets with other questions in a quiz" to "Do not synchronise", click "Next page".
      12. The process continues without error messages.
      Show
      Go to a course. Add a quiz activity. Click on the quiz activity. Under the settings cog choose 'Import' under 'Question bank'. Set "File format" to "Moodle XML format" and "Import questions from file" attach the file "questions-Physics-Default for zzz-20120206-1453.xml" and press "Import". Click "Continue" on the next page. Stay in question bank but go to questions. Select category "Default for zzz". Edit the question "zzz Force of two 1 kg masses..." (clicking on the gear). At the bottom of the following page, click "Save changes". In the next page, leave "Synchronise the data from shared datasets with other questions in a quiz" to "Do not synchronise", click "Next page". The process continues without error messages.
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_26_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull 3.4 Branch:
    • Pull Master Branch:
      MDL-31521-master

      Description

      Allow me to rephrase the full steps to reproduce.

      • Go to a course.
      • Open question bank import and do "Import questions from file" taking the attached file "questions-Physics-Default for zzz-20120206-1453.xml" in file formet "Moodle XML format".
      • Stay in question bank but go to questions.
      • Select category "Default for zzz".
      • Edit the question "zzz Force of two 1 kg masses..." (clicking on the gear).
      • At the bottom of the following page, click "Save changes".
      • In the next page, leave "Synchronise the data from shared datasets with other questions in a quiz" to "Do not synchronise", click "Next page".

      What you expect:

      • You're going to continue to edit the question.

      What actually happens:

      • Error: mdb->get_record() found more than one record! errors are shown.

       

      See http://moodle.org/mod/forum/discuss.php?d=195449
      the
      public function comment_on_datasetitems($qtypeobj, $questionid, $questiontext,
      $answers, $data, $number) {
      global $DB;
      $comment = new stdClass();
      $comment->stranswers = array();
      $comment->outsidelimit = false;
      $comment->answers = array();
      // Find a default unit:
      if (!empty($questionid) && $unit = $DB->get_record('question_numerical_units',
      array('question' => $questionid, 'multiplier' => 1.0))) {
      $unit = $unit->unit;
      should use another $DB function call to allow for more than one record.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/Jan/18