Avoid n+1 queries in marks_graders view

This mainly improves the performance of the index page of assigning graders to spreadsheet students. There are also some minor refactoring.

Tested:
- rspec
- rake test:units
- rakte test:functionals
- local server