[Merged][BugFix] Bug #5405 - made a new function that grades a lesson for a specific user's attempt. This is then used for grading lessons at the end of a lesson, for ongoing score feature and for updating the grade for essay question grading.
This new grading algorithm now enforces the lesson setting Max attempts when custom scoring is turned Off
Changed the reporting of minquestions setting to match the help file. Now it is question based instead of attempt based.
Changed the reporting of ongoing score to use the new grade function.