don't copy name, course code, and start/end dates on course copy

These values are usually set on a course before copying and
shouldn't be overwritten

Test Plan:
 * Copy a course and set a different name, code, and dates for the new course
 * Those different values should not be overwritten when the copy is finished

closes #8263 #8344

Change-Id: I88524638f93a18e23e7aa53e22d9dcba0988e6c9
Reviewed-on: https://gerrit.instructure.com/10289
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Bracken Mosbacker 2012-04-24 15:32:10 -06:00
parent 5a9379d3a4
commit 56184d8bc6
3 changed files with 6 additions and 9 deletions

View File

@ -1768,10 +1768,6 @@ class Course < ActiveRecord::Base
def import_settings_from_migration(data)
return unless data[:course]
settings = data[:course]
self.name = settings[:title] if settings[:title].present?
self.course_code = settings[:course_code] if settings[:course_code].present?
self.conclude_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(settings[:conclude_at]) if settings[:conclude_at]
self.start_at = Canvas::Migration::MigratorHelper.get_utc_time_from_timestamp(settings[:start_at]) if settings[:start_at]
self.syllabus_body = ImportedHtmlConverter.convert(settings[:syllabus_body], self) if settings[:syllabus_body]
if settings[:tab_configuration] && settings[:tab_configuration].is_a?(Array)
self.tab_configuration = settings[:tab_configuration]

View File

@ -6,6 +6,8 @@ describe "Canvas Cartridge importing" do
@copy_from = course_model
@from_teacher = @user
@copy_to = course_model
@copy_to.conclude_at = nil
@copy_to.start_at = nil
@copy_to.name = "alt name"
@copy_to.course_code = "alt name"
@ -68,12 +70,12 @@ describe "Canvas Cartridge importing" do
@copy_to.save!
#compare settings
@copy_to.conclude_at.to_i.should == @copy_from.conclude_at.to_i
@copy_to.start_at.to_i.should == @copy_from.start_at.to_i
@copy_to.conclude_at.should == nil
@copy_to.start_at.should == nil
@copy_to.syllabus_body.should == (body_with_link % @copy_to.id)
@copy_to.storage_quota.should_not == @copy_from.storage_quota
@copy_to.name.should == @copy_from.name
@copy_to.course_code.should == @copy_from.course_code
@copy_to.name.should == 'alt name'
@copy_to.course_code.should == 'alt name'
atts = Course.clonable_attributes
atts -= Canvas::Migration::MigratorHelper::COURSE_NO_COPY_ATTS
atts.each do |att|

View File

@ -96,7 +96,6 @@ describe ContentMigration do
@copy_to.locale.should == 'es'
@copy_to.tab_configuration.should == @copy_from.tab_configuration
@copy_to.name.should == @copy_from.name
end
it "should copy external tools" do