Skip to content

Commit

Permalink
MDL-33125: core_backup: Prevent import/activity duplication from dupl…
Browse files Browse the repository at this point in the history
…icating manual grade items
  • Loading branch information
aolley committed Nov 26, 2012
1 parent 5f1d8f2 commit 69b0d17
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backup/moodle2/restore_stepslib.php
Expand Up @@ -190,6 +190,15 @@ protected function process_grade_item($data) {
$data->id = $newitemid = $existinggradeitem->id;
$DB->update_record('grade_items', $data);
}
} else if ($data->itemtype == 'manual') {
// Manual items aren't assigned to a cm, so don't go duplicating them in the target if one exists.
$gi = array(
'itemtype' => $data->itemtype,
'courseid' => $data->courseid,
'itemname' => $data->itemname,
'categoryid' => $data->categoryid,
);
$newitemid = $DB->get_field('grade_items', 'id', $gi);
}

if (empty($newitemid)) {
Expand Down

0 comments on commit 69b0d17

Please sign in to comment.