From f778133a9939200365d9400b2b5cc068aeedd5dc Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Mon, 23 Apr 2012 11:30:11 +1200 Subject: [PATCH] MDL-32102 Course completion - only restore user completion if not adding to existing course --- backup/moodle2/restore_final_task.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backup/moodle2/restore_final_task.class.php b/backup/moodle2/restore_final_task.class.php index cebf2ea9e113f..4aec3df33f790 100644 --- a/backup/moodle2/restore_final_task.class.php +++ b/backup/moodle2/restore_final_task.class.php @@ -55,8 +55,11 @@ public function build() { $this->add_step(new restore_gradebook_structure_step('gradebook_step','gradebook.xml')); } - // Course completion - $this->add_step(new restore_course_completion_structure_step('course_completion', 'completion.xml')); + // Course completion, executed conditionally if restoring to new course + if ($this->get_target() !== backup::TARGET_CURRENT_ADDING && + $this->get_target() !== backup::TARGET_EXISTING_ADDING) { + $this->add_step(new restore_course_completion_structure_step('course_completion', 'completion.xml')); + } // Review all the module_availability records in backup_ids in order // to match them with existing modules / grade items.