Skip to content

Commit

Permalink
MDL-37883 Assign offline marking: Properly handle french decimal grad…
Browse files Browse the repository at this point in the history
…es when importing worksheet.
  • Loading branch information
Damyon Wiese committed Feb 6, 2013
1 parent cd1792a commit 99aa14d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mod/assign/feedback/offline/importgradesform.php
Expand Up @@ -109,6 +109,8 @@ public function definition() {
} else {
$grade = '';
}
} else {
$grade = unformat_float($grade);
}

if ($usergrade && $usergrade->grade == $grade) {
Expand All @@ -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;
}

Expand Down
6 changes: 6 additions & 0 deletions mod/assign/feedback/offline/locallib.php
Expand Up @@ -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.
Expand All @@ -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) {
Expand Down

0 comments on commit 99aa14d

Please sign in to comment.