MDL-7567 Numerical questions occasionally mix up the order of their answers. Merged from MOODLE_16_STABLE.

This commit is contained in:
tjhunt
2006-11-15 16:58:44 +00:00
parent 1b091f37c3
commit a4d79b0eb5
3 changed files with 7 additions and 7 deletions
+4 -4
View 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
+1 -1
View 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();
+2 -2
View 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