donhinkelman / moodle-block_sharing_cart

Content sharing plug-in for Moodle LMS. Now at version 4.4, release 3 (actually this is for Moodle LMS version 4.3. Requires PHP 7.4.
7 stars 38 forks source link

Quiz activity not copying to another section #55

Closed doiphode closed 4 years ago

doiphode commented 4 years ago

Error occurs when trying to copy and restore any quiz activity into another section of another course.

Stack trace below restore_step_exception: Failed to find an answer matching "is a branch of the internal carotid artery " in the question_answers database table. This occurred while restoring the question with id 108735 in the backup file, which has been matched to the existing question with id 546650 in the database. in [dirroot]/backup/moodle2/restore_qtype_plugin.class.php:185 Stack trace: #0 [dirroot]/backup/util/plan/restore_structure_step.class.php(137): restore_qtype_plugin->process_question_answer(Object(stdClass)) #1 [dirroot]/backup/util/helper/restore_structure_parser_processor.class.php(121): restore_structure_step->process(Array) #2 [dirroot]/backup/util/xml/parser/processors/grouped_parser_processor.class.php(178): restore_structure_parser_processor->dispatch_chunk(Array) #3 [dirroot]/backup/util/helper/restore_structure_parser_processor.class.php(109): grouped_parser_processor->postprocess_chunk(Array) #4 [dirroot]/backup/util/xml/parser/processors/simplified_parser_processor.class.php(148): restore_structure_parser_processor->postprocess_chunk(Array) #5 [dirroot]/backup/util/xml/parser/processors/progressive_parser_processor.class.php(92): simplified_parser_processor->process_chunk(Array) #6 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(190): progressive_parser_processor->receive_chunk(Array) #7 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(278): progressive_parser->publish(Array) #8 [internal function]: progressive_parser->end_tag(Resource id #590, 'answer') #9 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(179): xml_parse(Resource id #590, 'ments>0', false) #10 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(158): progressive_parser->parse('ments>0', false) #11 [dirroot]/backup/util/plan/restore_structure_step.class.php(110): progressive_parser->process() #12 [dirroot]/backup/util/plan/base_task.class.php(181): restore_structure_step->execute() #13 [dirroot]/backup/util/plan/base_plan.class.php(178): base_task->execute() #14 [dirroot]/backup/util/plan/restore_plan.class.php(168): base_plan->execute() #15 [dirroot]/backup/controller/restore_controller.class.php(377): restore_plan->execute() #16 [dirroot]/blocks/sharing_cart/classes/controller.php(482): restore_controller->execute_plan() #17 [dirroot]/blocks/sharing_cart/classes/controller.php(511): block_sharing_cart\controller->restore('15979', 14330, 23) #18 [dirroot]/blocks/sharing_cart/restore.php(109): block_sharing_cart\controller->restore_directory('topic 5: Choice...', 14330, 23, 1500) #19 {main}

Debug info:
Error code: notlocalisederrormessage Stack trace:
line 494 of /lib/setuplib.php: moodle_exception thrown line 121 of /blocks/sharing_cart/restore.php: call to print_error()

johnnypraxis commented 4 years ago

Hi doiphode

This doesn't seem to be a problem with the Sharing Cart but a general problem with your quiz. The backup/restore functionality in Moodle should result in the exact same error message. Do a backup/restore of the course in Moodle to figure out if that's the case.

It looks like som data is missing in the answers table in the database. Try to go into the quiz activity in the course and remove the dependeny to the deleted answer if possible. Then try to copy the section afterwards and see if it helps.

donhinkelman commented 4 years ago

I agree with Johnny's suggestions. Looking at the error message, I cannot see where the quiz answer corruption/deletion might be. You may have to remove parts of the quiz piece by piece as a trial and error way to find the problem.

jstilwell commented 4 years ago

For what it's worth, I'm also running into this issue and before I actually looked here, I had the same thought about it being an issue with the quiz. However, I was able to backup and restore the activity manually without complication.

Edit: The second time I tried to manually restore it, I ran into the error. That's odd.

The stack trace from my server, running Moodle 3.7.2, is as follows:

restore_step_exception: Failed to find an answer matching "

Inventory Management

" in the question_answers database table. This occurred while restoring the question with id 12322 in the backup file, which has been matched to the existing question with id 14787 in the database. in [dirroot]/backup/moodle2/restore_qtype_plugin.class.php:185 Stack trace: #0 [dirroot]/backup/util/plan/restore_structure_step.class.php(137): restore_qtype_plugin->process_question_answer(Object(stdClass)) #1 [dirroot]/backup/util/helper/restore_structure_parser_processor.class.php(112): restore_structure_step->process(Array) #2 [dirroot]/backup/util/xml/parser/processors/grouped_parser_processor.class.php(178): restore_structure_parser_processor->dispatch_chunk(Array) #3 [dirroot]/backup/util/helper/restore_structure_parser_processor.class.php(100): grouped_parser_processor->postprocess_chunk(Array) #4 [dirroot]/backup/util/xml/parser/processors/simplified_parser_processor.class.php(148): restore_structure_parser_processor->postprocess_chunk(Array) #5 [dirroot]/backup/util/xml/parser/processors/progressive_parser_processor.class.php(92): simplified_parser_processor->process_chunk(Array) #6 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(190): progressive_parser_processor->receive_chunk(Array) #7 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(278): progressive_parser->publish(Array) #8 [internal function]: progressive_parser->end_tag(Resource id #1796, 'answer') #9 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(179): xml_parse(Resource id #1796, 'ectfeedbackform...', false) #10 [dirroot]/backup/util/xml/parser/progressive_parser.class.php(158): progressive_parser->parse('ectfeedbackform...', false) #11 [dirroot]/backup/util/plan/restore_structure_step.class.php(110): progressive_parser->process() #12 [dirroot]/backup/util/plan/base_task.class.php(181): restore_structure_step->execute() #13 [dirroot]/backup/util/plan/base_plan.class.php(178): base_task->execute() #14 [dirroot]/backup/util/plan/restore_plan.class.php(168): base_plan->execute() #15 [dirroot]/backup/controller/restore_controller.class.php(377): restore_plan->execute() #16 [dirroot]/blocks/sharing_cart/classes/controller.php(482): restore_controller->execute_plan() #17 [dirroot]/blocks/sharing_cart/restore.php(112): block_sharing_cart\controller->restore(120, 632, 2) #18 {main}

Debug info: Error code: notlocalisederrormessage

×Stack trace: line 494 of /lib/setuplib.php: moodle_exception thrown line 121 of /blocks/sharing_cart/restore.php: call to print_error()

jstilwell commented 4 years ago

I think it's due to this issue: https://tracker.moodle.org/browse/MDL-68203

donhinkelman commented 4 years ago

Thank you for finding the Tracker issue and providing your data on this. Johnny, what do you think?

johnnypraxis commented 4 years ago

Is this still an issue? The issue is closed.

donhinkelman commented 4 years ago

I don't know. It appears that jstilwell found the issue occurring in his site. Do you think the problem remains. I suggest we keep the issue closed, unless there is another report.