There's a lot of duplication in this method. Could be shortened to:

```ruby
scores = current_course.grades.group(:student_id).order('SUM(score)')
scores = scores.limit(10) if params.has_key?(:top_ten)
scores = scores.pluck('student_id, SUM(score)')
```