MDL-47006 core_grades: Add weightoverride to qualifies_for_regrading
Part of MDL-46576
This commit is contained in:
committed by
Adrian Greeve
parent
0281770091
commit
61e521bb09
@@ -153,7 +153,6 @@ if ($mform->is_cancelled()) {
|
||||
}
|
||||
|
||||
$grade_item = new grade_item(array('id'=>$id, 'courseid'=>$courseid));
|
||||
$previouslyoverridden = $grade_item->weightoverride;
|
||||
grade_item::set_properties($grade_item, $data);
|
||||
$grade_item->outcomeid = null;
|
||||
|
||||
@@ -162,12 +161,6 @@ if ($mform->is_cancelled()) {
|
||||
$grade_item->decimals = null;
|
||||
}
|
||||
|
||||
// If we are using natural weight and the weight has been un-overriden, force parent category to recalculate weights.
|
||||
if (isset($data->weightoverride) && $previouslyoverridden != $data->weightoverride &&
|
||||
$parent_category->aggregation == GRADE_AGGREGATE_SUM) {
|
||||
$parent_category->force_regrading();
|
||||
}
|
||||
|
||||
if (empty($grade_item->id)) {
|
||||
$grade_item->itemtype = 'manual'; // all new items to be manual only
|
||||
$grade_item->insert();
|
||||
|
||||
@@ -318,14 +318,15 @@ class grade_item extends grade_object {
|
||||
$multfactordiff = grade_floats_different($db_item->multfactor, $this->multfactor);
|
||||
$plusfactordiff = grade_floats_different($db_item->plusfactor, $this->plusfactor);
|
||||
$acoefdiff = grade_floats_different($db_item->aggregationcoef, $this->aggregationcoef);
|
||||
$acoefdiff2 = grade_floats_different($db_item->aggregationcoef2, $this->aggregationcoef2);
|
||||
$acoefdiff2 = grade_floats_different($db_item->aggregationcoef2, $this->aggregationcoef2);
|
||||
$weightoverride = grade_floats_different($db_item->weightoverride, $this->weightoverride);
|
||||
|
||||
$needsupdatediff = !$db_item->needsupdate && $this->needsupdate; // force regrading only if setting the flag first time
|
||||
$lockeddiff = !empty($db_item->locked) && empty($this->locked); // force regrading only when unlocking
|
||||
|
||||
return ($calculationdiff || $categorydiff || $gradetypediff || $grademaxdiff || $grademindiff || $scaleiddiff
|
||||
|| $outcomeiddiff || $multfactordiff || $plusfactordiff || $needsupdatediff
|
||||
|| $lockeddiff || $acoefdiff || $acoefdiff2 || $locktimediff);
|
||||
|| $lockeddiff || $acoefdiff || $acoefdiff2 || $weightoverride || $locktimediff);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user