Fix grade api not working with gateway/quizzes.

Either I removed something critical or there was some database changes
that rendered my original code from LTI grades to fail. Will have to
check LTI grade import later.

The API was returning 0s for all grade related fields. Comparison of
code with ContentGenerator/Instructor/StudentProgress.pm showed some
changes so I've brought those changes over.

There are two types of grades, versioned and non-versioned. Versioned
grades are from gateway/quizzes assignments. Regular homeworks are
non-versioned. Versioned just means that students can attempt multiple
versions of that set (e.g.: attempting the same quiz multiple times
will result in questions with different numbers).

The grade hash structure:
PG File Path ->
  status - Has the user answered this question correctly?
  numIncorrect - Number of times the user answered incorrectly.
  numCorrect - Number of times the user answered correctly.
  attempted - 1 if the user has attempted this question 0 otherwise
Total ->
  version - this field exists if we're checking a versioned quiz where
  a user
  	can attempt a quiz multiple times.
  numAttempts - Total number of attempts for every problem.
  totalRight - Number of questions that the user has gotten completely
  right.
  status - How many questions the user got right. Usually, each
  question
  	counts for 1 point. If a question has multiple parts, then each
  	part
  	that the user got right would count as a fraction of the total 1
  	point.
  score - Score out of 100 that the user got for this assignment
  total - total number of points possible