From: toyomoyo Date: Fri, 17 Aug 2007 06:28:12 +0000 (+0000) Subject: replacing round() with number_format (for a number betweem 0-100), because round... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d8c684de7ec86f5c654f6ace84345661f1bc8a67;p=moodle.git replacing round() with number_format (for a number betweem 0-100), because round does not respect decimal places, e.g. round(90.50, 2) = 90.5 --- diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 7a62425784..df24783972 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -866,14 +866,13 @@ class grade_report_grader extends grade_report { $rawvalue = $scaleval; } else { $gradeval = format_float($sum/$count_array[$item->id], $decimalpoints); - - $gradehtml = round($gradeval, $decimalpoints); + $gradehtml = $gradeval; $rawvalue = $gradeval; } if ($displaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_PERCENTAGE) { $gradeval = grade_grade::standardise_score($rawvalue, $item->grademin, $item->grademax, 0, 100); - $gradehtml = round($gradeval, $decimalpoints) . '%'; + $gradehtml = number_format($gradeval, $decimalpoints) . '%'; } elseif ($displaytype == GRADE_REPORT_GRADE_DISPLAY_TYPE_LETTER) { $letters = grade_report::get_grade_letters(); $gradehtml = grade_grade::get_letter($letters, $gradeval, $item->grademin, $item->grademax);