Details
Description
Query should be
$sql = SELECT e.id, e.userid, gi.cminstance, gi.modid, c.name as catname, mm.name as modname
FROM {$CFG->prefix}grade_exceptions e,
{$CFG->prefix}grade_item gi,
{$CFG->prefix}grade_category c,
{$CFG->prefix}modules mm
WHERE e.courseid=$course
AND gi.id = e.grade_itemid
AND c.id = gi.category
AND gi.modid=mm.id;
The old one was unnecesarily slowing down (to a halt) a gradebook with a lot of exceptions.
This bug needs to be assigned so that the query efficiency can be evaluated. Currently we have:
function grade_get_grade_item_exceptions($id) {
global $CFG, $course;
$contextlists = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $course->id));
$sql = "SELECT ge.id, ge.userid
FROM {$CFG->prefix}grade_exceptions ge,
{$CFG->prefix}role_assignments ra
WHERE grade_itemid = $id
AND ge.userid = ra.userid
AND ra.contextid $contextlists";
return get_records_sql($sql);
}
I am hoping that some of what was learned from working on speeding up the get_my_courses function in
MDL-7416can help out here as well. Peace - AnthonyMDL-7416can help out here as well. Peace - Anthony