See all grades of a complete moodle site and what needs to be done!!!

Re: See all grades of a complete moodle site and what needs to be done!!!

by Richard van Iwaarden -
Number of replies: 1
Picture of Particularly helpful Moodlers

To bad nobody is voting for it.

In reply to Richard van Iwaarden

Re: See all grades of a complete moodle site and what needs to be done!!!

by Constance Horne -

Well, SQL may not be what you want but that's what you may need to use. The following queries retrieve a list of all completed courses for all students, including their username, last and first names, department, course name, grade and date completed.

I have two ways of getting at the data. (1) Use MS Access and run a MS Access query, or (2) Use MySQL Workbench (or other SQL tool) and run the native query.

(1) MS Access Route - Download & install the ODBC driver to connect to your moodle database and use MS Access to obtain this information. This is the Access Query:

SELECT u.username , u.lastname, u.firstname, u.department, c.shortname AS CourseName, ROUND(gg.finalgrade,2) AS Grade, format(DATEADD("s",cc.timecompleted, '1970-01-01'),'dd-mmm-yyyy') AS CompletionDate FROM mdl_grade_items AS gi, mdl_course AS c, mdl_grade_grades AS gg, mdl_user AS u, mdl_course_completions AS cc
WHERE gi.itemtype = 'course' AND c.id = gi.courseid AND  gg.itemid = gi.id AND gg.userid = u.id and cc.userid = u.id and cc.course =  gi.courseid and cc.timecompleted is NOT NULL
ORDER BY u.lastname, u.firstname, c.shortname

(2) Download and install MySQL Workbench. This is the native SQL query:

SELECT  u.username , u.lastname,u.firstname, u.department, c.shortname CourseName,ROUND(gg.finalgrade,2) AS Grade, DATE_FORMAT(FROM_UNIXTIME(cc.timecompleted), "%d-%b-%Y") CompletionDateTime
 FROM mdl_grade_items AS gi, mdl_course AS c, mdl_grade_grades AS gg, mdl_user AS u, mdl_course_completions AS cc WHERE  gi.itemtype='course' And c.id=gi.courseid And gg.itemid=gi.id And gg.userid=u.id  And cc.userid=u.id And cc.course=gi.courseid And cc.timecompleted Is Not Null ORDER BY u.lastname, u.firstname, c.shortname