]> git.mjollnir.org Git - moodle.git/commitdiff
When editing some question types, the options get jumbled up.
authortjhunt <tjhunt>
Mon, 29 Jan 2007 12:35:29 +0000 (12:35 +0000)
committertjhunt <tjhunt>
Mon, 29 Jan 2007 12:35:29 +0000 (12:35 +0000)
question/type/calculated/questiontype.php
question/type/match/questiontype.php
question/type/multianswer/questiontype.php
question/type/questiontype.php
question/type/rqp/types.php
question/type/truefalse/questiontype.php

index 31d493e055ea7581883b473de2007f74634e8bc1..e2e7eb8efb91f5085fe9077f1a89374e7f01c8d1 100644 (file)
@@ -60,7 +60,8 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
                     c.correctanswerlength, c.id AS calcid
                FROM {$CFG->prefix}question_answers a,
                     {$CFG->prefix}question_calculated c
-              WHERE c.question = $question->id AND a.id = c.answer")) {
+              WHERE c.question = $question->id AND a.id = c.answer
+           ORDER BY a.id ASC")) {
             $oldanswers = array();
         }
 
index 7e5d26c32c080121b88b550d580ca89bb2ed8e61..c1538b82e241455494c2f7930539e1bd1e780277 100644 (file)
@@ -13,7 +13,7 @@ class question_match_qtype extends default_questiontype {
 
     function get_question_options(&$question) {
         $question->options = get_record('question_match', 'question', $question->id);
-        $question->options->subquestions = get_records("question_match_sub", "question", $question->id, "id ASC" );
+        $question->options->subquestions = get_records('question_match_sub', 'question', $question->id, 'id ASC');
         return true;
     }
 
@@ -110,8 +110,7 @@ class question_match_qtype extends default_questiontype {
     }
 
     function create_session_and_responses(&$question, &$state, $cmoptions, $attempt) {
-        if (!$state->options->subquestions = get_records('question_match_sub',
-                'question', $question->id)) {
+        if (!$state->options->subquestions = get_records('question_match_sub', 'question', $question->id, 'id ASC')) {
             notify('Error: Missing subquestions!');
             return false;
         }
@@ -147,8 +146,7 @@ class question_match_qtype extends default_questiontype {
         $responses = array_map(create_function('$val',
          'return explode("-", $val);'), $responses);
 
-        if (!$questions = get_records('question_match_sub',
-         'question', $question->id)) {
+        if (!$questions = get_records('question_match_sub', 'question', $question->id, 'id ASC')) {
            notify('Error: Missing subquestions!');
            return false;
         }
@@ -416,7 +414,7 @@ class question_match_qtype extends default_questiontype {
 
         $status = true;
 
-        $matchs = get_records("question_match_sub","question",$question,"id");
+        $matchs = get_records('question_match_sub', 'question', $question, 'id ASC');
         //If there are matchs
         if ($matchs) {
             $status = fwrite ($bf,start_tag("MATCHS",6,true));
index 910cc234bbd1df64eaba74fc88bcf19a4c7ef043..4bdc51c20ab9c9873e8639a908400a9b725112a2 100644 (file)
@@ -28,7 +28,7 @@ class embedded_cloze_qtype extends default_questiontype {
             return false;
         }
 
-        $wrappedquestions = get_records_list('question', 'id', $sequence);
+        $wrappedquestions = get_records_list('question', 'id', $sequence, 'id ASC');
 
         // We want an array with question ids as index and the positions as values
         $sequence = array_flip(explode(',', $sequence));
index 2e7d7cb4047bbb592b9360fdc7eb650ceb66372d..14f44a59d4587d0e8f7b371f3ab852e0ccb10786 100644 (file)
@@ -271,8 +271,7 @@ class default_questiontype {
             $question->options = new object;
         }
         // The default implementation attaches all answers for this question
-        $question->options->answers = get_records('question_answers', 'question',
-         $question->id);
+        $question->options->answers = get_records('question_answers', 'question', $question->id, 'id ASC');
         return true;
     }
 
index d3c5f51238c773fa332d2968f5d1ed22c0381821..3132f08262a3939194cba63264ab2aae3dfe5a31 100644 (file)
 
     if ($types) {
         foreach ($types as $type) {
-            if (!$servers = get_records('question_rqp_servers', 'typeid', $type->id)) {
+            if (!$servers = get_records('question_rqp_servers', 'typeid', $type->id, 'id ASC')) {
                 delete_records('question_rqp_types', 'id', $type->id);
             } else {
                 foreach ($servers as $server) {
index 50ad3888140cc335883d30c05dd00949dc34ae3a..11cd11c725db5f65619f1725a20e4d13c8b3f08f 100644 (file)
@@ -102,7 +102,7 @@ class question_truefalse_qtype extends default_questiontype {
             return false;
         }
         // Load the answers
-        if (!$question->options->answers = get_records('question_answers', 'question', $question->id)) {
+        if (!$question->options->answers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
            notify('Error: Missing question answers!');
            return false;
         }