mirror of
https://github.com/moodle/moodle.git
synced 2025-08-02 07:39:54 +02:00
MDL-57757 mod_lesson: Handle empty answers
This is and edge case created by a bug in the numeric question type.
This commit is contained in:
parent
79d5e88215
commit
86ff8ccd22
2 changed files with 5 additions and 3 deletions
|
@ -1860,8 +1860,10 @@ class mod_lesson_external extends external_api {
|
|||
'response' => new external_value(PARAM_RAW, 'The response text.'),
|
||||
'responseformat' => new external_format_value('response.'),
|
||||
'answers' => new external_multiple_structure(
|
||||
new external_multiple_structure(new external_value(PARAM_RAW, 'Possible answers and info.'))
|
||||
)
|
||||
new external_multiple_structure(new external_value(PARAM_RAW, 'Possible answers and info.')),
|
||||
'User answers',
|
||||
VALUE_OPTIONAL
|
||||
),
|
||||
), 'Answer data (empty in content pages created in Moodle 1.x).', VALUE_OPTIONAL
|
||||
)
|
||||
)
|
||||
|
|
|
@ -328,7 +328,7 @@ if ($action === 'delete') {
|
|||
$table->data[] = array($fontstart.get_string("question", "lesson").": <br />".$fontend.$fontstart2.$page->contents.$fontend2, " ");
|
||||
$table->data[] = array($fontstart.get_string("answer", "lesson").":".$fontend, ' ');
|
||||
// apply the font to each answer
|
||||
if (!empty($page->answerdata)) {
|
||||
if (!empty($page->answerdata->answers)) {
|
||||
foreach ($page->answerdata->answers as $answer){
|
||||
$modified = array();
|
||||
foreach ($answer as $single) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue