Open slewislcm opened 8 months ago
Hi @slewislcm
At a glance, there shouldn't be duplicate events in Outlook calendar. There is an observer function in local_o365 plugin that listens for Moodle \core\event\calendar_event_deleted
event, and would make Graph API call to delete the event from Outlook calendar. As long as the Moodle event is triggered in case an assignment date is overridden, this should be triggered.
We will try to recreate the issue locally and investigate further.
Regards, Lai
Hi @slewislcm
I performed some investigation on the reported issue. I confirm I can reproduce the issue, but I'm afraid a technical solution may not be possible without heavy rework on the calendar sync feature. I'll try to explain it in this note.
First of all, it worths highlighting that the calendar events sync from Moodle to Outlook is triggered by Moodle observer functions, which listens for Moodle events (not calendar events) and reacts to them. The exact Moodle events that are relevant to the calendar sync feature are:
\core\event\calendar_event_created
\core\event\calendar_event_updated
\core\event\calendar_event_deleted
The general idea is, when one of the events above are triggered, it means that there are changes to a Moodle calendar event, and if the audience of the Moodle calendar event has configured to sync the calendar with Outlook, then a Graph API call is made to make the changes in Outlook.To complicate things up, there are a few types of Moodle calendar events:
mdl_event
table, and the audience of the event is determined by multiple attributes of the entry, e.g. categoryid
, courseid
, groupid
, component
, and instance
etc. When a user views their calendar in Moodle, the list of events that they can see are effectively generated dynamically, gathering all the events the user is an audience of. With this understanding, this is what happens when a user gets an assignment due date override:
modulename
set as "assign", instance
set as ID of the assignment activity, courseid
field set to be the ID of the course, and userid
set to 0. The calendar sync feature will then look for all enrolled users of the course who have configured to sync the course events with Outlook, and create the event if needed. Note Outlook events created from courses that are connected to Teams will be created as an Outlook group event, with the course teacher as organiser, and students as invitees.modulename
set as "assign", instance
set as ID of the assignment activity, courseid
field set to be 0, and userid
set to be the ID of the overridden user. Note the only difference with the event record above is on the courseid
and userid
fields. The calendar sync feature will then find the user and create the event in Outlook if sync is configured on.
With this in mind, in order to delete the original due date event from Outlook calendar when a due date override is created, we will need to remove the user from the original event attendee list before creating a new Outlook calendar event for the new overridden date. Technically this will require new observer functions that listens for override created and deleted Moodle events (so that it would add the user back to the attendee list to when an override is deleted). This will also need to be done fore each activity module that can have override.Overall what's required is technically feasible, but will require a lot of effort.
I'd suggest we convert this as a feature request, and queue it for now. We may proceed with it if it gets enough votes.
Regards, Lai
Hi, When I apply an assignment override for a student, in their outlook calendar it show both the dates, the original due date and the override date. When it should just have the one date in the calendar. The Moodle calendar just shows the one date. Moodle 4.1.4 local_o365 4.1.3 Will this be changed in future release?
thanks, Simon