diff --git a/app/models/importers/context_module_importer.rb b/app/models/importers/context_module_importer.rb index 5816420b6d7..9adc21e1f3f 100644 --- a/app/models/importers/context_module_importer.rb +++ b/app/models/importers/context_module_importer.rb @@ -73,6 +73,7 @@ module Importers item.start_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(hash[:start_at]) if hash[:start_at] item.end_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(hash[:end_at]) if hash[:end_at] item.require_sequential_progress = hash[:require_sequential_progress] if hash[:require_sequential_progress] + item.requirement_count = hash[:requirement_count] if hash[:requirement_count] if hash[:prerequisites] preqs = [] diff --git a/lib/cc/importer/canvas/module_converter.rb b/lib/cc/importer/canvas/module_converter.rb index 8c076972568..ef281a9611b 100644 --- a/lib/cc/importer/canvas/module_converter.rb +++ b/lib/cc/importer/canvas/module_converter.rb @@ -33,6 +33,7 @@ module CC::Importer::Canvas mod[:end_at] = get_time_val(r_node, 'end_at') mod[:unlock_at] = get_time_val(r_node, 'unlock_at') mod[:require_sequential_progress] = get_bool_val(r_node, 'require_sequential_progress') + mod[:requirement_count] = get_int_val(r_node, 'requirement_count') mod[:items] = [] r_node.css('item').each do |item_node| diff --git a/lib/cc/module_meta.rb b/lib/cc/module_meta.rb index 1fbd205d0c2..50d39c76a2a 100644 --- a/lib/cc/module_meta.rb +++ b/lib/cc/module_meta.rb @@ -60,6 +60,7 @@ module CC m_node.start_at CCHelper::ims_datetime(cm.start_at) if cm.start_at m_node.end_at CCHelper::ims_datetime(cm.end_at) if cm.end_at m_node.require_sequential_progress cm.require_sequential_progress.to_s unless cm.require_sequential_progress.nil? + m_node.requirement_count cm.requirement_count if cm.requirement_count if cm.prerequisites && !cm.prerequisites.empty? m_node.prerequisites do |pre_reqs| diff --git a/lib/cc/xsd/cccv1p0.xsd b/lib/cc/xsd/cccv1p0.xsd index 5c8a2a1c9b3..f4c9b16cb3a 100644 --- a/lib/cc/xsd/cccv1p0.xsd +++ b/lib/cc/xsd/cccv1p0.xsd @@ -184,6 +184,7 @@ + diff --git a/spec/models/content_migration/course_copy_spec.rb b/spec/models/content_migration/course_copy_spec.rb index fb0eafc81dd..a0dcd69c7ba 100644 --- a/spec/models/content_migration/course_copy_spec.rb +++ b/spec/models/content_migration/course_copy_spec.rb @@ -408,6 +408,31 @@ describe ContentMigration do expect(@copy_to.syllabus_body).to eq @copy_from.syllabus_body.sub("http://derp.derp", "https://derp.derp") end + it "should copy module settings" do + mod1 = @copy_from.context_modules.create!(:name => "some module") + tag = mod1.add_item({ :title => 'Example 1', :type => 'external_url', :url => 'http://derp.derp/something' }) + mod1.completion_requirements = {tag.id => {:type => 'must_view'}} + mod1.require_sequential_progress = true + mod1.requirement_count = 1 + mod1.save! + + mod2 = @copy_from.context_modules.create!(:name => "some module 2") + mod2.prerequisites = "module_#{mod1.id}" + mod2.save! + + run_course_copy + + mod1_to = @copy_to.context_modules.where(:migration_id => mig_id(mod1)).first + tag_to = mod1_to.content_tags.first + expect(mod1_to.completion_requirements).to eq [{:id => tag_to.id, :type => 'must_view'}] + expect(mod1_to.require_sequential_progress).to be_truthy + expect(mod1_to.requirement_count).to be_truthy + mod2_to = @copy_to.context_modules.where(:migration_id => mig_id(mod2)).first + + expect(mod2_to.prerequisites.count).to eq 1 + expect(mod2_to.prerequisites.first[:id]).to eq mod1_to.id + end + it "should preserve media comment links" do skip unless Qti.qti_enabled?