mirror of
https://github.com/moodle/moodle.git
synced 2025-03-01 14:32:48 +01:00
Merge branch 'MOODLE_401_MDL-73378' of https://github.com/danielneis/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
f764c332e7
@ -716,6 +716,16 @@ class grade_category extends grade_object {
|
||||
|
||||
}
|
||||
|
||||
// First, check if all grades are null, because the final grade will be null
|
||||
// even when aggreateonlygraded is true.
|
||||
$allnull = true;
|
||||
foreach ($grade_values as $v) {
|
||||
if (!is_null($v)) {
|
||||
$allnull = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// For items with no value, and not excluded - either set their grade to 0 or exclude them.
|
||||
foreach ($items as $itemid=>$value) {
|
||||
if (!isset($grade_values[$itemid]) and !in_array($itemid, $excluded)) {
|
||||
@ -783,9 +793,13 @@ class grade_category extends grade_object {
|
||||
$result['grademin'] = 0;
|
||||
}
|
||||
|
||||
// Recalculate the grade back to requested range.
|
||||
$finalgrade = grade_grade::standardise_score($agg_grade, 0, 1, $result['grademin'], $result['grademax']);
|
||||
$grade->finalgrade = $this->grade_item->bounded_grade($finalgrade);
|
||||
if ($allnull) {
|
||||
$grade->finalgrade = null;
|
||||
} else {
|
||||
// Recalculate the grade back to requested range.
|
||||
$finalgrade = grade_grade::standardise_score($agg_grade, 0, 1, $result['grademin'], $result['grademax']);
|
||||
$grade->finalgrade = $this->grade_item->bounded_grade($finalgrade);
|
||||
}
|
||||
|
||||
$oldrawgrademin = $grade->rawgrademin;
|
||||
$oldrawgrademax = $grade->rawgrademax;
|
||||
|
Loading…
x
Reference in New Issue
Block a user