Error Deleting Attendance When "enablecalendar" is False
Closed this issue · 0 comments
martygilbert commented
Steps to Reproduce
- On a clean install, disable
enablecalendar
from the site plugin settings - Turn on debugging to 'DEVELOPER'
- Create a course
- Add an Attendance activity
- Add multiple sessions - at least two
- Delete the Attendance activity
- View error in the output from the next run of admin/cli/cron.php
The error below occurs once for each session created:
This is cause by the DB call in classes/calendar_helpers.php:
In attendance_sessions, caleventid
is 0
for all entries because enablecalendar
is set to false
. The call to $DB->get_records_list()
returns an array of objects where the key is the value of the given field, in this case, caleventid
. Since all the caleventid
values are 0
, this produces the error above.
I think one fix is pretty easy - I'll submit a PR soon that addresses this issue.