MDL-50894 I noticed that the method used to compute the percentage of the grades was not right in the availability condition grade.
In get_cached_grade_score a few things are wrong:
- Assumption that min and max have different values, this is not the case in single item scales.
- Using grade_grade.rawgrademin/max, that is not reliable see
- Duplicates the code that generates the percentage (grade_format_gradevalue_percentage), which can be a problem as not everyone would assume that in the following example the percentage is 50%, and we might change that later:
- grademin = 50
- grademax = 100
- finalgrade = 75
The third point is the least important but it's good to consider it.