MDL-55519 activities: mform element shows correct maxgrade.
authorAdrian Greeve <adrian@moodle.com>
Thu, 15 Sep 2016 08:00:53 +0000 (16:00 +0800)
committerAdrian Greeve <adrian@moodle.com>
Tue, 20 Sep 2016 00:56:24 +0000 (08:56 +0800)
In certain circumstances the max grade value would revert
back to the default max grade value.

lib/form/modgrade.php

index 1be7cc8..6086f94 100644 (file)
@@ -503,7 +503,8 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group {
                             $this->scaleformelement->setValue(($value * -1));
                         } else if ($value > 0) {
                             $this->gradetypeformelement->setValue('point');
-                            $this->maxgradeformelement->setValue($value);
+                            $maxvalue = !empty($this->currentgrade) ? (string)unformat_float($this->currentgrade) : $value;
+                            $this->maxgradeformelement->setValue($maxvalue);
                         }
                     } else {
                         $this->gradetypeformelement->setValue('none');