]> git.mjollnir.org Git - moodle.git/commitdiff
Scales are now supported in assignments restore
authorstronk7 <stronk7>
Mon, 18 Aug 2003 00:02:12 +0000 (00:02 +0000)
committerstronk7 <stronk7>
Mon, 18 Aug 2003 00:02:12 +0000 (00:02 +0000)
(when grade <0, I suppose).

mod/assignment/restorelib.php

index 55ce60e65ba25a44487ffa924819ab07b127e251..922bb603922693f04445c6a831300c0b68a36001 100644 (file)
             $assignment->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
             $assignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
 
+            //We have to recode the grade field if it is <0 (scale)
+            if ($assignment->grade < 0) {
+                $scale = backup_getid($restore->backup_unique_code,"scale",abs($assignment->grade));        
+                if ($scale) {
+                    $assignment->grade = -($scale->new_id);       
+                }
+            }
+
             //The structure is equal to the db, so insert the assignment
             $newid = insert_record ("assignment",$assignment);