Permalink
Browse files

MDL-37883 Assign offline marking: Properly handle french decimal grad…

…es when importing worksheet.
  • Loading branch information...
1 parent cd1792a commit 99aa14d1ffaa9b61551a50ee36281d56f05b97c1 @damyon damyon committed Feb 6, 2013
Showing with 10 additions and 3 deletions.
  1. +4 −3 mod/assign/feedback/offline/importgradesform.php
  2. +6 −0 mod/assign/feedback/offline/locallib.php
View
7 mod/assign/feedback/offline/importgradesform.php
@@ -109,6 +109,8 @@ public function definition() {
} else {
$grade = '';
}
+ } else {
+ $grade = unformat_float($grade);
}
if ($usergrade && $usergrade->grade == $grade) {
@@ -123,10 +125,9 @@ public function definition() {
} 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;
}
View
6 mod/assign/feedback/offline/locallib.php
@@ -131,6 +131,8 @@ public function process_import_grades($draftid, $importid, $ignoremodified) {
} else {
$record->grade = '';
}
+ } else {
+ $record->grade = unformat_float($record->grade);
}
// Note: Do not count the seconds when comparing modified dates.
@@ -149,6 +151,10 @@ public function process_import_grades($draftid, $importid, $ignoremodified) {
} 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) {

0 comments on commit 99aa14d

Please sign in to comment.