From: tjhunt Date: Wed, 15 Nov 2006 16:58:44 +0000 (+0000) Subject: MDL-7567 Numerical questions occasionally mix up the order of their answers. Merged... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a4d79b0eb5a9e1cbf257fb38232bc3d8f4988171;p=moodle.git MDL-7567 Numerical questions occasionally mix up the order of their answers. Merged from MOODLE_16_STABLE. --- diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index 7b9a0830c9..5f33688bcc 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -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 diff --git a/question/type/shortanswer/editquestion.php b/question/type/shortanswer/editquestion.php index 164b41e3af..9580402791 100644 --- a/question/type/shortanswer/editquestion.php +++ b/question/type/shortanswer/editquestion.php @@ -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(); diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index 07ae2e3d96..94bdd4b30e 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -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