Fix late_policy being imported in the wrong scenarios
fixes LS-2950 flag=none test plan: - Create two courses using different Gradebook Settings. - Adjust the Gradebook parent's settings (Late policy, Missing Policy, etc.). - Create an item (page, assignment, etc.) within the course. - Share that item to the child course using the “Send To” tool. - Check that the children's gradebook settings are still the same. Change-Id: Iec2250431741704291889bc75bc4cca8e2360e4c Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283244 Reviewed-by: Jackson Howe <jackson.howe@instructure.com> QA-Review: Jackson Howe <jackson.howe@instructure.com> Product-Review: Luis Oliveira <luis.oliveira@instructure.com> Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit is contained in:
parent
e63b1ba246
commit
253c8b5533
|
@ -176,10 +176,10 @@ module Importers
|
|||
Importers::CalendarEventImporter.process_migration(data, migration)
|
||||
Importers::LtiResourceLinkImporter.process_migration(data, migration)
|
||||
Importers::PacePlanImporter.process_migration(data, migration)
|
||||
Importers::LatePolicyImporter.process_migration(data, migration) if migration.copy_options && (migration.is_set?(migration.copy_options[:everything]) || migration.is_set?(migration.copy_options[:all_course_settings]))
|
||||
|
||||
everything_selected = !migration.copy_options || migration.is_set?(migration.copy_options[:everything])
|
||||
if everything_selected || migration.is_set?(migration.copy_options[:all_course_settings])
|
||||
Importers::LatePolicyImporter.process_migration(data, migration)
|
||||
import_settings_from_migration(course, data, migration)
|
||||
end
|
||||
migration.update_import_progress(90)
|
||||
|
|
|
@ -48,7 +48,7 @@ module CC
|
|||
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"))
|
||||
resources << run_and_set_progress(:add_late_policy, nil, I18n.t("course_exports.errors.late_policy", "Failed to export late policy"))
|
||||
resources << run_and_set_progress(:add_late_policy, nil, I18n.t("course_exports.errors.late_policy", "Failed to export late policy")) if export_symbol?(:all_course_settings)
|
||||
|
||||
if export_media_objects?
|
||||
File.write(File.join(@canvas_resource_dir, CCHelper::MEDIA_TRACKS), "") # just in case an error happens later
|
||||
|
|
|
@ -911,7 +911,8 @@ describe ContentMigration do
|
|||
expect(page_to.body).to eq(body % @copy_to.id.to_s)
|
||||
end
|
||||
|
||||
it "copies over late policy" do
|
||||
context "with late policy" do
|
||||
it "copies it over" do
|
||||
@copy_from.create_late_policy!(missing_submission_deduction_enabled: true, late_submission_deduction: 15.0, late_submission_interval: "day")
|
||||
run_course_copy
|
||||
|
||||
|
@ -919,19 +920,35 @@ describe ContentMigration do
|
|||
expect(new_late_policy.missing_submission_deduction_enabled).to be_truthy
|
||||
end
|
||||
|
||||
it "does not copy over late policy if other settings won't be imported" do
|
||||
it "does not copy it over if the export should have had no settings" do
|
||||
@copy_from.create_late_policy!(missing_submission_deduction_enabled: true, late_submission_deduction: 15.0, late_submission_interval: "day")
|
||||
@copy_to.create_late_policy!(missing_submission_deduction_enabled: true, late_submission_deduction: 10.0, late_submission_interval: "day")
|
||||
@cm = ContentMigration.create!(
|
||||
context: @copy_to,
|
||||
user: @user,
|
||||
source_course: @copy_from,
|
||||
migration_type: "course_copy_importer",
|
||||
copy_options: { everything: false }
|
||||
)
|
||||
run_course_copy
|
||||
new_late_policy = @copy_to.late_policy
|
||||
expect(new_late_policy.late_submission_deduction).to eq 10.0
|
||||
|
||||
@cm.copy_options = { everything: true }
|
||||
@cm.save!
|
||||
|
||||
run_export_and_import do |export|
|
||||
export.selected_content = { all_course_settings: false }
|
||||
end
|
||||
|
||||
expect(@copy_to.reload.late_policy.late_submission_deduction).to eq 10.0
|
||||
end
|
||||
|
||||
# This is for faulty direct shares that were exported with
|
||||
# late policy in their cartridges when they shouldn't have
|
||||
it "does not copy it over if the import requires no settings" do
|
||||
@copy_from.create_late_policy!(missing_submission_deduction_enabled: true, late_submission_deduction: 15.0, late_submission_interval: "day")
|
||||
@copy_to.create_late_policy!(missing_submission_deduction_enabled: true, late_submission_deduction: 10.0, late_submission_interval: "day")
|
||||
|
||||
@cm.copy_options = { everything: false }
|
||||
@cm.save!
|
||||
|
||||
run_export_and_import do |export|
|
||||
export.selected_content = { all_course_settings: true }
|
||||
end
|
||||
|
||||
expect(@copy_to.reload.late_policy.late_submission_deduction).to eq 10.0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue