canvas-lms/db/migrate/20170628141007_add_seconds_...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
899 B
Ruby
Raw Normal View History

# frozen_string_literal: true
add seconds_late_override to submissions table Remove accepted_at and add seconds_late_override to the submissions table. closes CNVS-37893 Test Plan: 1. Verify running the migrations in this commit removes accepted_at and adds seconds_late_override to the submissions table. 2. Verify rolling back the migrations in this commit adds accepted_at and removes seconds_late_override from the submissions table. 3. Run the migration before following the next steps. 4. In a rails console, find a submission and set its late_policy_status to nil. s = Submission.find(<submission id>) s.update!(late_policy_status: nil) 5. Verify you cannot set seconds_late_override. s.update!(seconds_late_override: 60) s.seconds_late_override # => nil 6. Set the late_policy_status to "late" and verify you can set the seconds_late_override. Also verify the seconds_late method now returns the overridden value. s.update!(late_policy_status: "late", seconds_late_override: 60) s.seconds_late_override # => 60 s.seconds_late # => 60 s.update!(seconds_late_override: 20) s.seconds_late_override # => 20 s.seconds_late # => 20 7. Set the late_policy_status to something other than "late" and verify the seconds_late_override is set to nil. s.update!(late_policy_status: "missing") s.seconds_late_override # nil 8. As a teacher, hit the submissions update API endpoint (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/ submissions/#{student.id}.json") and pass: submission: { late_policy_status: 'late', seconds_late_override: 60 } a. Make sure the json response includes a late_policy_status of "late" and a seconds_late of 60. b. Load the submission in rails console and make sure its late_policy_status is set to "late" and its seconds_late_override is set to 60. 9. As a teacher, hit the submissions update API endpoint (PUT "/api/v1/courses/#{course.id}/assignments/#{assignment.id}/ submissions/#{student.id}.json") and pass: submission: { late_policy_status: 'missing', seconds_late_override: 60 } a. Make sure the json response includes a late_policy_status of "missing" and a seconds_late of 0. b. Load the submission in rails console and make sure its late_policy_status is set to "missing" and its seconds_late_override is set to nil. Change-Id: I9a8070445482b7029454cdfbbcc266aaab5a3e4b Reviewed-on: https://gerrit.instructure.com/117476 Tested-by: Jenkins Reviewed-by: Matt Taylor <mtaylor@instructure.com> Reviewed-by: Jeremy Neander <jneander@instructure.com> Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com> QA-Review: Anju Reddy <areddy@instructure.com> Reviewed-by: Rob Orton <rob@instructure.com> Product-Review: Keith T. Garner <kgarner@instructure.com>
2017-06-28 22:33:10 +08:00
#
# Copyright (C) 2017 - 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 AddSecondsLateOverrideToSubmissions < ActiveRecord::Migration[5.0]
tag :predeploy
def change
add_column :submissions, :seconds_late_override, :integer, limit: 8
end
end