emmarichardson / local_autogroup

A local plugin for Moodle 2.7 onwards which handles the dynamic creation, population and cleanup of groups on courses.
6 stars 19 forks source link

When there is more than one Auto Group set (for example, two profile fields), error is shown with debuging on #20

Open OlenaTatarintseva opened 5 years ago

OlenaTatarintseva commented 5 years ago

Hello,

Sorry for the next issue adding. I just think it will be good to inform you. When there is more than one Auto Group set (for example, two profile fields), error is shown with debuging on "Exception encountered in event observer '\local_autogroup\event_handler::user_updated': This ID number is already in use".

Backtrace: line 125 of /local/autogroup/classes/domain/group.php: call to groups_create_group() line 405 of /local/autogroup/classes/domain/autogroup_set.php: call to local_autogroup\domain\group->create() line 301 of /local/autogroup/classes/domain/autogroup_set.php: call to local_autogroup\domain\autogroup_set->get_or_create_group_by_idnumber() line 100 of /local/autogroup/classes/domain/course.php: call to local_autogroup\domain\autogroup_set->verify_user_group_membership() line 80 of /local/autogroup/classes/domain/user.php: call to local_autogroup\domain\course->verify_user_group_membership() line 64 of /local/autogroup/classes/usecase/verify_user_group_membership.php: call to local_autogroup\domain\user->verify_user_group_membership() line 154 of /local/autogroup/classes/event_handler.php: call to local_autogroup\usecase\verify_user_group_membership->__invoke() line ? of unknownfile: call to local_autogroup\event_handler::user_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 834 of /lib/classes/event/base.php: call to core\event\manager::dispatch() line 282 of /user/editadvanced.php: call to core\event\base->trigger()

Steps to reproduce:

  1. Navigate to course and open auto groups (Course -> users -> groups -> auto groups)
  2. Click create new group set and pick any profile field
  3. Select only student as a role and save changes
  4. Repeat steps 2-3 just to add another auto-group with different profile field
  5. Navigate to users enrolled to that course and change their profile fields from step 2 or 4

Group will be created well with user enrolled, error shown does not interrupt plugin.

Best regards, Olena Tatarintseva

ak4t0sh commented 5 years ago

Thanks for reporting this issue. I was able to reproduce it. I’ll try to look at it but if in the meantime you already fixed it do not hesitate to fill a PR. :)

elyeszitari commented 4 years ago

Hello, Sorry, i confirm this issue, i have same problem, actually is there any solution to get around th issue ? Moodle version : Moodle 3.7.1+ (Build: 20190801) Plugin installed version : 2.4.1

emmarichardson commented 4 years ago

Asides from the error message, which should be fixed at some point, this does not actually stop the plugin from working as far as I can tell.