From 368cc39e7e8c2bd9987726e48c00095832a147b5 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Wed, 15 Nov 2006 16:56:02 +0000 Subject: [PATCH] MDL-7567 Numerical questions occasionally mix up the order of their answers. Merged from MOODLE_16_STABLE. --- question/type/numerical/questiontype.php | 8 ++++---- question/type/shortanswer/editquestion.php | 2 +- question/type/shortanswer/questiontype.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/question/type/numerical/questiontype.php b/question/type/numerical/questiontype.php index 7b9a0830c9667..5f33688bcc0b4 100644 --- a/question/type/numerical/questiontype.php +++ b/question/type/numerical/questiontype.php @@ -96,11 +96,11 @@ function get_default_numerical_unit(&$question) { 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 @@ function save_question_options($question) { } 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 @@ function backup($bf,$preferences,$question,$level=6) { $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 164b41e3af9bf..9580402791443 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 07ae2e3d964fd..94bdd4b30e0a7 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -37,7 +37,7 @@ function get_question_options(&$question) { 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 @@ function backup($bf,$preferences,$question,$level=6) { $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