backfill NQ tool configs with anonymous_grading variable
closes QUIZ-12096 flag = none test plan: - existing NQ tools receive the anonymous_grading field in the config Change-Id: I9cdaa81d28cfe27ce81245732a08864404216e61 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327048 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Weston Dransfield <wdransfield@instructure.com> QA-Review: Weston Dransfield <wdransfield@instructure.com> Migration-Review: Cody Cutrer <cody@instructure.com> Product-Review: Jared Crystal <jcrystal@instructure.com>
This commit is contained in:
parent
c1601702c0
commit
ae086f61d2
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (C) 2023 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
class AddAnonymousGradingFieldToQuizLtiTools < ActiveRecord::Migration[7.0]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::AddAnonymousGradingFieldToQuizLtiTools.delay_if_production(
|
||||
priority: Delayed::LOW_PRIORITY,
|
||||
n_strand: ["add_anonymous_grading_to_quiz_lti_tools", Shard.current.database_server.id]
|
||||
).run
|
||||
end
|
||||
|
||||
def down; end
|
||||
end
|
|
@ -0,0 +1,31 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# Copyright (C) 2023 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module DataFixup::AddAnonymousGradingFieldToQuizLtiTools
|
||||
def self.run
|
||||
ContextExternalTool.quiz_lti.find_each do |quiz_lti_tool|
|
||||
quiz_lti_tool.custom_fields = quiz_lti_tool.custom_fields.merge(
|
||||
{
|
||||
"canvas_assignment_anonymous_grading" => "$com.instructure.Assignment.anonymous_grading"
|
||||
}
|
||||
)
|
||||
quiz_lti_tool.save! if quiz_lti_tool.changed?
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,46 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# Copyright (C) 2023 - present Instructure, Inc.
|
||||
#
|
||||
# This file is part of Canvas.
|
||||
#
|
||||
# Canvas is free software: you can redistribute it and/or modify it under
|
||||
# the terms of the GNU Affero General Public License as published by the Free
|
||||
# Software Foundation, version 3 of the License.
|
||||
#
|
||||
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License along
|
||||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
describe DataFixup::AddAnonymousGradingFieldToQuizLtiTools do
|
||||
describe ".run" do
|
||||
let!(:lti) do
|
||||
ContextExternalTool.create!(
|
||||
{
|
||||
name: "Quizzes 2",
|
||||
tool_id: "Quizzes 2",
|
||||
context: Account.default,
|
||||
shared_secret: "a",
|
||||
consumer_key: "b",
|
||||
url: "http://example.com/launch",
|
||||
custom_fields: { "key" => "value" }
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it "adds the canvas_assignment_anonymous_grading custom field to Quiz LTI ContextExternalTool" do
|
||||
DataFixup::AddAnonymousGradingFieldToQuizLtiTools.run
|
||||
expect(lti.reload.custom_fields).to eq(
|
||||
{
|
||||
"canvas_assignment_anonymous_grading" => "$com.instructure.Assignment.anonymous_grading",
|
||||
"key" => "value"
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue