wooclap / moodle-mod_wooclap

Moodle plugin for Wooclap (https://www.wooclap.com/).
2 stars 5 forks source link

Exception encountered in event observer 'mod_wooclap_observer::course_module_updated' #46

Open steveorulez opened 1 week ago

steveorulez commented 1 week ago

Hello, yesterday I updated to the latest version of the plugin on my moodle 4.3 (php8.2) testing environment and had this error when you edit and save any activity or resource:

Exception encountered in event observer 'mod_wooclap_observer::course_module_updated': Can't find data record in database. (SELECT cm.*, m.name, md.name AS modname FROM {course_modules} cm JOIN {modules} md ON md.id = cm.module JOIN {wooclap} m ON m.id = cm.instance WHERE cm.id = :cmid AND md.name = :modulename [array ( 'cmid' => 'xxxxx', 'modulename' => 'wooclap', )]) line 1266 of /lib/datalib.php: call to moodle_database->get_record_sql() line 287 of /mod/wooclap/classes/observer.php: call to get_coursemodule_from_id() line ? of unknownfile: call to mod_wooclap_observer::course_module_updated() line 155 of /lib/classes/event/manager.php: call to call_user_func() line 75 of /lib/classes/event/manager.php: call to core\event\manager::process_buffers() line 835 of /lib/classes/event/base.php: call to core\event\manager::dispatch() line 705 of /course/modlib.php: call to core\event\base->trigger() line 168 of /course/modedit.php: call to update_moduleinfo()

The same error is happening after updating wooclap on my moodle 4.1 (php 8.0) testing environment.

christian

steveorulez commented 1 week ago

Hello, I think that the solution is pretty easy, like you did for the other observer (course_module_created) just add this at the beginning:

if ($event->other['modulename'] !== 'wooclap') { return; }

christian