MDL-41269 use courseid index instead of contextid because new events are going to use courseid