Skip to content
Browse files

MDL-33572: Make the display of the "graded" status consistent in mod_…

…assign

Do not display "graded" when the grade is set to -1.
  • Loading branch information...
1 parent 4913af9 commit 2d8a9ce96c9cc180db5c8527608d78b4788de75d Damyon Wiese committed Jun 7, 2012
Showing with 9 additions and 4 deletions.
  1. +1 −1 mod/assign/gradingtable.php
  2. +8 −3 mod/assign/locallib.php
View
2 mod/assign/gradingtable.php
@@ -414,7 +414,7 @@ function col_status(stdClass $row) {
if ($row->locked) {
$o .= $this->output->container(get_string('submissionslockedshort', 'assign'), 'lockedsubmission');
}
- if ($row->grade) {
+ if ($row->grade >= 0) {
$o .= $this->output->container(get_string('graded', 'assign'), 'submissiongraded');
}
}
View
11 mod/assign/locallib.php
@@ -895,7 +895,12 @@ public function display_grade($grade, $editing, $userid=0, $modified=0) {
if ($this->get_instance()->grade >= 0) {
// Normal number
if ($editing) {
- $o = '<input type="text" name="quickgrade_' . $userid . '" value="' . format_float($grade) . '" size="6" maxlength="10" class="quickgrade"/>';
+ if ($grade < 0) {
+ $displaygrade = '';
+ } else {
+ $displaygrade = format_float($grade);
+ }
+ $o = '<input type="text" name="quickgrade_' . $userid . '" value="' . $displaygrade . '" size="6" maxlength
$o .= '&nbsp;/&nbsp;' . format_float($this->get_instance()->grade,2);
$o .= '<input type="hidden" name="grademodified_' . $userid . '" value="' . $modified . '"/>';
return $o;
@@ -1636,7 +1641,7 @@ private function view_single_grade_page($mform, $offset=0) {
}
if ($grade) {
$data = new stdClass();
- if ($grade->grade >= 0) {
+ if ($grade->grade !== NULL && $grade->grade >= 0) {
$data->grade = format_float($grade->grade,2);
}
} else {
@@ -1897,7 +1902,7 @@ private function view_edit_submission_page($mform) {
private function is_graded($userid) {
$grade = $this->get_user_grade($userid, false);
if ($grade) {
- return ($grade->grade != '');
+ return ($grade->grade !== NULL && $grade->grade >= 0);
}
return false;
}

0 comments on commit 2d8a9ce

Please sign in to comment.
Something went wrong with that request. Please try again.