MDL-12517 null not treated properly, max instead of min typo and pretty please initialize all objects properly; merged from MOODLE_19_STABLE

This commit is contained in:
skodak 2007-12-18 13:27:31 +00:00
parent 6477f991e6
commit 379ea94931

View File

@ -199,15 +199,18 @@ class grade_report_grader extends grade_report {
$finalgrade = unformat_float($postedvalue);
}
// Warn if the grade is out of bounds.
$errorstr = '';
if ($finalgrade < $grade_item->grademax) {
// Warn if the grade is out of bounds.
if (is_null($finalgrade)) {
// ok
} else if ($finalgrade < $grade_item->grademin) {
$errorstr = 'lessthanmin';
} else if ($finalgrade > $grade_item->grademax) {
$errorstr = 'morethanmax';
}
if ($errorstr) {
$user = get_record('user', 'id', $userid,'','','','','id, firstname, lastname');
$gradestr = new object();
$gradestr->username = fullname($user);
$gradestr->itemname = $grade_item->get_name();
notify(get_string($errorstr, 'grades', $gradestr));