Commit 50d845e3 authored by Marina Glancy's avatar Marina Glancy
Browse files

MDL-58665 dashboard: use bigger course object for completion

class completion_info will make an extra DB query to retrieve the course if course->enablecompletion is not present
parent cd477f8c
......@@ -729,9 +729,7 @@ function mod_book_core_calendar_provide_event_action(calendar_event $event,
return null;
}
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -790,9 +790,7 @@ function mod_folder_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['folder'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -8211,9 +8211,7 @@ function mod_forum_core_calendar_provide_event_action(calendar_event $event,
return null;
}
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -4187,9 +4187,7 @@ function mod_glossary_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['glossary'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -487,9 +487,7 @@ function mod_imscp_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['imscp'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -364,9 +364,7 @@ function mod_label_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['label'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -662,9 +662,7 @@ function mod_lti_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['lti'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -551,9 +551,7 @@ function mod_page_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['page'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -566,9 +566,7 @@ function mod_resource_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['resource'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -1128,9 +1128,7 @@ function mod_survey_core_calendar_provide_event_action(calendar_event $event,
return null;
}
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -389,9 +389,7 @@ function mod_url_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['url'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
......@@ -815,9 +815,7 @@ function mod_wiki_core_calendar_provide_event_action(calendar_event $event,
\core_calendar\action_factory $factory) {
$cm = get_fast_modinfo($event->courseid)->instances['wiki'][$event->instance];
$course = new stdClass();
$course->id = $event->courseid;
$completion = new \completion_info($course);
$completion = new \completion_info($cm->get_course());
$completiondata = $completion->get_data($cm, false);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment