While working on
MDL-71156, reported by various people running the CLI created there.. it was noticed that, after executing (lesson|assing|quiz)_update_events(), some of the regenerated group-override calendar events were missing userid.
So, in the cli, we implemented an extra update for those records which userid was zero after the regeneration.
Locally, in the testing site used to develop that CLI solution... I was unable to reproduce the problem and all the regenerated events (note that they are completely new events because before calling to the functions we first delete them from the event table) always had userid.
I tried to trace the code execution to see if there was any obvious place/condition causing the userid to remain = 0, but was unable to find it.
Note that the reported cases were always about quiz and assign.
So this issue is about to:
1) find in which case those methods are leading to group (only group, not user!) override events having userid = 0 (they should have the userid of the teacher creating them).
2) fix that case and ensure that they always end with the teacher userid.