Skip to content

Commit

Permalink
Fix total values using format_score see BT#13460
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 2, 2017
1 parent 6317d46 commit 60c8801
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion main/gradebook/lib/fe/displaygradebook.php
Expand Up @@ -314,13 +314,14 @@ public static function header(
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)) {
Expand Down
5 changes: 3 additions & 2 deletions main/gradebook/lib/fe/gradebooktable.class.php
Expand Up @@ -385,13 +385,13 @@ public function get_table_data($from = 1, $per_page = null, $column = null, $dir
$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));
Expand Down Expand Up @@ -631,8 +631,9 @@ public function get_table_data($from = 1, $per_page = null, $column = null, $dir
$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;
Expand Down

0 comments on commit 60c8801

Please sign in to comment.