class AssignmentStat

Public Instance Methods

grade_distribution_array() click to toggle source

Returns an array containing the grade distribution as percentage Used by Bluff to draw the graphs

# File app/models/assignment_stat.rb, line 14
def grade_distribution_array
  if self.grade_distribution_percentage
    self.grade_distribution_percentage.parse_csv.map{ |x| x.to_i }.to_json
  else
    # Default, empty distribution
    '[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]'
  end
end
refresh_grade_distribution() click to toggle source

Update the cached grade distribution

# File app/models/assignment_stat.rb, line 7
def refresh_grade_distribution
  self.grade_distribution_percentage = self.assignment.grade_distribution_as_percentage.to_csv
  self.save
end