copy assignment rubric outcomes in selective export

fixes CNVS-14822

test plan:
 - have an assignment with a rubric that references an outcome
 - copy the course containing the assignment, selecting only the
   assignment
 - the destination course should contain copies of the assignment,
   rubric, and outcome, linked as in the source course

Change-Id: I425dc2bb241ec8996c2195bf9365750e50e42e85
Reviewed-on: https://gerrit.instructure.com/40105
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
This commit is contained in:
Jeremy Stanley 2014-08-27 12:45:43 -06:00
parent 10146e8175
commit 1c471bb890
3 changed files with 16 additions and 1 deletions

View File

@ -38,8 +38,8 @@ module CC
resources << run_and_set_progress(:create_external_feeds, nil, I18n.t('course_exports.errors.external_feeds', "Failed to export external feeds"))
resources << run_and_set_progress(:create_assignment_groups, nil, I18n.t('course_exports.errors.assignment_groups', "Failed to export assignment groups"))
resources << run_and_set_progress(:create_grading_standards, 20, I18n.t('course_exports.errors.grading_standards', "Failed to export grading standards"))
resources << run_and_set_progress(:create_learning_outcomes, nil, I18n.t('course_exports.errors.learning_outcomes', "Failed to export learning outcomes"))
resources << run_and_set_progress(:create_rubrics, nil, I18n.t('course_exports.errors.rubrics', "Failed to export rubrics"))
resources << run_and_set_progress(:create_learning_outcomes, nil, I18n.t('course_exports.errors.learning_outcomes', "Failed to export learning outcomes"))
resources << run_and_set_progress(:files_meta_path, nil, I18n.t('course_exports.errors.file_meta', "Failed to export file meta data"))
resources << run_and_set_progress(:create_events, 25, I18n.t('course_exports.errors.events', "Failed to export calendar events"))

View File

@ -47,6 +47,9 @@ module CC
end
end
imported_rubrics[rubric.id] = true
rubric.learning_outcome_alignments.each do |align|
add_item_to_export(align.learning_outcome, 'learning_outcomes')
end
migration_id = CCHelper.create_key(rubric)
rubrics_node.rubric(:identifier=>migration_id) do |r_node|

View File

@ -31,6 +31,18 @@ describe ContentMigration do
to_assign.learning_outcome_alignments.map(&:learning_outcome_id).should == [lo.id].sort
end
it "should copy rubric outcomes in selective copy" do
@course = @copy_from
outcome_with_rubric
from_assign = @copy_from.assignments.create! title: 'some assignment'
@rubric.associate_with(from_assign, @copy_from, purpose: 'grading')
@cm.copy_options = {:assignments => {mig_id(from_assign) => true}}
run_course_copy
to_assign = @copy_to.assignments.find_by_migration_id!(mig_id(from_assign))
to_outcomes = to_assign.rubric.learning_outcome_alignments.map(&:learning_outcome).map(&:migration_id)
to_outcomes.should eql [mig_id(@outcome)]
end
it "should link assignments to assignment groups on selective copy" do
g = @copy_from.assignment_groups.create!(:name => "group")
from_assign = @copy_from.assignments.create!(:title => "some assignment", :assignment_group_id => g.id)