MDL-7567 Numerical questions occasionally mix up the order of their answers

This commit is contained in:
tjhunt
2006-11-15 16:55:40 +00:00
parent 32fd8433d9
commit 3a4cd9d998
3 changed files with 9 additions and 8 deletions
+6 -5
View File
@@ -33,7 +33,8 @@ class question_numerical_qtype extends question_shortanswer_qtype {
"FROM {$CFG->prefix}question_answers a, " .
" {$CFG->prefix}question_numerical n " .
"WHERE a.question = $question->id " .
"AND a.id = n.answer;")) {
"AND a.id = n.answer " .
"ORDER BY a.id ASC")) {
notify('Error: Missing question answer!');
return false;
}
@@ -94,11 +95,11 @@ class question_numerical_qtype extends question_shortanswer_qtype {
// interface, but the GIFT format supports it. The multianswer qtype,
// for example can make use of this feature.
// 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();
}
@@ -171,7 +172,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();
}
@@ -418,7 +419,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
@@ -34,7 +34,7 @@ class question_shortanswer_qtype extends default_questiontype {
}
function save_question_options($question) {
if (!$oldanswers = get_records("question_answers", "question", $question->id, "id ASC")) {
if (!$oldanswers = get_records('question_answers', 'question', $question->id, 'id ASC')) {
$oldanswers = array();
}
@@ -270,7 +270,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