Skip to content

Commit

Permalink
Merge branch 'MDL-56062-30' of https://github.com/lucisgit/moodle int…
Browse files Browse the repository at this point in the history
…o MOODLE_30_STABLE
  • Loading branch information
danpoltawski committed Oct 18, 2016
2 parents f9d95d9 + 003699d commit 02cba0b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mod/assign/feedback/offline/importgradesform.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public function definition() {
if (!empty($scaleoptions)) {
$formattedgrade = $scaleoptions[$grade];
} else {
$formattedgrade = format_float($grade, 2);
$gradeitem = $assignment->get_grade_item();
$formattedgrade = format_float($grade, $gradeitem->get_decimals());
}
$updates[] = get_string('gradeupdate', 'assignfeedback_offline',
array('grade'=>$formattedgrade, 'student'=>$userdesc));
Expand Down
6 changes: 4 additions & 2 deletions mod/assign/gradingtable.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ public function display_grade($grade, $editable, $userid, $modified) {
if ($grade == -1 || $grade === null) {
return '';
}
return format_float($grade, 2);
$gradeitem = $this->assignment->get_grade_item();
return format_float($grade, $gradeitem->get_decimals());
} else {
// This is a custom scale.
$scale = $this->assignment->display_grade($grade, false);
Expand Down Expand Up @@ -815,7 +816,8 @@ public function col_gradecanbechanged(stdClass $row) {
* @return string
*/
public function col_grademax(stdClass $row) {
return format_float($this->assignment->get_instance()->grade, 2);
$gradeitem = $this->assignment->get_grade_item();
return format_float($this->assignment->get_instance()->grade, $gradeitem->get_decimals());
}

/**
Expand Down
9 changes: 5 additions & 4 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,7 @@ 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 @@ -1337,7 +1338,7 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
if ($grade < 0) {
$displaygrade = '';
} else {
$displaygrade = format_float($grade, 2);
$displaygrade = format_float($grade, $decimals);
}
$o .= '<label class="accesshide" for="quickgrade_' . $userid . '">' .
get_string('usergrade', 'assign') .
Expand All @@ -1349,7 +1350,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, 2);
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $decimals);
return $o;
} else {
if ($grade == -1 || $grade === null) {
Expand All @@ -1359,7 +1360,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, 2);
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade, $decimals);
}
}
return $o;
Expand Down Expand Up @@ -3119,7 +3120,7 @@ protected function view_single_grade_page($mform) {
if ($grade) {
$data = new stdClass();
if ($grade->grade !== null && $grade->grade >= 0) {
$data->grade = format_float($grade->grade, 2);
$data->grade = format_float($grade->grade, $this->get_grade_item()->get_decimals());
}
} else {
$data = new stdClass();
Expand Down

0 comments on commit 02cba0b

Please sign in to comment.