MDL-47494 ddimageortext: MDL-45111 quiz responses report : fatal error when counting responses
not all possible responses where returned by question type method.
This commit is contained in:
@@ -122,8 +122,12 @@ class qtype_ddtoimage_question_base extends qtype_gapselect_question_base {
|
||||
$choice = $this->choices[$group][$choiceno];
|
||||
|
||||
$correct = $this->get_right_choice_for($placeno) == $response[$fieldname];
|
||||
$parts[$placeno] = new question_classified_response(
|
||||
$choiceno, $choice->summarise(), $correct?1:0);
|
||||
if ($correct) {
|
||||
$grade = 1;
|
||||
} else {
|
||||
$grade = 0;
|
||||
}
|
||||
$parts[$placeno] = new question_classified_response($choiceno, $choice->summarise(), $grade);
|
||||
}
|
||||
return $parts;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class qtype_ddtoimage_base extends question_type {
|
||||
$this->initialise_combined_feedback($question, $questiondata, true);
|
||||
|
||||
$question->choices = array();
|
||||
$choiceindexmap= array();
|
||||
$choiceindexmap = array();
|
||||
|
||||
// Store the choices in arrays by group.
|
||||
foreach ($questiondata->options->drags as $dragdata) {
|
||||
@@ -165,18 +165,11 @@ class qtype_ddtoimage_base extends question_type {
|
||||
|
||||
$parts = array();
|
||||
foreach ($question->places as $placeno => $place) {
|
||||
$group = $place->group;
|
||||
$choices = array();
|
||||
|
||||
foreach ($question->choices[$group] as $i => $choice) {
|
||||
$summarisechoice = $choice->summarise();
|
||||
|
||||
foreach ($question->choices[$place->group] as $i => $choice) {
|
||||
$correct = $question->rightchoices[$placeno] == $i;
|
||||
if ($correct) {
|
||||
$choices[$choice->no] = new question_possible_response(
|
||||
$summarisechoice,
|
||||
$correct?1:0);
|
||||
}
|
||||
$choices[$choice->no] = new question_possible_response($choice->summarise(), $correct ? 1 : 0);
|
||||
}
|
||||
$choices[null] = question_possible_response::no_response();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user