Skip to content

Commit bfbfdf4

Browse files
committed
retain assignment muted status on course copy/import/export
test plan: * create a muted assignment * copy the course, or use import/export * the migrated assignment should also be muted refs #CNVS-12483 Change-Id: I124141ae088cb70a4d93f4270c5ad103c4b24a3a Reviewed-on: https://gerrit.instructure.com/33415 Reviewed-by: Bracken Mosbacker <bracken@instructure.com> Product-Review: Bracken Mosbacker <bracken@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> QA-Review: Nathan Rogowski <nathan@instructure.com>
1 parent 2d55b04 commit bfbfdf4

5 files changed

Lines changed: 31 additions & 3 deletions

File tree

app/models/assignment.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,7 @@ def self.import_from_migration(hash, context, item=nil, quiz=nil)
17601760
[:turnitin_enabled, :peer_reviews_assigned, :peer_reviews,
17611761
:automatic_peer_reviews, :anonymous_peer_reviews,
17621762
:grade_group_students_individually, :allowed_extensions,
1763-
:position, :peer_review_count
1763+
:position, :peer_review_count, :muted
17641764
].each do |prop|
17651765
item.send("#{prop}=", hash[prop]) unless hash[prop].nil?
17661766
end

lib/cc/assignment_resources.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def self.create_assignment(node, assignment)
111111
atts = [:points_possible, :grading_type,
112112
:all_day, :submission_types, :position, :turnitin_enabled, :peer_review_count,
113113
:peer_reviews_assigned, :peer_reviews, :automatic_peer_reviews,
114-
:anonymous_peer_reviews, :grade_group_students_individually, :freeze_on_copy]
114+
:anonymous_peer_reviews, :grade_group_students_individually, :freeze_on_copy, :muted]
115115
atts.each do |att|
116116
node.tag!(att, assignment.send(att)) if assignment.send(att) == false || !assignment.send(att).blank?
117117
end

lib/cc/importer/canvas/assignment_converter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def convert_assignment(meta_doc, html_doc=nil)
6666
["turnitin_enabled", "peer_reviews_assigned", "peer_reviews",
6767
"automatic_peer_reviews", "anonymous_peer_reviews", "freeze_on_copy",
6868
"grade_group_students_individually", "external_tool_new_tab",
69-
"rubric_use_for_grading", "rubric_hide_score_total"].each do |bool_val|
69+
"rubric_use_for_grading", "rubric_hide_score_total", "muted"].each do |bool_val|
7070
val = get_bool_val(meta_doc, bool_val)
7171
assignment[bool_val] = val unless val.nil?
7272
end

lib/cc/xsd/cccv1p0.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
<xs:element name="external_tool_url" type="xs:string" minOccurs="0"/>
106106
<xs:element name="external_tool_new_tab" type="xs:boolean" minOccurs="0"/>
107107
<xs:element name="freeze_on_copy" type="xs:boolean" minOccurs="0"/>
108+
<xs:element name="muted" type="xs:boolean" minOccurs="0"/>
108109
<xs:element name="saved_rubric_comments" minOccurs="0">
109110
<xs:complexType>
110111
<xs:sequence minOccurs="0" maxOccurs="unbounded">

spec/models/content_migration_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,33 @@ def create_outcome(context, group=nil)
10871087
end
10881088
end
10891089

1090+
it "should copy assignment attributes" do
1091+
assignment_model(:course => @copy_from, :points_possible => 40, :submission_types => 'file_upload', :grading_type => 'points')
1092+
@assignment.turnitin_enabled = true
1093+
@assignment.peer_reviews_assigned = true
1094+
@assignment.peer_reviews = true
1095+
@assignment.peer_review_count = 2
1096+
@assignment.automatic_peer_reviews = true
1097+
@assignment.anonymous_peer_reviews = true
1098+
@assignment.allowed_extensions = ["doc", "xls"]
1099+
@assignment.position = 2
1100+
@assignment.muted = true
1101+
1102+
@assignment.save!
1103+
1104+
attrs = [:turnitin_enabled, :peer_reviews_assigned, :peer_reviews,
1105+
:automatic_peer_reviews, :anonymous_peer_reviews,
1106+
:grade_group_students_individually, :allowed_extensions,
1107+
:position, :peer_review_count, :muted]
1108+
1109+
run_course_copy
1110+
1111+
new_assignment = @copy_to.assignments.find_by_migration_id(mig_id(@assignment))
1112+
attrs.each do |attr|
1113+
@assignment[attr].should == new_assignment[attr]
1114+
end
1115+
end
1116+
10901117
it "should copy discussion topic attributes" do
10911118
topic = @copy_from.discussion_topics.create!(:title => "topic", :message => "<p>bloop</p>",
10921119
:pinned => true, :discussion_type => "threaded",

0 commit comments

Comments
 (0)