MDL-40214 mod_assign: Fixed issue with custom scale being lost during restore.
authorColin Campbell <colin@umn.edu>
Tue, 27 Aug 2013 14:22:43 +0000 (09:22 -0500)
committerMark Nelson <markn@moodle.com>
Wed, 28 Aug 2013 02:52:47 +0000 (10:52 +0800)
mod/assign/backup/moodle2/restore_assign_stepslib.php

index 648dcad..6fd6cf4 100644 (file)
@@ -100,6 +100,10 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
             $data->cutoffdate = $this->apply_date_offset($data->cutoffdate);
         }
 
+        if ($data->grade < 0) { // Scale found, get mapping.
+            $data->grade = -($this->get_mappingid('scale', abs($data->grade)));
+        }
+
         $newitemid = $DB->insert_record('assign', $data);
 
         $this->apply_activity_instance($newitemid);