Hi – I have a custom assignment type that allows me to autograde student work (among other things), and so far it's been working very well, except OCCASIONALLY the grade_update function will fail to update the finalgrade column in the database.
Here's my call to grade_update:
grade_update( 'mod/assignment', $this->assignment->courseid, 'mod', 'assignment', $this->assignment->id, 0, $newgrade );
with $newgrade being an array containing the following fields:
What happens, in rare cases, is that the "rawgrade" entry in the database will be set to some value (e.g., 100), but the "finalgrade" entry in the database will not be updated, so the students have whatever was there before (students can turn in their work, auto-grade it, see the results immediately, resubmit, auto-grade, and repeat until they get all the points).
Naturally this makes students panic (I'm running a class with 500 students!) when the feedback says "You got 100" and the official grade in the gradebook says "90".
When I check the entry in the database, sure enough "rawgrade" is set to 100, but "finalgrade" is still set to 90.