Skip to content

Commit

Permalink
MDL-56948 mod_assign: Don't call get_grade_item() unless we have one
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyjbutler committed Nov 18, 2016
1 parent cd4a6b8 commit 40e0baf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,6 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {

static $scalegrades = array();

$decimals = $this->get_grade_item()->get_decimals();
$o = '';

if ($this->get_instance()->grade >= 0) {
Expand All @@ -1599,7 +1598,7 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
if ($grade < 0) {
$displaygrade = '';
} else {
$displaygrade = format_float($grade, $decimals);
$displaygrade = format_float($grade, $this->get_grade_item()->get_decimals());
}
$o .= '<label class="accesshide" for="quickgrade_' . $userid . '">' .
get_string('usergrade', 'assign') .
Expand All @@ -1611,7 +1610,7 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
size="6"
maxlength="10"
class="quickgrade"/>';
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $decimals);
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $this->get_grade_item()->get_decimals());
return $o;
} else {
if ($grade == -1 || $grade === null) {
Expand All @@ -1621,7 +1620,7 @@ class="quickgrade"/>';
$o .= grade_format_gradevalue($grade, $item);
if ($item->get_displaytype() == GRADE_DISPLAY_TYPE_REAL) {
// If displaying the raw grade, also display the total value.
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $decimals);
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $item->get_decimals());
}
}
return $o;
Expand Down

0 comments on commit 40e0baf

Please sign in to comment.