Grades missing - restore from history?

Grades missing - restore from history?

by Mathias Tausen -
Number of replies: 6

Hi everyone.

When looking at the report (complete or outline) of a users activity in a course, the grades themselves do not show - as seen in the below screenshot, the grades are replaced with a "-":

When examining the specific assignment, though, its clear that the user did receive a grade (bestået=passed):

The error applies only to a few specific users - and examining the MySQL tables of the Moodle installation reveals that the "mdl_grade_grades_history"-table contains a series of entries for that user, rather than the "mdl_grade_grades"-table. 
This leads me to the conclusion that the user may have been unenrolled from the course at one time, and has then been re-enrolled, thus "archiving" that users grades.

Is there any way to restore those grades? Is there any way to make those archived grades appear in the gradebook?
While I do realize I could export the entries manually and convert & insert them into the mdl_grade_grades table, that just seems like a bad solution, and would be a lot of (hopefully unnecessary) work.

Any help would be much appreciated.
Thanks!
-Mathias. 

In reply to Mathias Tausen

Re: Grades missing - restore from history?

by Greg Rodenhiser -

Ever hear back on this?  Any help or answers you recieved would be huge.  Thanks!!

In reply to Greg Rodenhiser

Re: Grades missing - restore from history?

by Bob Puffer -

Didn't see your version listed but I read fast and may have skipped it.  If you're at 2.2 or greater the setting, "Recover grades default ($CFG->recovergradesdefault)" should take care of this for you.

In reply to Bob Puffer

Re: Grades missing - restore from history?

by Kimber Warden -

I deleted some students using the enrollment method Upload Users. Now, I can't restore their grades, whether I re-enroll them via Upload Users (putting a 0 in the delete column) or manually, using the "recover grades if possible" checkbox. Where is this setting you're referring to? Is there something else I should do to restore the grades?

In reply to Bob Puffer

Re: Grades missing - restore from history?

by Rok Lenardic -

Unfortunately, this seems to only be available starting version 2.3. Any similar solution in 2.2.1?

In reply to Bob Puffer

Re: Grades missing - restore from history?

by Mack Hucks -
Bob, Can you please explain your answer? I need to be able to recover grades for our flat file update. TIA
In reply to Mack Hucks

Re: Grades missing - restore from history?

by Bob Puffer -

My answer had to do with a setting in Site administration->Grades->General settings that enables grades to be restored by default if a unenrolled student is re-enrolled.  If you don't have that setting ticked (its off by default, like THAT makes a lotta sense), then you have to fashion a query statement that will update mdl_grade_grades from mdl_grade_grades_history, making sure you bring the latest iteration of a student/grade item pair over.