gradebook MDL-23543 made gradebook not display items with gradetype of no grade

This commit is contained in:
Andrew Davis 2010-08-03 07:22:27 +00:00
parent 1c88c777be
commit 7bac377763
3 changed files with 15 additions and 8 deletions

View File

@ -688,8 +688,6 @@ class grade_report_grader extends grade_report {
$object = $element['object'];
$type = $element['type'];
$categorystate = @$element['categorystate'];
$itemmodule = null;
$iteminstance = null;
if (!empty($element['colspan'])) {
$colspan = $element['colspan'];
@ -732,8 +730,8 @@ class grade_report_grader extends grade_report {
}
// Element is a grade_item
else {
$itemmodule = $element['object']->itemmodule;
$iteminstance = $element['object']->iteminstance;
//$itemmodule = $element['object']->itemmodule;
//$iteminstance = $element['object']->iteminstance;
if ($element['object']->id == $this->sortitemid) {
if ($this->sortorder == 'ASC') {

View File

@ -1038,6 +1038,10 @@ class grade_category extends grade_object {
$category_array['object']->set_sortorder($sortorder);
}
if (isset($category_array['object']->gradetype) && $category_array['object']->gradetype==GRADE_TYPE_NONE) {
return null;
}
// store the grade_item or grade_category instance with extra info
$result = array('object'=>$category_array['object'], 'type'=>$category_array['type'], 'depth'=>$category_array['depth']);
@ -1050,19 +1054,25 @@ class grade_category extends grade_object {
if (!empty($category_array['children'])) {
$result['children'] = array();
//process the category item first
$cat_item_id = null;
$child = null;
foreach ($category_array['children'] as $oldorder=>$child_array) {
if ($child_array['type'] == 'courseitem' or $child_array['type'] == 'categoryitem') {
$result['children'][$sortorder] = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
$child = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
if (!empty($child)) {
$result['children'][$sortorder] = $child;
}
}
}
foreach ($category_array['children'] as $oldorder=>$child_array) {
if ($child_array['type'] != 'courseitem' and $child_array['type'] != 'categoryitem') {
$result['children'][++$sortorder] = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
$child = grade_category::_fetch_course_tree_recursion($child_array, $sortorder);
if (!empty($child)) {
$result['children'][++$sortorder] = $child;
}
}
}
}

View File

@ -468,7 +468,6 @@ function lesson_grade_item_update($lesson, $grades=NULL) {
$params['gradetype'] = GRADE_TYPE_VALUE;
$params['grademax'] = $lesson->grade;
$params['grademin'] = 0;
} else {
$params['gradetype'] = GRADE_TYPE_NONE;
}