Grade History Question (database level)

Grade History Question (database level)

by Samuel Goldstein -
Number of replies: 0

I'm working on a project that involves integrating Moodle with an external system. The requirements involve exporting a user's scores for the quizzes that make up a course, as well as SCORM course results. In the external system, they want to be able to see that, for example, a given user took a specific quiz on one date and got 80%, and that same quiz on another date and got 90%.

To make things more complicated, users can phone an administrator who will sometimes be convinced to override their score on a quiz even if they failed in earlier. Also, in a few cases the score range changed in the past.

I'm looking directly at the database tables. My current query looks roughly like:

select mu.id as userid, gg.id as gradeid, gg.rawgrade, gg.finalgrade, gg.rawgrademin, gg.rawgrademax, gg.timemodified, gg.overridden, gi.id as itemid, gi.courseid from mdl_grade_items gi join mdl_grade_grades_history gg on gi.id=gg.itemid join mdl_user mu on gg.userid=mu.id where gi.gradetype=1 and gi.itemtype='mod' and gg.source!='system';

However, in my results, I see what look like incremental results on a given quiz. Within a few minutes, I see an item graded 0, then 62, then 100. It's all within a few minutes, which is why I'm assuming it's incremental results rather than the user re-taking the quiz, but I'm not 100% certain.

Is there any way to be certain what's happening? Is there a better approach for what I'm doing?

Thanks,

___Samuel___