canvas-lms/db/migrate/20180312105008_add_anonymou...

39 lines
1.2 KiB
Ruby
Raw Normal View History

Add anonymous grading assignment field Add an "anonymous grading" field to the Assignment object, and add a checkbox for it in the assignment UI that appears when the feature flags for anonymous moderated marking (the base flag) and AMM-related anonymous grading are enabled. closes GRADE-949 Test plan: * Run the attached migration and make sure there are no errors. Afterward, open up a database console and check that there are no values in the new column: > select * from assignments where anonymous_grading is null; The above query should return zero rows. * Make sure that undoing the migration using db:migrate:down properly deletes the new column (remember to re-run the migration before continuing!). * Enable Anonymous Moderated Marking at the account level if not already enabled. Create a new course and turn on the new Anonymous Marking flag for it. * Create an assignment and edit it. * There should be an "anonymous grading" checkbox on the edit page, and if you check (or uncheck) it its value should persist between views of the page. * Check that if you turn the new anonymous grading flag off for the course and edit the assignment again, the checkbox is no longer present. Change-Id: Ie8955644d78243008bdcd51a05689c093d5d8a8b Reviewed-on: https://gerrit.instructure.com/143402 Reviewed-by: Cody Cutrer <cody@instructure.com> Tested-by: Jenkins Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com> Reviewed-by: Derek Bender <djbender@instructure.com> Reviewed-by: Spencer Olson <solson@instructure.com> QA-Review: Indira Pai <ipai@instructure.com> Product-Review: Sidharth Oberoi <soberoi@instructure.com>
2018-03-13 01:53:02 +08:00
#
# Copyright (C) 2018 - 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 AddAnonymousGradingToAssignments < ActiveRecord::Migration[5.0]
tag :predeploy
def change
add_column :assignments, :anonymous_grading, :boolean
change_column_default :assignments, :anonymous_grading, from: nil, to: false
reversible do |dir|
dir.up do
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
:run,
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
Assignment,
:anonymous_grading,
default_value: false
)
end
end
end
end