fix non-integer rubric point values in course copy

test plan:
* create a rubric using non-decimal point values
 (e.g. '1.5')
* copy the course
* should retain the same values

fixes #CNVS-1625

Change-Id: I23031bdf10c8ea2932bdd7c770ece14fddc3a12e
Reviewed-on: https://gerrit.instructure.com/20150
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
This commit is contained in:
James Williams 2013-04-29 08:42:39 -06:00
parent 3975f03e04
commit 67660ed8f0
2 changed files with 14 additions and 4 deletions

View File

@ -41,8 +41,8 @@ module CC::Importer::Canvas
crit[:id] = get_node_val(c_node, 'criterion_id')
crit[:description] = get_node_val(c_node, 'description')
crit[:long_description] = get_val_if_child(c_node, 'long_description')
crit[:points] = get_int_val(c_node, 'points')
crit[:mastery_points] = get_int_val(c_node, 'mastery_points')
crit[:points] = get_float_val(c_node, 'points')
crit[:mastery_points] = get_float_val(c_node, 'mastery_points')
crit[:learning_outcome_migration_id] = get_node_val(c_node, 'learning_outcome_identifierref')
crit[:title] = get_node_val(c_node, 'description')
crit[:ratings] = []
@ -51,7 +51,7 @@ module CC::Importer::Canvas
rating[:description] = get_node_val(rat_node, 'description')
rating[:id] = get_node_val(rat_node, 'id')
rating[:criterion_id] = get_node_val(rat_node, 'criterion_id')
rating[:points] = get_int_val(rat_node, 'points')
rating[:points] = get_float_val(rat_node, 'points')
crit[:ratings] << rating
end

View File

@ -868,7 +868,7 @@ describe ContentMigration do
def create_rubric_asmnt
@rubric = @copy_from.rubrics.new
@rubric.title = "Rubric"
@rubric.data = [{:ratings=>[{:criterion_id=>"309_6312", :points=>5, :description=>"Full Marks", :id=>"blank", :long_description=>""}, {:criterion_id=>"309_6312", :points=>0, :description=>"No Marks", :id=>"blank_2", :long_description=>""}], :points=>5, :description=>"Description of criterion", :id=>"309_6312", :long_description=>""}]
@rubric.data = [{:ratings=>[{:criterion_id=>"309_6312", :points=>5.5, :description=>"Full Marks", :id=>"blank", :long_description=>""}, {:criterion_id=>"309_6312", :points=>0, :description=>"No Marks", :id=>"blank_2", :long_description=>""}], :points=>5.5, :description=>"Description of criterion", :id=>"309_6312", :long_description=>""}]
@rubric.save!
@assignment = @copy_from.assignments.create!(:title => "some assignment", :points_possible => 12)
@ -887,6 +887,16 @@ describe ContentMigration do
rub = @copy_to.rubrics.find_by_migration_id(mig_id(@rubric))
rub.should_not be_nil
[:description, :id, :points].each do |k|
rub.data.first[k].should == @rubric.data.first[k]
end
[:criterion_id, :description, :id, :points].each do |k|
rub.data.first[:ratings].each_with_index do |criterion, i|
criterion[k].should == @rubric.data.first[:ratings][i][k]
end
end
asmnt2 = @copy_to.assignments.find_by_migration_id(mig_id(@assignment))
asmnt2.rubric.id.should == rub.id
asmnt2.rubric_association.use_for_grading.should == true