Merge branch 'MDL-47763-master' of git://github.com/damyon/moodle

This commit is contained in:
Marina Glancy 2014-10-23 15:42:46 +08:00 committed by Eloy Lafuente (stronk7)
commit 65504187d8
2 changed files with 40 additions and 34 deletions

View File

@ -446,6 +446,32 @@ class grade_report_user extends grade_report {
}
}
// Actual Grade - We need to calculate this whether the row is hidden or not.
$gradeval = $grade_grade->finalgrade;
$hint = $grade_grade->get_aggregation_hint();
if (!$this->canviewhidden) {
/// Virtual Grade (may be calculated excluding hidden items etc).
$adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($this->courseid,
$grade_grade->grade_item,
$gradeval);
$gradeval = $adjustedgrade['grade'];
// We temporarily adjust the view of this grade item - because the min and
// max are affected by the hidden values in the aggregation.
$grade_grade->grade_item->grademax = $adjustedgrade['grademax'];
$grade_grade->grade_item->grademin = $adjustedgrade['grademin'];
$hint['status'] = $adjustedgrade['aggregationstatus'];
$hint['weight'] = $adjustedgrade['aggregationweight'];
} else {
// The max and min for an aggregation may be different to the grade_item.
if (!is_null($gradeval)) {
$grade_grade->grade_item->grademax = $grade_grade->rawgrademax;
$grade_grade->grade_item->grademin = $grade_grade->rawgrademin;
}
}
if (!$hide) {
/// Excluded Item
/**
@ -473,31 +499,6 @@ class grade_report_user extends grade_report {
$data['itemname']['celltype'] = 'th';
$data['itemname']['id'] = $header_row;
/// Actual Grade
$gradeval = $grade_grade->finalgrade;
$hint = $grade_grade->get_aggregation_hint();
if (!$this->canviewhidden) {
/// Virtual Grade (may be calculated excluding hidden items etc).
$adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($this->courseid,
$grade_grade->grade_item,
$gradeval);
$gradeval = $adjustedgrade['grade'];
// We temporarily adjust the view of this grade item - because the min and
// max are affected by the hidden values in the aggregation.
$grade_grade->grade_item->grademax = $adjustedgrade['grademax'];
$grade_grade->grade_item->grademin = $adjustedgrade['grademin'];
$hint['status'] = $adjustedgrade['aggregationstatus'];
$hint['weight'] = $adjustedgrade['aggregationweight'];
} else {
// The max and min for an aggregation may be different to the grade_item.
if (!is_null($gradeval)) {
$grade_grade->grade_item->grademax = $grade_grade->rawgrademax;
$grade_grade->grade_item->grademin = $grade_grade->rawgrademin;
}
}
if ($this->showfeedback) {
// Copy $class before appending itemcenter as feedback should not be centered
$classfeedback = $class;
@ -649,17 +650,20 @@ class grade_report_user extends grade_report {
$data['contributiontocoursetotal']['content'] = '-';
$data['contributiontocoursetotal']['headers'] = "$header_cat $header_row contributiontocoursetotal";
$hint['grademax'] = $grade_grade->grade_item->grademax;
$hint['grademin'] = $grade_grade->grade_item->grademin;
$hint['grade'] = $gradeval;
$parent = $grade_object->load_parent_category();
if ($grade_object->is_category_item()) {
$parent = $parent->load_parent_category();
}
$hint['parent'] = $parent->load_grade_item()->id;
$this->aggregationhints[$grade_grade->itemid] = $hint;
}
}
// We collect the aggregation hints whether they are hidden or not.
if ($this->showcontributiontocoursetotal) {
$hint['grademax'] = $grade_grade->grade_item->grademax;
$hint['grademin'] = $grade_grade->grade_item->grademin;
$hint['grade'] = $gradeval;
$parent = $grade_object->load_parent_category();
if ($grade_object->is_category_item()) {
$parent = $parent->load_parent_category();
}
$hint['parent'] = $parent->load_grade_item()->id;
$this->aggregationhints[$grade_grade->itemid] = $hint;
}
}
/// Category

View File

@ -703,6 +703,8 @@ class grade_grade extends grade_object {
} else if ($grade_grade->is_hidden()) {
$hiddenfound = true;
$altered[$grade_grade->itemid] = null;
$alteredaggregationstatus[$grade_grade->itemid] = 'dropped';
$alteredaggregationweight[$grade_grade->itemid] = 0;
} else if ($grade_grade->is_locked() or $grade_grade->is_overridden()) {
// no need to recalculate locked or overridden grades
} else {