In question editing page there is no check on set two or more identical answers (same answer, answerformat, fraction, feedback, feedbackformat) to the same question.
There isn't a real reason to do that check in editing page but when I restore a course with this kind of questions I get some errors.
The answer ids are get with a get_record call with this query:
SELECT id FROM
WHERE question = ? AND answer = ?
the query get back 2 or more records so get_record throw an exception with this debug message:
Error: mdb->get_record() found more than one record!
Stack trace:
line 159 of /backup/moodle2/restore_qtype_plugin.class.php: restore_step_exception thrown
line 131 of /backup/util/plan/restore_structure_step.class.php: call to restore_qtype_plugin->process_question_answer()
line 103 of /backup/util/helper/restore_structure_parser_processor.class.php: call to restore_structure_step->process()
line 125 of /backup/util/xml/parser/processors/grouped_parser_processor.class.php: call to restore_structure_parser_processor->dispatch_chunk()
line 91 of /backup/util/helper/restore_structure_parser_processor.class.php: call to grouped_parser_processor->postprocess_chunk()
line 148 of /backup/util/xml/parser/processors/simplified_parser_processor.class.php: call to restore_structure_parser_processor->postprocess_chunk()
line 92 of /backup/util/xml/parser/processors/progressive_parser_processor.class.php: call to simplified_parser_processor->process_chunk()
line 169 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser_processor->receive_chunk()
line 253 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->publish()
line ? of unknownfile: call to progressive_parser->end_tag()
line 158 of /backup/util/xml/parser/progressive_parser.class.php: call to xml_parse()
line 137 of /backup/util/xml/parser/progressive_parser.class.php: call to progressive_parser->parse()
line 105 of /backup/util/plan/restore_structure_step.class.php: call to progressive_parser->process()
line 153 of /backup/util/plan/base_task.class.php: call to restore_structure_step->execute()
line 148 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
line 46 of /backup/restore.php: call to restore_ui->execute()
So we need to add this check or, if it's possible, change the restore query. The second one could be preferred because no need any changes on existing records but I don't think it can be done.
With the first one is needed an upgrade procedure to remove duplicate and fix all the things.
Best regards,
Roberto.
- duplicates
-
MDL-28539 PHP Notice: Error: mdb->get_record() found more than one record!
-
- Closed
-