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>
This commit is contained in:
James Williams 2014-04-16 13:31:32 -06:00
parent 2d55b04c4d
commit bfbfdf41ee
5 changed files with 31 additions and 3 deletions

View File

@ -1760,7 +1760,7 @@ class Assignment < ActiveRecord::Base
[:turnitin_enabled, :peer_reviews_assigned, :peer_reviews,
:automatic_peer_reviews, :anonymous_peer_reviews,
:grade_group_students_individually, :allowed_extensions,
:position, :peer_review_count
:position, :peer_review_count, :muted
].each do |prop|
item.send("#{prop}=", hash[prop]) unless hash[prop].nil?
end

View File

@ -111,7 +111,7 @@ module CC
atts = [:points_possible, :grading_type,
:all_day, :submission_types, :position, :turnitin_enabled, :peer_review_count,
:peer_reviews_assigned, :peer_reviews, :automatic_peer_reviews,
:anonymous_peer_reviews, :grade_group_students_individually, :freeze_on_copy]
:anonymous_peer_reviews, :grade_group_students_individually, :freeze_on_copy, :muted]
atts.each do |att|
node.tag!(att, assignment.send(att)) if assignment.send(att) == false || !assignment.send(att).blank?
end

View File

@ -66,7 +66,7 @@ module CC::Importer::Canvas
["turnitin_enabled", "peer_reviews_assigned", "peer_reviews",
"automatic_peer_reviews", "anonymous_peer_reviews", "freeze_on_copy",
"grade_group_students_individually", "external_tool_new_tab",
"rubric_use_for_grading", "rubric_hide_score_total"].each do |bool_val|
"rubric_use_for_grading", "rubric_hide_score_total", "muted"].each do |bool_val|
val = get_bool_val(meta_doc, bool_val)
assignment[bool_val] = val unless val.nil?
end

View File

@ -105,6 +105,7 @@
<xs:element name="external_tool_url" type="xs:string" minOccurs="0"/>
<xs:element name="external_tool_new_tab" type="xs:boolean" minOccurs="0"/>
<xs:element name="freeze_on_copy" type="xs:boolean" minOccurs="0"/>
<xs:element name="muted" type="xs:boolean" minOccurs="0"/>
<xs:element name="saved_rubric_comments" minOccurs="0">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">

View File

@ -1087,6 +1087,33 @@ describe ContentMigration do
end
end
it "should copy assignment attributes" do
assignment_model(:course => @copy_from, :points_possible => 40, :submission_types => 'file_upload', :grading_type => 'points')
@assignment.turnitin_enabled = true
@assignment.peer_reviews_assigned = true
@assignment.peer_reviews = true
@assignment.peer_review_count = 2
@assignment.automatic_peer_reviews = true
@assignment.anonymous_peer_reviews = true
@assignment.allowed_extensions = ["doc", "xls"]
@assignment.position = 2
@assignment.muted = true
@assignment.save!
attrs = [:turnitin_enabled, :peer_reviews_assigned, :peer_reviews,
:automatic_peer_reviews, :anonymous_peer_reviews,
:grade_group_students_individually, :allowed_extensions,
:position, :peer_review_count, :muted]
run_course_copy
new_assignment = @copy_to.assignments.find_by_migration_id(mig_id(@assignment))
attrs.each do |attr|
@assignment[attr].should == new_assignment[attr]
end
end
it "should copy discussion topic attributes" do
topic = @copy_from.discussion_topics.create!(:title => "topic", :message => "<p>bloop</p>",
:pinned => true, :discussion_type => "threaded",