Permalink
Browse files

corrected calculation for Excused assignment

  • Loading branch information...
1 parent d3f00be commit 1cfa1c0dca1a305ffab510a9be362a59d4e2028d @rnhurt committed Sep 20, 2009
Showing with 11 additions and 8 deletions.
  1. +3 −3 app/models/assignment_evaluation.rb
  2. +6 −3 app/models/course_term.rb
  3. +2 −2 app/views/evaluations/_compute_grades.js
@@ -17,8 +17,8 @@ class AssignmentEvaluation < ActiveRecord::Base
# Calculate the points earned based on the presence of 'magic' characters
def points_earned
case self[:points_earned]
- when 'E' # Excused assignment (student gets full credit)
- points = self.assignment.possible_points
+ when 'E' # Excused assignment (grade is ignored)
+ points = nil
when 'M' # Missing assignment (student gets no credit)
points = 0.0
else
@@ -33,7 +33,7 @@ def points_earned
# There are certain 'magic' characters that can be substituted for a number
# grade. This method makes sure that the user only enters valid ones.
#
- # * 'E' = Excused assignment (student gets full credit)
+ # * 'E' = Excused assignment (assignment is not counted)
# * 'M' = Missing assignment (student gets no credit)
def valid_string?
['E', 'M'].include?(self.points_earned) ||
@@ -23,9 +23,12 @@ def calculate_grade(student_id)
# Loop through the assignments for computing the grade as we go
self.assignment_evaluations.all(:conditions => { :student_id => student_id}).each do |evaluation|
- points_earned += evaluation.points_earned.to_f
- possible_points += evaluation.assignment.possible_points.to_f
- logger.debug " **** points earned: #{evaluation.points_earned} out of #{evaluation.assignment.possible_points}"
+ valid_points = evaluation.points_earned
+ if valid_points
+ points_earned += valid_points.to_f
+ possible_points += evaluation.assignment.possible_points.to_f
+ end
+ logger.debug " **** points earned: #{valid_points} out of #{evaluation.assignment.possible_points}"
end
logger.debug " **** final! #{points_earned} out of #{possible_points}"
@@ -41,9 +41,9 @@ function calcGrades(row) {
grade.addClassName('grade-warning');
score = 0;
break;
- case 'E': // This is an excused grade and it is given maximum points
+ case 'E': // This is an excused grade and it is ignored
grade.addClassName('grade-warning');
- score = avail_points;
+ score = null;
break;
case '': // This is a blank grade
grade.addClassName('grade-empty');

0 comments on commit 1cfa1c0

Please sign in to comment.