Merge branch 'MDL-67218-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Jun Pataleta 2019-11-13 11:00:22 +08:00
commit ec99ffd352

View File

@ -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':