In the lesson module, a teacher will get the error Error: could not find grades if they try to mark a lesson essay before the student has completed the lesson.
When the teacher goes to the lesson screen, they will see that there is an essay to mark even if the student hasn't completed the lesson. If they try to mark the essay, they will get that error. The problem stems from the code trying to 'update' the grade record. Because the student hasn't completed the rest of the lesson, the record doesn't exist yet, and generates the error.
To fix it, either the lesson should not allow the essay to be marked until after the lesson has been completed, or it should create a grade record if one doesn't exist.