gradebook MDL-19070 Added a guard to protect against a potential error

This commit is contained in:
Andrew Davis 2010-08-11 07:28:57 +00:00
parent 89e2569b0f
commit e2a8447777

View File

@ -793,7 +793,12 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
$grademax = format_float($item->grademax, $item->get_decimals());
} elseif ($item->gradetype == GRADE_TYPE_SCALE) {
$scale = $DB->get_record('scale', array('id' => $item->scaleid));
$scale_items = explode(',', $scale->scale);
$scale_items = null;
if (empty($scale)) { //if the item is using a scale that's been removed
$scale_items = array();
} else {
$scale_items = explode(',', $scale->scale);
}
$grademax = end($scale_items) . ' (' . count($scale_items) . ')';
} elseif ($item->is_external_item()) {
$grademax = format_float($item->grademax, $item->get_decimals());