MDL-41249 assign: Fix incorrect gradingform restore step
authorDamyon Wiese <damyon@moodle.com>
Wed, 28 Aug 2013 08:29:19 +0000 (16:29 +0800)
committerDamyon Wiese <damyon@moodle.com>
Wed, 28 Aug 2013 08:29:19 +0000 (16:29 +0800)
The mapping in the previous patch was wrong - mod assign uses
the area "submissions" but the itemid is the grade->id not the submission->id.

mod/assign/backup/moodle2/restore_assign_stepslib.php

index d659cec..3af9fab 100644 (file)
@@ -134,7 +134,6 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
         // Note - the old contextid is required in order to be able to restore files stored in
         // sub plugin file areas attached to the submissionid.
         $this->set_mapping('submission', $oldid, $newitemid, false, null, $this->task->get_old_contextid());
-        $this->set_mapping(restore_gradingform_plugin::itemid_mapping('submissions'), $oldid, $newitemid);
     }
 
     /**
@@ -198,6 +197,7 @@ class restore_assign_activity_structure_step extends restore_activity_structure_
         // Note - the old contextid is required in order to be able to restore files stored in
         // sub plugin file areas attached to the gradeid.
         $this->set_mapping('grade', $oldid, $newitemid, false, null, $this->task->get_old_contextid());
+        $this->set_mapping(restore_gradingform_plugin::itemid_mapping('submissions'), $oldid, $newitemid);
     }
 
     /**