MDL-59055 grades: fix bug displaying item id instead of grade

Thanks to Marcelo Santos for initial patch
This commit is contained in:
Marina Glancy 2017-06-20 15:27:16 +08:00
parent 8146b1f06d
commit be85f0cf88
3 changed files with 5 additions and 5 deletions

View File

@ -996,7 +996,7 @@ class grade_report_grader extends grade_report {
// Get the decimal points preference for this item
$decimalpoints = $item->get_decimals();
if (in_array($itemid, $unknown)) {
if (array_key_exists($itemid, $unknown)) {
$gradeval = null;
} else if (array_key_exists($itemid, $altered)) {
$gradeval = $altered[$itemid];

View File

@ -525,7 +525,7 @@ abstract class grade_report {
$aggregationweight = null;
}
}
} else if (!empty($hiding_affected['unknown'][$course_item->id])) {
} else if (array_key_exists($course_item->id, $hiding_affected['unknown'])) {
//not sure whether or not this item depends on a hidden item
if (!$this->showtotalsifcontainhidden[$courseid]) {
//hide the grade

View File

@ -795,10 +795,10 @@ class grade_grade extends grade_object {
for($i=0; $i<$max; $i++) {
$found = false;
foreach($todo as $key=>$do) {
$hidden_precursors = array_intersect($dependson[$do], $unknown);
$hidden_precursors = array_intersect($dependson[$do], array_keys($unknown));
if ($hidden_precursors) {
// this item depends on hidden grade indirectly
$unknown[$do] = $do;
$unknown[$do] = $grade_grades[$do]->finalgrade;
unset($todo[$key]);
$found = true;
continue;
@ -828,7 +828,7 @@ class grade_grade extends grade_object {
) {
// This is a grade item that is not a category or course and has been affected by grade hiding.
// I guess this means it is a calculation that needs to be recalculated.
$unknown[$do] = $do;
$unknown[$do] = $grade_grades[$do]->finalgrade;
unset($todo[$key]);
$found = true;
continue;