MDL-76843 quiz: fix statistics questions for missing questions
This commit is contained in:
+11
-8
@@ -940,23 +940,18 @@ function question_load_questions($questionids, $extrafields = '', $join = '') {
|
||||
* @param stdClass[]|null $filtercourses The courses to filter the course tags by.
|
||||
*/
|
||||
function _tidy_question($question, $category, array $tagobjects = null, array $filtercourses = null): void {
|
||||
// Load question-type specific fields.
|
||||
if (!question_bank::is_qtype_installed($question->qtype)) {
|
||||
$question->questiontext = html_writer::tag('p', get_string('warningmissingtype',
|
||||
'qtype_missingtype')) . $question->questiontext;
|
||||
}
|
||||
|
||||
// Convert numeric fields to float (Prevents these being displayed as 1.0000000.).
|
||||
// Convert numeric fields to float. This prevents these being displayed as 1.0000000.
|
||||
$question->defaultmark += 0;
|
||||
$question->penalty += 0;
|
||||
|
||||
// Indicate the question is now fully initialised.
|
||||
if (isset($question->_partiallyloaded)) {
|
||||
unset($question->_partiallyloaded);
|
||||
}
|
||||
|
||||
$question->categoryobject = $category;
|
||||
question_bank::get_qtype($question->qtype)->get_question_options($question);
|
||||
|
||||
// Add any tags we have been passed.
|
||||
if (!is_null($tagobjects)) {
|
||||
$categorycontext = context::instance_by_id($category->contextid);
|
||||
$sortedtagobjects = question_sort_tags($tagobjects, $categorycontext, $filtercourses);
|
||||
@@ -965,6 +960,14 @@ function _tidy_question($question, $category, array $tagobjects = null, array $f
|
||||
$question->tagobjects = $sortedtagobjects->tagobjects;
|
||||
$question->tags = $sortedtagobjects->tags;
|
||||
}
|
||||
|
||||
// Load question-type specific fields.
|
||||
if (question_bank::is_qtype_installed($question->qtype)) {
|
||||
question_bank::get_qtype($question->qtype)->get_question_options($question);
|
||||
} else {
|
||||
$question->questiontext = html_writer::tag('p', get_string('warningmissingtype',
|
||||
'qtype_missingtype')) . $question->questiontext;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user