mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-79863 qtype_ordering: qtype/ordering ensure get_possible_responses does not fail even if there is no correct response
This commit is contained in:
parent
32559a356c
commit
b307db44c8
@ -298,14 +298,15 @@ class qtype_ordering extends question_type {
|
||||
public function get_possible_responses($questiondata) {
|
||||
$responses = array();
|
||||
$question = $this->make_question($questiondata);
|
||||
foreach ($question->correctresponse as $position => $answerid) {
|
||||
$responses[] = $position.': '.$question->answers[$answerid]->answer;
|
||||
if ($question->correctresponse) {
|
||||
foreach ($question->correctresponse as $position => $answerid) {
|
||||
$responses[] = $position.': '.$question->answers[$answerid]->answer;
|
||||
}
|
||||
}
|
||||
$responses = array(
|
||||
0 => question_possible_response::no_response(),
|
||||
1 => implode(', ', $responses)
|
||||
);
|
||||
return;
|
||||
return array(
|
||||
0 => question_possible_response::no_response(),
|
||||
1 => implode(', ', $responses)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,5 +29,5 @@ $plugin->cron = 0;
|
||||
$plugin->component = 'qtype_ordering';
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
$plugin->requires = 2010112400; // Moodle 2.0
|
||||
$plugin->version = 2018061870;
|
||||
$plugin->release = '2018-06-18 (70)';
|
||||
$plugin->version = 2018062971;
|
||||
$plugin->release = '2018-06-29 (71)';
|
||||
|
Loading…
x
Reference in New Issue
Block a user