From 8eabc1d8efe0223c6e472dbd5084778ee9b66e48 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Tue, 14 Sep 2010 08:43:50 +0000 Subject: [PATCH] gradebook MDL-22841 fixed a bug where the user report when viewing multiple students would misreport student's course totals --- grade/report/lib.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/grade/report/lib.php b/grade/report/lib.php index d34d037c619..ebfd1c37d35 100755 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -339,10 +339,19 @@ abstract class grade_report { global $CFG, $DB; static $hiding_affected = null;//array of items in this course affected by hiding + //if we're dealing with multiple users we need to know when we've moved on to a new user + static $previous_userid = null; + if( $this->showtotalsifcontainhidden==GRADE_REPORT_SHOW_REAL_TOTAL_IF_CONTAINS_HIDDEN ) { return $finalgrade; } + //if we've moved on to another user don't return the previous user's affected grades + if ($previous_userid!=$this->user->id) { + $hiding_affected = null; + $previous_userid = $this->user->id; + } + if( !$hiding_affected ) { $items = grade_item::fetch_all(array('courseid'=>$courseid)); $grades = array(); -- 2.43.0