-
Bug
-
Resolution: Fixed
-
Minor
-
2.0.6
-
windows IIS, MySQL
-
MySQL
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
-
-
If you look at the function get_question_options in 2.0.1+ (yes we plan on upgrading) in \moodle\question\type\questiontype.php you will see
$extra_answer_fields = $this->extra_answer_fields();
if (is_array($extra_answer_fields)) {
$answer_extension_table = array_shift($extra_answer_fields);
$question->options->answers = $DB->get_records_sql("
SELECT qa.*, qax." . implode(', qax.', $extra_answer_fields) . "
FROM
WHERE qa.questionid = ? AND qax.answerid = qa.id", 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); return false; }
}
note that
SELECT qa.*, qax." . implode(', qax.', $extra_answer_fields) . "
FROM {question_answers}
qa, {$answer_extension_table} qax
WHERE qa.questionid = ? AND qax.answerid = qa.id", array($question->id)
uses 'qa.questionid' whereas in the database the field is called 'question'. Easy fix is override but...