edx/edx-platform — pull request #2613 by ichuang (2014-02-14 22:04:47+00:00)
Title: fix raw grade dump in standard instructor dashboard

The standard instructor dashboard has had a longstanding bug in the procedure for generating raw grades. The problem is that the index for the grades was generated by the records for the first student in the db. As a result, if the first student had not tried all of the problems in the course, then two things would be wrong: (1) the header of the CSV file, and (2) rows for students who had done more problems would be longer than the first row, thus creating skew, and mis-alining data within columns. This has caused the wrong grades to be produced, by instructors using raw grades data.

The culprit is this line in the `get_student_grade_summary_data` function:

https://github.com/edx/edx-platform/blob/master/lms/djangoapps/instructor/views/legacy.py#L1171

The fix is to do two passes through the grades, generating an in-memory collection of the grades data, from which the list of assignments and the grades are then assembled.

This feature is valuable to instructors who wish to download raw grades, either for double-checking the edX platform's arcane grading configuration, or for computing grades based on their own algorithms. It is widely employed in courses at MIT employing the edX platform.

This PR is being provided for other organizations running the edX platform for residential use. It is hoped that a future revision of the entire grading code will properly address such problems. The core code in this PR was used for four months last Fall, in production at MIT.

Perhaps some kind soul will write some tests for this.