MDL-36712: Assignment grading with custom scale is affected by the current language
authorDamyon Wiese <damyon@moodle.com>
Wed, 21 Nov 2012 07:17:03 +0000 (15:17 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 21 Nov 2012 07:35:08 +0000 (15:35 +0800)
mod/assign/locallib.php

index 7a8dcae..091c528 100644 (file)
@@ -3885,6 +3885,11 @@ class assign {
                 $grademenu = make_grades_menu($this->get_instance()->grade);
                 if (count($grademenu) > 0) {
                     $gradingelement = $mform->addElement('select', 'grade', get_string('grade').':', $grademenu);
+
+                    // The grade is already formatted with format_float so it needs to be converted back to an integer.
+                    if (!empty($data->grade)) {
+                        $data->grade = (int)unformat_float($data->grade);
+                    }
                     $mform->setType('grade', PARAM_INT);
                     if ($gradingdisabled) {
                         $gradingelement->freeze();