From f2a901173e2c3c2f284411228b6e1bda1a32f6f5 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Thu, 31 Oct 2019 12:39:40 +0800 Subject: [PATCH] MDL-67093 grading: Fetch cm with get_fast_modinfo --- grade/grading/lib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grade/grading/lib.php b/grade/grading/lib.php index d4954489cd4..a75dd20a564 100644 --- a/grade/grading/lib.php +++ b/grade/grading/lib.php @@ -339,8 +339,10 @@ class grading_manager { } } else if ($this->get_context()->contextlevel == CONTEXT_MODULE) { - list($context, $course, $cm) = get_context_info_array($this->get_context()->id); - return self::available_areas('mod_'.$cm->modname); + $modulecontext = $this->get_context(); + $coursecontext = $modulecontext->get_course_context(); + $cm = get_fast_modinfo($coursecontext->instanceid)->get_cm($modulecontext->instanceid); + return self::available_areas("mod_{$cm->modname}"); } else { throw new coding_exception('Unsupported gradable area context level');