mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-47703 core_grades: Prevent use of weights with non-aggregated scales
This commit is contained in:
parent
d63a81c507
commit
8b5c454562
4 changed files with 16 additions and 3 deletions
|
@ -1419,6 +1419,7 @@ class grade_category extends grade_object {
|
|||
* @return void
|
||||
*/
|
||||
private function auto_update_weights() {
|
||||
global $CFG;
|
||||
if ($this->aggregation != GRADE_AGGREGATE_SUM) {
|
||||
// This is only required if we are using natural weights.
|
||||
return;
|
||||
|
@ -1457,6 +1458,9 @@ class grade_category extends grade_object {
|
|||
} else if (!$this->aggregateoutcomes && $gradeitem->is_outcome_item()) {
|
||||
// We will not aggregate outcome items, so we can ignore them.
|
||||
continue;
|
||||
} else if (empty($CFG->grade_includescalesinaggregation) && $gradeitem->gradetype == GRADE_TYPE_SCALE) {
|
||||
// The scales are not included in the aggregation, ignore them.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Record the ID and the weight for this grade item.
|
||||
|
@ -1530,6 +1534,9 @@ class grade_category extends grade_object {
|
|||
} else if (!$this->aggregateoutcomes && $gradeitem->is_outcome_item()) {
|
||||
// We will not aggregate outcome items, so we can ignore updating their weights.
|
||||
continue;
|
||||
} else if (empty($CFG->grade_includescalesinaggregation) && $gradeitem->gradetype == GRADE_TYPE_SCALE) {
|
||||
// We will not aggregate the scales, so we can ignore upating their weights.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$gradeitem->weightoverride) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue