canvas-lms/db/migrate/20140606220920_add_position...

29 lines
922 B
Ruby
Raw Normal View History

#
# Copyright (C) 2014 - 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 AddPositionColumnToPollChoices < ActiveRecord::Migration[4.2]
add explicit poll choice ordering and poll_session deletion fixes CNVS-13521,CNVS-13489 This commit adds 3 things. One is a fix for deleting a poll_session when there are poll_submissions created already for the poll_session. The second is the addition of a new attribute on poll_choices called 'position'. The 'position' attribute specifies the order a poll choice should be returned in. The third is the visibility of poll sessions to students: as long as a student is enrolled in the course (and course section, if it exists on the poll session) associated with the poll session, they can access it, whether or not it's open or closed. Test plans 1. Deleting a poll session As a teacher - Create a poll and related poll session - Open the poll session for submissions As a student - Create a submission for the newly created poll session As a teacher - You should be able to delete the poll session 2. Position ordering attribute As a teacher - Create a poll - Create poll choices, passing along the 'position' attribute to specify ordering (try to mix these up, e.g. create a poll choice with a position of 2, then a poll choice with an position of 4, then a poll choice with an position of 3, then a poll choice with an position of 1) - Retrieve the poll choices for the poll with the poll choices index endpoint - The poll should be returned in the order they were specified using the 'position' attribute 3. Poll session visibility to students As a teacher - Create a poll - Create an associated poll session with a valid course As a student enrolled in the given course - You should be able to view the poll session whether or not it's open or closed. As a student not enrolled in the given course - You should not be able to view the poll session, whether or not it's open or closed. Change-Id: Ifabd64540d843c83f3a22fb6668c4fcac8f728b0 Reviewed-on: https://gerrit.instructure.com/36087 Reviewed-by: Derek DeVries <ddevries@instructure.com> QA-Review: Trevor deHaan <tdehaan@instructure.com> Product-Review: Bryan Madsen <bryan@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-06-07 06:24:54 +08:00
tag :predeploy
def self.up
add_column :polling_poll_choices, :position, :integer
end
def self.down
remove_column :polling_poll_choices, :position
end
end