I noticed that my code was wrong when trying to calculate the overall grade in Google Classroom. I decided to check some values through a spreadsheet. However, I noticed that even when I calculate these overall grades (weighted by category) by spreadsheet, I'm still getting values that are slightly off to what's shown in the UI.
Here is a sample calculation, the weight of the SKills category is 80%, and the weight of the Classwork category is 15%. Google Classroom Overall Grade Calculation (Weighted By Categories)
I looked at this help page and I believe I am following the same format they provide https://support.google.com/edu/classroom/answer/9184995?hl=en#zippy=%2Cweighted-by-category-grading:~:text=You%20assign%20weights,grade%20of%20100%25.
As far as I know, this is the method of getting the overall grade suggested by the Google team since there is no function to get it directly. Wondering if anyone else found this to be an issue?
Get overall grade from Google Classroom using Google Script
I received advice to include more data that is outside the image to reproduce the issue, here is the process I followed to recreate this bug: Make a new Google Classroom, make three grade categories SKills, Classwork, and Presentations (anything works for the third one) with category weights of 80%, 15% and 5% respectively. Then create 8 assignments in the Classwork category and 1 assignment in the SKills category.
The marks in the Classwork category are 2/5 3.5/5 4/5 85/100 50/50 50/50 48/50 45/50
The marks in the SKills category are 86.56/100.
Then add and mark a student with the grades provided. The Google Classroom UI will then give an average of 87.3 while the calculation gives 85.94 (done by finding the average grade of each assignment in a category, then summing category weight * category average, then dividing by the total weight added - for example, if only the 80% and 15% categories are used you'd divide by 0.95).
Google Classroom calculates grades by taking the sum of the total points a student achieved and dividing it by the sum of the maximum amount of points they could've achieved within each grade category.
What was expected was that you'd take the average of the grade achieved on each assignment to get an overall average within each grade category.
max grades: [5, 5, 5, 100]
achieved grades: [4, 3.5, 4, 85]
percent achieved: [0.8, 0.7, 0.8, 0.85]
Expected: (0.8 + 0.7 + 0.8 + 0.85) / 4 = 0.788
Google Classroom Calculation:
Sum of Maximum Points = 5 + 5 + 5 + 100 = 115
Sum of Achieved Points = 4 + 3.5 + 4 + 85 = 96.5
Average = 96.5 / 115 = 0.839