mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
MDL-52078 gradebook: Stop totals including hidden items.
This patch fixes a problem where the course and user reports, when viewed by a student, were incorrectly including hidden grade items in the course totals, making the percentages lower than they should be.
This commit is contained in:
parent
ef343c3299
commit
f3460b0fc6
@ -805,8 +805,18 @@ class grade_grade extends grade_object {
|
||||
|
||||
} else if (!array_intersect($dependson[$do], $todo)) {
|
||||
$hidden_precursors = array_intersect($dependson[$do], array_keys($altered));
|
||||
if (!$hidden_precursors) {
|
||||
// hiding does not affect this grade
|
||||
// If the dependency is a sum aggregation, we need to process it as if it had hidden items.
|
||||
// The reason for this, is that the code will recalculate the maxgrade by removing ungraded
|
||||
// items and accounting for 'drop x grades' and then stored back in our virtual grade_items.
|
||||
// This recalculation is necessary because there will be a call to:
|
||||
// $grade_category->aggregate_values_and_adjust_bounds
|
||||
// for the top level grade that will depend on knowing what that caclulated grademax is
|
||||
// and it finds that value by checking the virtual grade_items.
|
||||
$issumaggregate = false;
|
||||
if ($grade_items[$do]->itemtype == 'category') {
|
||||
$issumaggregate = $grade_items[$do]->load_item_category()->aggregation == GRADE_AGGREGATE_SUM;
|
||||
}
|
||||
if (!$hidden_precursors && !$issumaggregate) {
|
||||
unset($todo[$key]);
|
||||
$found = true;
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user