From 60c88014cfdbbb79b2729bf84c7e8552291e7182 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Mon, 2 Oct 2017 11:12:39 +0200 Subject: [PATCH] Fix total values using format_score see BT#13460 --- main/gradebook/lib/fe/displaygradebook.php | 3 ++- main/gradebook/lib/fe/gradebooktable.class.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/main/gradebook/lib/fe/displaygradebook.php b/main/gradebook/lib/fe/displaygradebook.php index 89ce8ef680..72c240daf3 100755 --- a/main/gradebook/lib/fe/displaygradebook.php +++ b/main/gradebook/lib/fe/displaygradebook.php @@ -314,13 +314,14 @@ class DisplayGradebook if (!empty($score)) { $divide = $score[1] == 0 ? 1 : $score[1]; $item_value = $score[0] / $divide * $item->get_weight(); - $item_value_total += $item_value; + $item_value_total += $scoredisplay->format_score($item_value); } } $item_total = $main_weight; $total_score = array($item_value_total, $item_total); $scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT); + if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) { $additionalButtons = null; if (!empty($certificateLinkInfo)) { diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index e43607b9af..9e4e678195 100755 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -385,13 +385,13 @@ class GradebookTable extends SortableTable $data['result_score'][1] ); } - $totalResultAverageValue = strip_tags( $scoredisplay->display_score( $totalResult, SCORE_AVERAGE ) ); + $this->dataForGraph['my_result'][] = floatval($totalResultAverageValue); $this->dataForGraph['my_result_no_float'][] = $data['result_score'][0]; $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); @@ -631,8 +631,9 @@ class GradebookTable extends SortableTable $global = null; $average = null; $myTotal = 0; + foreach ($this->dataForGraph['my_result_no_float'] as $result) { - $myTotal += $result; + $myTotal += $scoredisplay->format_score($result); } $totalResult[0] = $myTotal;