Navigation Menu

Skip to content

Commit

Permalink
fix grade calculations if an assignment group has 0 points possible
Browse files Browse the repository at this point in the history
This was causing all students in the course to have final grades of null
(NaN).

Change-Id: I2bc268926579ce8c129a8c997f683a9e9097bffc
Reviewed-on: https://gerrit.instructure.com/3016
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
  • Loading branch information
codekitchen committed Apr 11, 2011
1 parent d4431fe commit 56cdc28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/grade_calculator.rb
Expand Up @@ -140,7 +140,8 @@ def create_group_sums(submissions, ignore_ungraded=true)

# Calculate the tally for this group
sums[:group_weight] = group.group_weight || 0
sums[:tally] = sums[:user_points].to_f / sums[:total_points].to_f rescue 0
sums[:tally] = sums[:user_points].to_f / sums[:total_points].to_f
sums[:tally] = 0.0 unless sums[:tally].finite?
sums[:weighted_tally] = sums[:tally] * sums[:group_weight].to_f
group_sums[group.id] = sums
end
Expand Down Expand Up @@ -177,4 +178,4 @@ def calculate_total_from_group_scores(group_sums, ignore_ungraded=true)
end
score
end
end
end

0 comments on commit 56cdc28

Please sign in to comment.