MDL-37883 Assign offline marking: Properly handle french decimal grades when importin...
authorDamyon Wiese <damyon@moodle.com>
Wed, 6 Feb 2013 07:09:02 +0000 (15:09 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 6 Feb 2013 07:43:19 +0000 (15:43 +0800)
mod/assign/feedback/offline/importgradesform.php
mod/assign/feedback/offline/locallib.php

index baba18d..9eea55c 100644 (file)
@@ -109,6 +109,8 @@ class assignfeedback_offline_import_grades_form extends moodleform implements re
                 } else {
                     $grade = '';
                 }
+            } else {
+                $grade = unformat_float($grade);
             }
 
             if ($usergrade && $usergrade->grade == $grade) {
@@ -123,10 +125,9 @@ class assignfeedback_offline_import_grades_form extends moodleform implements re
             } else if ($assignment->grading_disabled($user->id)) {
                 // Skip grade is locked.
                 $skip = true;
-            } else if (!is_numeric($gradedesc) && ($assignment->get_instance()->grade) > -1) {
-                $skip = true;
             } else if (($assignment->get_instance()->grade > -1) &&
-                      (($gradedesc < 0) || ($gradedesc > $assignment->get_instance()->grade))) {
+                      (($grade < 0) || ($grade > $assignment->get_instance()->grade))) {
+                // Out of range.
                 $skip = true;
             }
 
index e01d7b8..b1fd7b9 100644 (file)
@@ -131,6 +131,8 @@ class assign_feedback_offline extends assign_feedback_plugin {
                 } else {
                     $record->grade = '';
                 }
+            } else {
+                $record->grade = unformat_float($record->grade);
             }
 
             // Note: Do not count the seconds when comparing modified dates.
@@ -149,6 +151,10 @@ class assign_feedback_offline extends assign_feedback_plugin {
             } else if ($this->assignment->grading_disabled($record->user->id)) {
                 // Skip grade is locked.
                 $skip = true;
+            } else if (($this->assignment->get_instance()->grade > -1) &&
+                      (($record->grade < 0) || ($record->grade > $this->assignment->get_instance()->grade))) {
+                // Out of range.
+                $skip = true;
             }
 
             if (!$skip) {