MDL-59055 grades: provide backward-compatibility of changes

This commit is contained in:
Marina Glancy
2017-08-07 09:56:14 +08:00
parent be85f0cf88
commit 20060b3b2e
3 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -974,7 +974,7 @@ class grade_report_grader extends grade_report {
$usergrades = $this->allgrades[$userid];
$hidingaffected = grade_grade::get_hiding_affected($usergrades, $allgradeitems);
$altered = $hidingaffected['altered'];
$unknown = $hidingaffected['unknown'];
$unknown = $hidingaffected['unknowngrades'];
unset($hidingaffected);
}
+2 -2
View File
@@ -525,14 +525,14 @@ abstract class grade_report {
$aggregationweight = null;
}
}
} else if (array_key_exists($course_item->id, $hiding_affected['unknown'])) {
} else if (array_key_exists($course_item->id, $hiding_affected['unknowngrades'])) {
//not sure whether or not this item depends on a hidden item
if (!$this->showtotalsifcontainhidden[$courseid]) {
//hide the grade
$finalgrade = null;
} else {
//use reprocessed marks that exclude hidden items
$finalgrade = $hiding_affected['unknown'][$course_item->id];
$finalgrade = $hiding_affected['unknowngrades'][$course_item->id];
if (array_key_exists($course_item->id, $hiding_affected['alteredgrademin'])) {
$grademin = $hiding_affected['alteredgrademin'][$course_item->id];
+6 -3
View File
@@ -727,8 +727,9 @@ class grade_grade extends grade_object {
*
* @param array $grade_grades all course grades of one user, & used for better internal caching
* @param array $grade_items array of grade items, & used for better internal caching
* @return array This is an array of 3 arrays:
* unknown => list of item ids that may be affected by hiding (with the calculated grade as the value)
* @return array This is an array of following arrays:
* unknown => list of item ids that may be affected by hiding (with the ITEM ID as both the key and the value) - for BC with old gradereport plugins
* unknowngrades => list of item ids that may be affected by hiding (with the calculated grade as the value)
* altered => list of item ids that are definitely affected by hiding (with the calculated grade as the value)
* alteredgrademax => for each item in altered or unknown, the new value of the grademax
* alteredgrademin => for each item in altered or unknown, the new value of the grademin
@@ -779,6 +780,7 @@ class grade_grade extends grade_object {
if (!$hiddenfound) {
return array('unknown' => array(),
'unknowngrades' => array(),
'altered' => array(),
'alteredgrademax' => array(),
'alteredgrademin' => array(),
@@ -953,7 +955,8 @@ class grade_grade extends grade_object {
}
}
return array('unknown' => $unknown,
return array('unknown' => array_combine(array_keys($unknown), array_keys($unknown)), // Left for BC in case some gradereport plugins expect it.
'unknowngrades' => $unknown,
'altered' => $altered,
'alteredgrademax' => $alteredgrademax,
'alteredgrademin' => $alteredgrademin,