diff --git a/lib/form/modgrade.php b/lib/form/modgrade.php index 863f1b1db49..410bb17b9e7 100644 --- a/lib/form/modgrade.php +++ b/lib/form/modgrade.php @@ -285,10 +285,18 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group { protected function process_value($type='none', $scale=null, $point=null, $rescalegrades=null) { global $COURSE; $val = 0; - if ($this->isupdate && $this->hasgrades && $this->canrescale && $this->currentgradetype == 'point' && empty($rescalegrades)) { - // If the maxgrade field is disabled with javascript, no value is sent with the form and mform assumes the default. + + // If the maxgrade field is disabled with javascript, no value is sent with the form and mform assumes the default. + if ($this->isupdate && $this->hasgrades && $this->currentgradetype == 'point') { + // If the user cannot rescale, then return the original. + $returnoriginal = !$this->canrescale; + // If the user was forced to choose a rescale option - and they haven't - prevent any changes to the max grade. - return (string)unformat_float($this->currentgrade); + $returnoriginal = $returnoriginal || ($this->canrescale && empty($rescalegrades)); + + if ($returnoriginal) { + return (string)unformat_float($this->currentgrade); + } } switch ($type) { case 'point':