MDL-47064 core_grades: fix the calculation of contribution towards total

Part of: MDL-46576
This commit is contained in:
Simey Lameze
2014-10-03 13:54:39 +08:00
committed by Adrian Greeve
parent 6bf696bba2
commit 3c46f7e1b9
+5 -1
View File
@@ -655,7 +655,11 @@ class grade_report_user extends grade_report {
}
}
if ($validpercent) {
$data['contributiontocoursetotal']['content'] = format_float($percentoftotal * 100.0, 2) . ' %';
$grademin = $grade_grade->grade_item->grademin;
$grademax = $grade_grade->grade_item->grademax;
$finalgrade = $grade_grade->finalgrade;
$contribution = format_float(((($finalgrade-$grademin)/($grademax-$grademin)*($percentoftotal * 100.0))),2);
$data['contributiontocoursetotal']['content'] = $contribution;
}
}
}