mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-47430 core_grades: Handle negative grademin with natural weighting
Part of: MDL-46576
This commit is contained in:
parent
11c93e286b
commit
0b2e8ae07b
2 changed files with 34 additions and 8 deletions
|
@ -706,8 +706,15 @@ class grade_report_user extends grade_report {
|
|||
if (isset($this->aggregationhints[$itemid])) {
|
||||
|
||||
// Normalise the gradeval.
|
||||
$graderange = $this->aggregationhints[$itemid]['grademax'] - $this->aggregationhints[$itemid]['grademin'];
|
||||
$gradeval = ($this->aggregationhints[$itemid]['grade'] - $this->aggregationhints[$itemid]['grademin']) / $graderange;
|
||||
$gradecat = $grade_object->load_parent_category();
|
||||
if ($gradecat->aggregation == GRADE_AGGREGATE_SUM) {
|
||||
// Natural aggregation/Sum of grades does not consider the mingrade.
|
||||
$graderange = $this->aggregationhints[$itemid]['grademax'];
|
||||
$gradeval = $this->aggregationhints[$itemid]['grade'] / $graderange;
|
||||
} else {
|
||||
$graderange = $this->aggregationhints[$itemid]['grademax'] - $this->aggregationhints[$itemid]['grademin'];
|
||||
$gradeval = ($this->aggregationhints[$itemid]['grade'] - $this->aggregationhints[$itemid]['grademin']) / $graderange;
|
||||
}
|
||||
|
||||
// Multiply the normalised value by the weight
|
||||
// of all the categories higher in the tree.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue