I'm working in a quiz report to allow teachers to speed up the grading of essay questions manually.
Many students just tinker with the template answer, add/delete some chars, and then simply save and go for other other questions. The report identifies question attempts with student responses similar to the question's stored template response, and then tries to set the mark, the grade to 0 (zero).
I say tries because all is working but the grade saving. I have ways to set how similar the responses must be, and to get the relevant question usages and questions attempts from quiz. But set grading in the database seems a mistery,
There is a method in question_attemp class
public function manual_grade($comment, $mark, $commentformat = null, $timestamp = null, $userid = null)
public function manual_grade($slot, $comment, $mark, $commentformat = null)