Project: moodle
Issue MDL-47059: Investigate/fix handling of hidden and excluded grades within natural weights
Simple description of this issue: Make natural weighting compatible with excluded grades (either excluded by exclude empty grades, or manually excluded grades). What needs to happen for this to work: The "automatic" weights for each grade_item natural weighting will need to be adjusted "per user" depending on the grades that are excluded. The max grade for the category will need to be different "per user" depending on the grades that are excluded. Very simple example: ||Grade item||Max grade||Natural Weight|| | Assign 1 | 10 | 10 % | | Assign 2 | 20 | 20 % | | Assign 3 | 30 | 30 % | | Assign 4 | 40 | 40 % | Total = 100 If item 2 is excluded because the student has not submitted anything and "exclude empty grades" is enabled - ||Grade item||Max grade||Natural Weight|| | Assign 1 | 10 | 12.5 % | | Assign 3 | 30 | 37.5 % | | Assign 4 | 40 | 50 % | Total = 80 Further more - currently we recalculate the "view" if show totals excluding hidden items is enabled. Depending on the performance of recalculating all of the above at page load time - we may need to add additional columns to store the "view" for users without view hidden grades capability. (This would be 3 extra columns on grade_grade) Older - more complicated description: At the moment, excluded and empty grades not being calculated in the final grade, is not enabled with sum of grades (the basis of natural weights). Also currently we have not introduced code to handle displaying hidden grades in the reports. To do: # Update reports to not consider empty grades. This work will be partially solved by MDL-47078. # Update reports to exclude hidden grade items. Please note that hidden grade items are items hidden to all students and doesn't cover conditional access to activities. Examples : (Please note that this is the desired outcome) *Exclude empty grades* Student 1 ||Grade item||Grade||Percent|| | Assign 1 | 10 / 20 | 50 % | | Assign 2 | 10 / 40 | 5 % | | Assign 3 | - / 80 | - | | Total | 20 / 60 | 33.33 % | Student 2 ||Grade item||Grade||Percent|| | Assign 1 | - / 20 | - | | Assign 2 | - / 40 | - | | Assign 3 | 20 / 80 | 25% | | Total | 20 / 80 | 25.00 % | Student 1 20 (33.00%) Student 2 20 (25.00 %) *Exclude hidden grade items* Student 1 ||Grade item||Grade||Percent|| | Assign 1 | 10 / 20 | 50 % | | Assign 2 - hidden | - / 40 | - | | Assign 3 | 40 / 80 | 50% | | Total | 50 / 100 | 50.00 % | Student 2 ||Grade item||Grade||Percent|| | Assign 1 | 15 / 20 | 75% | | Assign 2 - hidden | - / 40 | - | | Assign 3 | 20 / 80 | 25% | | Total | 35 / 100 | 35.00 % | Student 1 20 (50.00%) Student 2 20 (35.00 %) *Additional technical information:* https://tracker.moodle.org/browse/MDL-46139 introduced a field, grade_grade::aggregationweight that may be helpful. Currently, grade_category::auto_update_weights() adjust grade_item weights but does this trickle down to grade_grades? If an individual student cannot see an activity is zeroing grade_grade::aggregationweight and recalculating the weights in that category for that student sufficient? This code may want to living in get_hiding_affected() in grade_grade.php.
Story points: 20