stop syncing quiz only_visible_to_overrides by default

should behave similarly to assignment importer,
only setting it when an mastery paths override is copied

test plan:
* create a quiz and sync it
* edit the copied quiz and give it a due date for everybody
* edit the original quiz and set it so it's no longer
 available for eveybody but just one section
* syncing the quiz should not erase the assigned
 due date on the copy

closes #LS-1203

Change-Id: I9e59b12ffe866b93bcb06d97cfa418babaec7d9d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242478
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
James Williams 2020-07-13 09:43:04 -06:00
parent 5a8af37e8b
commit 46f2855db3
3 changed files with 17 additions and 2 deletions

View File

@ -216,7 +216,6 @@ module Importers
lockdown_browser_monitor_data
one_time_results
show_correct_answers_last_attempt
only_visible_to_overrides
].each do |attr|
attr = attr.to_sym
if hash.key?(attr)
@ -260,6 +259,9 @@ module Importers
migration.add_imported_item(override,
key: [item.migration_id, override.set_type, override.set_id].join('/'))
end
if hash.has_key?(:only_visible_to_overrides)
item.only_visible_to_overrides = hash[:only_visible_to_overrides]
end
end
if item.graded? && !item.assignment

View File

@ -446,7 +446,6 @@ describe ContentMigration do
:lockdown_browser_monitor_data => 'VGVzdCBEYXRhCg==',
:one_time_results => true,
:show_correct_answers_last_attempt => true,
:only_visible_to_overrides => true,
}
q = @copy_from.quizzes.create!(attributes)

View File

@ -1362,6 +1362,20 @@ describe MasterCourses::MasterMigration do
expect(copied_topic_assmt.reload.due_at.to_i).to eq new_master_due_at.to_i
end
it "should not copy only_visible_to_overrides for quizzes by default" do
@copy_to = course_factory
sub = @template.add_child_course!(@copy_to)
quiz_assmt = @copy_from.assignments.create!(:submission_types => 'online_quiz').reload
quiz = quiz_assmt.quiz
quiz.update_attribute(:only_visible_to_overrides, true)
run_master_migration
copied_quiz = @copy_to.quizzes.where(:migration_id => mig_id(quiz)).first
expect(copied_quiz.only_visible_to_overrides).to eq false
end
it "allows a minion course's change of the graded status of a discussion topic to stick" do
@copy_to = course_factory
sub = @template.add_child_course!(@copy_to)