Skip to content
Browse files

MDL-28268 Missing ORDER BY when using extra answer table.

From OU bug #921 "Order of answer fields in Variable numeric keeps changing" Cannot
reproduce this bug on my system but hopefully this will fix the problem. I added
an ORDER BY clause to the sql for fetching answers with extra answer fields.
  • Loading branch information...
1 parent a3b71db commit 96c7aa3fe5c79769e7f2a6a4acb191997171a0c3 @jamiepratt jamiepratt committed with samhemelryk
Showing with 2 additions and 1 deletion.
  1. +2 −1 question/type/questiontypebase.php
3 question/type/questiontypebase.php
@@ -630,7 +630,8 @@ public function get_question_options($question) {
$question->options->answers = $DB->get_records_sql("
SELECT qa.*, qax." . implode(', qax.', $extraanswerfields) . "
FROM {question_answers} qa, {{$answer_extension_table}} qax
- WHERE qa.question = ? AND qax.answerid =", array($question->id));
+ WHERE qa.question = ? AND qax.answerid =
+ ORDER BY", array($question->id));
if (!$question->options->answers) {
echo $OUTPUT->notification('Failed to load question answers from the table ' .
$answer_extension_table . 'for questionid ' . $question->id);

0 comments on commit 96c7aa3

Please sign in to comment.
Something went wrong with that request. Please try again.