only export active learning outcomes and groups

test plan:
* create a course with multiple learning outcomes
* delete one of them
* copy the course
* the deleted outcome should not re-appear in the copy

fixes #CNVS-4358

Change-Id: I2ec16a250d2bcaf70ab0e06d5711e18a2839c415
Reviewed-on: https://gerrit.instructure.com/34798
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
This commit is contained in:
James Williams 2014-05-13 09:05:18 -06:00
parent 8e412e06aa
commit fa9cdafdc6
2 changed files with 22 additions and 2 deletions

View File

@ -56,11 +56,11 @@ module CC
end
def process_outcome_group_content(node, group)
group.child_outcome_groups.each do |item|
group.child_outcome_groups.active.each do |item|
next unless export_object?(item, 'learning_outcomes') || export_object?(item, 'learning_outcome_groups')
process_outcome_group(node, item)
end
group.child_outcome_links.each do |item|
group.child_outcome_links.active.each do |item|
item = item.content
next unless export_object?(item, 'learning_outcomes')
process_learning_outcome(node, item, group)

View File

@ -780,6 +780,26 @@ describe ContentMigration do
lo3_new.data.should == lo3.data
end
it "should not copy deleted learning outcomes into the new course" do
old_root = @copy_from.root_outcome_group
log = @copy_from.learning_outcome_groups.new
log.context = @copy_from
log.title = "An outcome group"
log.description = "<p>Groupage</p>"
log.save!
old_root.adopt_outcome_group(log)
lo = create_outcome(@copy_from, log)
lo2 = create_outcome(@copy_from, log)
lo2.destroy
run_course_copy
@copy_to.created_learning_outcomes.count.should == 1
@copy_to.created_learning_outcomes.first.migration_id.should == mig_id(lo)
end
it "should relink to external outcomes" do
account = @copy_from.account
a_group = account.root_outcome_group