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

Error with activities using question bank #155

Closed oliviervalentin closed 1 year ago

oliviervalentin commented 1 year ago

I'm working on our future update from Moodle 3.11 to Moodle 4.1. When I'm testing the Sharing Cart on Moodle 4.1, it seems impossible to restore an activity based on the question bank. I tried with the natif Quiz activity, but also with Offline Quiz and Student Quiz.

The debug mode shows me this message : Exception : Too few arguments to function restore_dbops::restore_get_question_categories(), 2 passed in [dirroot]\blocks\sharing_cart\backup\moodle2\restore_fix_missing_questions.php on line 52 and exactly 3 expected

line 782 of \backup\util\dbops\restore_dbops.class.php: ArgumentCountError thrown
line 52 of \blocks\sharing_cart\backup\moodle2\restore_fix_missing_questions.php: call to restore_dbops::restore_get_question_categories()
line 34 of \backup\util\plan\restore_execution_step.class.php: call to restore_fix_missing_questions->define_execution()
line 181 of \backup\util\plan\base_task.class.php: call to restore_execution_step->execute()
line 191 of \backup\util\plan\base_plan.class.php: call to base_task->execute()
line 168 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
line 408 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
line 562 of \blocks\sharing_cart\classes\controller.php: call to restore_controller->execute_plan()
line 118 of \blocks\sharing_cart\restore.php: call to block_sharing_cart\controller->restore()

I saw a similar message on the plugin page in Moodle plugins directory, written in november. Are you already aware of this problem ?

Best regards, Olivier

donhinkelman commented 1 year ago

No, I am not aware of this problem. Since 4.1 introduced significant changes to the question bank, it would not surprise me if there is an issue. Let me confirm it on my server. This week, my school is upgrading to 4.1. Thank you for reporting this and apologies for my slow reply.

Snowdle commented 1 year ago

After testing with Moodle 4.0, 4.1 and 4.1.2, we are unable to replicate this issue. @oliviervalentin Are you sure that your sharing cart is updated? All versions from branch MOODLE_310_STABLE and older, are only sending 2 parameters, so I suspect that might be the issue

giselebrugger commented 1 year ago

Hello, i got the same error Moodle :4.1 (Build: 20221128) Sharing Cart: 4.0, release 2 banco_questoes 2022101400

Course with many categories (see image)

`Exceção - Too few arguments to function restore_dbops::restore_get_question_categories(), 2 passed in [dirroot]/blocks/sharing_cart/backup/moodle2/restore_fix_missing_questions.php on line 52 and exactly 3 expected

Outras informações sobre este erro

Informações de depuração: Error code: generalexceptionmessage×Ignorar essa notificação Rastreamento de pilha: line 782 of /backup/util/dbops/restore_dbops.class.php: ArgumentCountError thrown line 52 of /blocks/sharing_cart/backup/moodle2/restore_fix_missing_questions.php: call to restore_dbops::restore_get_question_categories() line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_fix_missing_questions->define_execution() line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute() line 191 of /backup/util/plan/base_plan.class.php: call to base_task->execute() line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute() line 408 of /backup/controller/restore_controller.class.php: call to restore_plan->execute() line 562 of /blocks/sharing_cart/classes/controller.php: call to restore_controller->execute_plan() line 118 of /blocks/sharing_cart/restore.php: call to `block_sharing_cart\controller->restore()``

AraPraxis commented 1 year ago

Hello @oliviervalentin @giselebrugger

I do believe your issue can be fixed by pulling a newer release of sharing cart. We've had a similar issue (https://github.com/donhinkelman/moodle-block_sharing_cart/issues/118) and it should've been fixed in Moodle 4.0 Release 3

I hope the update helps, otherwise please contact us again, and we'll try to investigate further into the issue :)

Kind regards, Anders Rasmussen

Praxis Team

giselebrugger commented 1 year ago

Hello @AraPraxis , thank you for the help. We updated the plugin and the error disappeared and the import was successful. :)

donhinkelman commented 1 year ago

Hello Giselebrugger, Glad your issue is solved. We also took the latest github code and created a new release on the Moodle Plugins Database, calling it Sharing Cart 4.1, release 1. Thank you for reporting the successful resolution, so I will close this issue.