Skip to content

Commit

Permalink
replacing round() with number_format (for a number betweem 0-100), be…
Browse files Browse the repository at this point in the history
…cause round does not respect decimal places, e.g. round(90.50, 2) = 90.5
  • Loading branch information
toyomoyo committed Aug 17, 2007
1 parent 54c7e5e commit d8c684d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions grade/report/grader/lib.php
Expand Up @@ -866,14 +866,13 @@ function get_avghtml($grouponly=false) {
$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);
Expand Down

0 comments on commit d8c684d

Please sign in to comment.