]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-7567 Numerical questions occasionally mix up the order of their answers. Merged...
authortjhunt <tjhunt>
Wed, 15 Nov 2006 16:58:44 +0000 (16:58 +0000)
committertjhunt <tjhunt>
Wed, 15 Nov 2006 16:58:44 +0000 (16:58 +0000)
question/type/numerical/questiontype.php
question/type/shortanswer/editquestion.php
question/type/shortanswer/questiontype.php

index 7b9a0830c9667507e56b625c3b216ce2b072e779..5f33688bcc0b49a2e150605b39d9ff833fe9ee76 100644 (file)
@@ -96,11 +96,11 @@ class question_numerical_qtype extends question_shortanswer_qtype {
     function save_question_options($question) {
         
         // Get old versions of the objects
-        if (!$oldanswers = get_records("question_answers", "question", $question->id)) {
+        if (!$oldanswers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
             $oldanswers = array();
         }
 
-        if (!$oldoptions = get_records("question_numerical", "question", $question->id)) {
+        if (!$oldoptions = get_records('question_numerical', 'question', $question->id, 'answer ASC')) {
             $oldoptions = array();
         }
 
@@ -193,7 +193,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
     }
 
     function save_numerical_units($question) {
-        if (!$oldunits = get_records("question_numerical_units", "question", $question->id)) {
+        if (!$oldunits = get_records('question_numerical_units', 'question', $question->id, 'id ASC')) {
             $oldunits = array();
         }
 
@@ -424,7 +424,7 @@ class question_numerical_qtype extends question_shortanswer_qtype {
 
         $status = true;
 
-        $numericals = get_records("question_numerical","question",$question,"id");
+        $numericals = get_records('question_numerical', 'question', $question, 'id ASC');
         //If there are numericals
         if ($numericals) {
             //Iterate over each numerical
index 164b41e3af9bfb6f365d6b841f9bb72ddfc389f3..9580402791443e016bf076f6be202098b1cc0309 100644 (file)
@@ -5,7 +5,7 @@
         $options->usecase = 0;
     }
     if (!empty($options->answers)) {
-        $answersraw = get_records_list("question_answers", "id", $options->answers);
+        $answersraw = get_records_list('question_answers', 'id', $options->answers, 'id ASC');
     }
 
     $answers = array();
index 07ae2e3d964fd26583aecfca0bb76a9e57221a81..94bdd4b30e0a769f3046a63e5e04f79d5f54d43f 100644 (file)
@@ -37,7 +37,7 @@ class question_shortanswer_qtype extends default_questiontype {
     function save_question_options($question) {
         $result = new stdClass;
         
-        if (!$oldanswers = get_records("question_answers", "question", $question->id, "id ASC")) {
+        if (!$oldanswers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
             $oldanswers = array();
         }
 
@@ -228,7 +228,7 @@ class question_shortanswer_qtype extends default_questiontype {
 
         $status = true;
 
-        $shortanswers = get_records("question_shortanswer","question",$question,"id");
+        $shortanswers = get_records('question_shortanswer', 'question', $question, 'id ASC');
         //If there are shortanswers
         if ($shortanswers) {
             //Iterate over each shortanswer