-
Bug
-
Resolution: Not a bug
-
Blocker
-
None
-
2.8.7
-
MOODLE_28_STABLE
-
3.1 Sprint 5
Updating a raw grade can be very slow.
The function called is update_raw_grade in lib/grade/grade_item.php which then calls
grade_regrade_final_grades in lib/gradelib.php with $courseid, $userid and $updated_item
If !($course_item->needsupdate) and !($updated_item->needsupdate) and a userid is set, this function will still do a lot of updating for the whole course and this can take up to 20 seconds in my case.
Is there a need to do further updating if $userid and $updated_item are set and needsupdate is false for $course_item and $updated_item ?
For all categories the pre_grade_final_grades is run and all grading items of the course are marked as needupdate=1.
History:
This code seems to be around for a long time but since MDL-47056 (later modified by MDL-47345) all grade categories require some processing, which takes most of the time in the function, making it very slow.
Suggested change: see patch, return early if possible. Needs to be checked by someone who understands this code.
It might be wrong. In that case I'll have to find another solution.