ndunand / moodle-mod_choicegroup

Moodle "Group Choice" plugin
https://moodle.org/plugins/mod_choicegroup
34 stars 57 forks source link

Invalid default activity completion settings #212

Open voegii opened 1 month ago

voegii commented 1 month ago

This Plugin produces a Javascript error on the default activity completion (/course/defaultcompletion.php?id=1) on Moodle 4.3+. The page does not work properly and invalid completion settings may be saved. E.g. the forum completion settings: As a result, no new forum activity can be added to the a course.

The Javascript error on the default activity completion is: "TypeError: Cannot read properties of null (reading 'get')" on line 233 on yui/form/form.js image

As a workaround, we changed line 291 in mod_form.php:

        if (!str_ends_with($this->get_form()->getAttribute('action'), '/course/defaultcompletion.php')) {
            $this->js_call();
        }
kskrige commented 4 weeks ago

Thanks for this workaround. This error caused us a lot of problems.

kskrige commented 4 weeks ago

Is there a plan to fix this in a new version of the plugin?

voegii commented 4 weeks ago

I have just made a pull request that includes our workaround.

kskrige commented 4 weeks ago

Thanks very much @voegii

kskrige commented 4 weeks ago

Just in case others are experiencing this problem: This fix means that erroneous data will no longer be created by the plugin. However, if the problem data has already been triggered in the database, it will not be removed by the fix. We removed the problematic data by hand with a database query.

ranver commented 4 weeks ago

A workaround is to delete this:

"completiongradeitemnumber":"0"

from the custom rules cell.