Setting the weight in SWM to the sum of all grade points

Setting the weight in SWM to the sum of all grade points

by Basil Gohar -
Number of replies: 1
We've had to switch from using Sum of Grades (SUM) aggregation to Simple Weighted Mean (SWM) so that our clients can exclude items from grading as well as take advantage of extra credit. Consequently, the number of points at the end of the course no longer add-up to the same value as it used to when we were using SUM.

I have noticed, though, that when switched between SUM & SWM in the full Categories and Items view, that the weight value for SWM is set to the sum of all points in a category when switching from SUM to SWM. This, more or less (if I am not mistaken) makes SWM behave quite similarly to SUM, and therefore, solves our problem with the discrepancy that our teachers were seeing between points and percentages for their course & category totals.

However, I have been unable to isolate the actual code that sets this value to the corresponding sum of grade points. I have looked in grade/edit/tree/index.php and seen that grade_regrade_final_grades() is called multiple times throughout. I tried writing my own script to call that function after changing the course aggregation types, and then switching aggregation back again, but the finalgrade value for the category grade items were unaffected by this.

Can anyone point me in the right direction to emulate the behavior seen when switching aggregation types in the grade card without having to manually visit each and every category for each and every course in a browser - or suggest an easier method to achieve a points value comparable to what it would have been with SUM?

Thanks in advance!
Average of ratings: -
In reply to Basil Gohar

Re: Setting the weight in SWM to the sum of all grade points

by Basil Gohar -
Nothing, eh? I wrote a one time script that does something close to what I want, but it doesn't currently take into account grade exemptions.