diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index da099840659..27bb3cf418c 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -968,6 +968,8 @@ class assign { static $scalegrades = array(); + $o = ''; + if ($this->get_instance()->grade >= 0) { // Normal number if ($editing && $this->get_instance()->grade > 0) { @@ -976,15 +978,18 @@ class assign { } else { $displaygrade = format_float($grade); } - $o = ''; + $o .= ''; $o .= ' / ' . format_float($this->get_instance()->grade,2); $o .= ''; return $o; } else { + $o .= ''; if ($grade == -1 || $grade === null) { - return '-'; + $o .= '-'; + return $o; } else { - return format_float(($grade),2) .' / '. format_float($this->get_instance()->grade,2); + $o .= format_float(($grade),2) .' / '. format_float($this->get_instance()->grade,2); + return $o; } } @@ -994,11 +999,12 @@ class assign { if ($scale = $DB->get_record('scale', array('id'=>-($this->get_instance()->grade)))) { $this->cache['scale'] = make_menu_from_list($scale->scale); } else { - return '-'; + $o .= '-'; + return $o; } } if ($editing) { - $o = ''; $o .= ''; foreach ($this->cache['scale'] as $optionid => $option) { $selected = ''; @@ -1013,9 +1019,11 @@ class assign { } else { $scaleid = (int)$grade; if (isset($this->cache['scale'][$scaleid])) { - return $this->cache['scale'][$scaleid]; + $o .= $this->cache['scale'][$scaleid]; + return $o; } - return '-'; + $o .= '-'; + return $o; } } } @@ -2620,19 +2628,16 @@ class assign { // gets a list of possible users and look for values based upon that. foreach ($participants as $userid => $unused) { $modified = optional_param('grademodified_' . $userid, -1, PARAM_INT); - if ($modified >= 0) { - // gather the userid, updated grade and last modified value - $record = new stdClass(); - $record->userid = $userid; - $record->grade = unformat_float(required_param('quickgrade_' . $record->userid, PARAM_TEXT)); - $record->lastmodified = $modified; - $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid)); - $users[$userid] = $record; + // Gather the userid, updated grade and last modified value. + $record = new stdClass(); + $record->userid = $userid; + $gradevalue = optional_param('quickgrade_' . $userid, '', PARAM_TEXT); + if($modified >= 0) { + $record->grade = unformat_float(optional_param('quickgrade_' . $record->userid, -1, PARAM_TEXT)); } - } - if (empty($users)) { - // Quick check to see whether we have any users to update and we don't - return get_string('quickgradingchangessaved', 'assign'); // Technical lie + $record->lastmodified = $modified; + $record->gradinginfo = grade_get_grades($this->get_course()->id, 'mod', 'assign', $this->get_instance()->id, array($userid)); + $users[$userid] = $record; } list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);