MDL-37883 Assignment Grade import/export. Additional fix to prevent different grade...
authorDamyon Wiese <damyon@moodle.com>
Wed, 13 Feb 2013 06:54:24 +0000 (14:54 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 13 Feb 2013 07:33:10 +0000 (15:33 +0800)
mod/assign/feedback/offline/importgradesform.php
mod/assign/gradingtable.php

index 9eea55c..e3ac2e4 100644 (file)
@@ -88,7 +88,6 @@ class assignfeedback_offline_import_grades_form extends moodleform implements re
         while ($record = $gradeimporter->next()) {
             $user = $record->user;
             $grade = $record->grade;
         while ($record = $gradeimporter->next()) {
             $user = $record->user;
             $grade = $record->grade;
-            $gradedesc = $grade;
             $modified = $record->modified;
             $userdesc = fullname($user);
             if ($assignment->is_blind_marking()) {
             $modified = $record->modified;
             $userdesc = fullname($user);
             if ($assignment->is_blind_marking()) {
@@ -134,7 +133,7 @@ class assignfeedback_offline_import_grades_form extends moodleform implements re
             if (!$skip) {
                 $update = true;
                 $updates[] = get_string('gradeupdate', 'assignfeedback_offline',
             if (!$skip) {
                 $update = true;
                 $updates[] = get_string('gradeupdate', 'assignfeedback_offline',
-                                            array('grade'=>$gradedesc, 'student'=>$userdesc));
+                                            array('grade'=>format_float($grade, 2), 'student'=>$userdesc));
             }
 
             if ($ignoremodified || !$stalemodificationdate) {
             }
 
             if ($ignoremodified || !$stalemodificationdate) {
index 44c392c..526ae85 100644 (file)
@@ -414,7 +414,7 @@ class assign_grading_table extends table_sql implements renderable {
                 if ($grade == -1 || $grade === null) {
                     return '';
                 }
                 if ($grade == -1 || $grade === null) {
                     return '';
                 }
-                return format_float($grade);
+                return format_float($grade, 2);
             } else {
                 // This is a custom scale.
                 $scale = $this->assignment->display_grade($grade, false);
             } else {
                 // This is a custom scale.
                 $scale = $this->assignment->display_grade($grade, false);
@@ -661,6 +661,10 @@ class assign_grading_table extends table_sql implements renderable {
         if ($row->timemarked && $row->grade !== null && $row->grade >= 0) {
             $o = userdate($row->timemarked);
         }
         if ($row->timemarked && $row->grade !== null && $row->grade >= 0) {
             $o = userdate($row->timemarked);
         }
+        if ($row->timemarked && $this->is_downloading()) {
+            // Force it for downloads as it affects import.
+            $o = userdate($row->timemarked);
+        }
 
         return $o;
     }
 
         return $o;
     }