Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 96c7aa3fe5c79769e7f2a6a4acb191997171a0c3 1 parent a3b71db
James Pratt authored July 06, 2011 samhemelryk committed July 11, 2011

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. 3  question/type/questiontypebase.php
3  question/type/questiontypebase.php
@@ -630,7 +630,8 @@ public function get_question_options($question) {
630 630
             $question->options->answers = $DB->get_records_sql("
631 631
                     SELECT qa.*, qax." . implode(', qax.', $extraanswerfields) . "
632 632
                     FROM {question_answers} qa, {{$answer_extension_table}} qax
633  
-                    WHERE qa.question = ? AND qax.answerid = qa.id", array($question->id));
  633
+                    WHERE qa.question = ? AND qax.answerid = qa.id
  634
+                    ORDER BY qa.id", array($question->id));
634 635
             if (!$question->options->answers) {
635 636
                 echo $OUTPUT->notification('Failed to load question answers from the table ' .
636 637
                         $answer_extension_table . 'for questionid ' . $question->id);

0 notes on commit 96c7aa3

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