add hide_points column to rubric association and course copy
closes OUT-1844 dev-qa - run new migration - ensure RubricAssociation model has hide_points column that defaults to false - create a course with two assignments and attach a rubric to each assignment - using rails console, manually set one of the RubricAssociations in that course to have hide_points as true - copy the course using course copy on settings page - view the new rubric associations in the rails console, they should accurately reflect the hide_points attribute of the original two Change-Id: I42cbf003499e054202322a5d56ae0d46c92a56b0 Reviewed-on: https://gerrit.instructure.com/146162 Reviewed-by: Rob Orton <rob@instructure.com> Reviewed-by: Michael Brewer-Davis <mbd@instructure.com> Reviewed-by: Augusto Callejas <acallejas@instructure.com> QA-Review: Augusto Callejas <acallejas@instructure.com> Product-Review: Sidharth Oberoi <soberoi@instructure.com> Tested-by: Jenkins
This commit is contained in:
parent
0abca3170b
commit
c8d466fbae
|
@ -208,8 +208,9 @@ module Importers
|
|||
rubric ||= context.available_rubric(hash[:rubric_id]) if hash[:rubric_id]
|
||||
if rubric
|
||||
assoc = rubric.associate_with(item, context, :purpose => 'grading', :skip_updating_points_possible => true)
|
||||
assoc.use_for_grading = !!hash[:rubric_use_for_grading] if hash.has_key?(:rubric_use_for_grading)
|
||||
assoc.hide_score_total = !!hash[:rubric_hide_score_total] if hash.has_key?(:rubric_hide_score_total)
|
||||
assoc.use_for_grading = !!hash[:rubric_use_for_grading] if hash.key?(:rubric_use_for_grading)
|
||||
assoc.hide_score_total = !!hash[:rubric_hide_score_total] if hash.key?(:rubric_hide_score_total)
|
||||
assoc.hide_points = !!hash[:rubric_hide_points] if hash.key?(:rubric_hide_points)
|
||||
if hash[:saved_rubric_comments]
|
||||
assoc.summary_data ||= {}
|
||||
assoc.summary_data[:saved_comments] ||= {}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# 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 AddHidePointsToRubricAssociations < ActiveRecord::Migration[5.1]
|
||||
tag :predeploy
|
||||
|
||||
def change
|
||||
add_column :rubric_associations, :hide_points, :boolean
|
||||
change_column_default(:rubric_associations, :hide_points, false)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# 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 BackfillHidePointsSetting < ActiveRecord::Migration[5.1]
|
||||
tag :postdeploy
|
||||
|
||||
def up
|
||||
DataFixup::BackfillNulls.send_later_if_production_enqueue_args(
|
||||
:run,
|
||||
{priority: Delayed::LOW_PRIORITY, n_strand: 'long_datafixups'},
|
||||
RubricAssociation,
|
||||
{
|
||||
hide_points: false
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
|
@ -211,6 +211,7 @@ module CC
|
|||
node.rubric_external_identifier assignment.rubric.id
|
||||
end
|
||||
node.rubric_use_for_grading assoc.use_for_grading
|
||||
node.rubric_hide_points !!assoc.hide_points
|
||||
node.rubric_hide_score_total !!assoc.hide_score_total
|
||||
if assoc.summary_data && assoc.summary_data[:saved_comments]
|
||||
node.saved_rubric_comments do |sc_node|
|
||||
|
|
|
@ -118,7 +118,7 @@ module CC::Importer::Standard
|
|||
["turnitin_enabled", "vericite_enabled", "peer_reviews",
|
||||
"automatic_peer_reviews", "anonymous_peer_reviews", "freeze_on_copy",
|
||||
"grade_group_students_individually", "external_tool_new_tab", "moderated_grading",
|
||||
"rubric_use_for_grading", "rubric_hide_score_total", "muted", "has_group_category",
|
||||
"rubric_hide_points", "rubric_use_for_grading", "rubric_hide_score_total", "muted", "has_group_category",
|
||||
"omit_from_final_grade", "intra_group_peer_reviews", "only_visible_to_overrides", "post_to_sis"].each do |bool_val|
|
||||
val = get_bool_val(meta_doc, bool_val)
|
||||
assignment[bool_val] = val unless val.nil?
|
||||
|
|
|
@ -149,6 +149,7 @@
|
|||
<xs:element name="rubric_external_identifier" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="rubric_use_for_grading" type="xs:boolean" minOccurs="0"/>
|
||||
<xs:element name="rubric_hide_score_total" type="xs:boolean" minOccurs="0"/>
|
||||
<xs:element name="rubric_hide_points" type="xs:boolean" minOccurs="0"/>
|
||||
<xs:element name="quiz_identifierref" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="allowed_extensions" type="xs:string" minOccurs="0"/>
|
||||
<xs:element name="points_possible" type="optional_float" minOccurs="0"/>
|
||||
|
|
|
@ -66,6 +66,22 @@ describe "Importing assignments" do
|
|||
expect(a.points_possible).to eq rubric.points_possible
|
||||
end
|
||||
|
||||
it "should import association settings when rubric is included" do
|
||||
file_data = get_import_data('', 'assignment')
|
||||
context = get_import_context('')
|
||||
migration = context.content_migrations.create!
|
||||
|
||||
assignment_hash = file_data.find{|h| h['migration_id'] == '4469882339231'}.with_indifferent_access
|
||||
rubric_model({context: context, migration_id: assignment_hash[:grading][:rubric_id]})
|
||||
assignment_hash[:rubric_use_for_grading] = true
|
||||
assignment_hash[:rubric_hide_points] = true
|
||||
|
||||
Importers::AssignmentImporter.import_from_migration(assignment_hash, context, migration)
|
||||
ra = Assignment.where(migration_id: assignment_hash[:migration_id]).first.rubric_association
|
||||
expect(ra.use_for_grading).to be true
|
||||
expect(ra.hide_points).to be true
|
||||
end
|
||||
|
||||
it "should import group category into existing group with same name when marked as a group assignment" do
|
||||
file_data = get_import_data('', 'assignment')
|
||||
context = get_import_context('')
|
||||
|
|
Loading…
Reference in New Issue