Gradebook

 
 
Picture of Bob Puffer
Re: Grade Exports
Group Particularly helpful Moodlers

SELECT u.username, g.finalgrade from mdl_grade_grades g

JOIN mdl_grade_items i on i.id = g.itemid

JOIN mdl_user u on u.id = g.userid

WHERE i.itemtype = 'course'

Picture of jj v
Re: Grade Exports
 

Uhm, Bob

 

I'm desperately looking for such a possibility but now I'm loosing you blush

Where can I put this code? Can you help a dummy?

 

Cheers

JaapJan

Picture of jj v
Re: Grade Exports
 

Uhm, Bob

 

I'm desperately looking for such a possibility but now I'm loosing you blush

Where can I put this code? Can you help a dummy?

 

Cheers

JaapJan

Picture of Emma Richardson
Re: Grade Exports
Group Particularly helpful Moodlers

You need to run the script on your database. You can use the plugin Adminer (or PHPMyAdmin) to access the database through the web interface. The plugin will need to be installed in the local folder on your server and then will show up in the Site Administration menu under Server.

Picture of Bob Puffer
Re: Grade Exports
Group Particularly helpful Moodlers

sorry, my digest was getting truncated by google and now they've fixed the problem

You need to run this code from phpmyadmin or you can run it inside a mysql shell.  If neither of these make sense then you shouldn't be doing it and should be seeking out someone on your staff who recognizes these tools.

Picture of Judy Hsu
Re: Grade Exports
 

Hi Bob, this is a very helpful SQL query. Thanks!

I did notice that it would NOT return the course "fullname" and course ID where students are enrolled in, would it be possible rewrite the query so that it would JOIN the table of mdl_course (or other related mdl_course_xxxx tables) so that it will also display course info? Thanks!!

Picture of Bob Puffer
Re: Grade Exports
Group Particularly helpful Moodlers

SELECT u.username, g.finalgrade, c.id, c.fullname from mdl_grade_grades g

JOIN mdl_grade_items i on i.id = g.itemid

JOIN mdl_course c on c.id = i.courseid

JOIN mdl_user u on u.id = g.userid

WHERE i.itemtype = 'course'

Picture of Gary Lynch
Re: Grade Exports
 

Bob

Great little piece of MYSQL database query smile

This is perfect for the report i need to run monthly for my organisation but i need the date completed too smile

whi i add g.timemodified to the select line i get return NULL

Picture of Gary Lynch
Re: Grade Exports
 

HI All

I tried to modify the query to this

SELECT a.grade, u.username, c.name, g.state, g.userid, g.timestart, g.timefinish, g.quiz, c.id from mdl_quiz_attempts g

JOIN mdl_user u on u.id = g.userid

JOIN mdl_quiz c on c.id = g.quiz

JOIN mdl_quiz_grades a on a.id = g.userid

two issues happen sad

The query returns 'no rows' but i have data in there (if i remove last 'join' command i get data)

also how do i intergrate from unix timestamp script into it to change dates to human readable ones?

Any help appretiated

thanks

Picture of Constance Horne
Re: Grade Exports
 

I also need to export all grades for all completed courses for all users along with the complion date.

Does anyone have a query that would do this?

Thanks!

Picture of Constance Horne
Re: Grade Exports
 

I finally figured out a query that appears to work on my Unix MySQL 2.4 database:

SELECT u.firstname , u.lastname , u.email
, cc.name CourseName,
ROUND(gg.finalgrade,2) Grade,
FROM_UNIXTIME(gi.timemodified) TimeModified
FROM mdl_course AS c
JOIN mdl_context AS ctx ON c.id = ctx.instanceid
JOIN mdl_role_assignments AS ra ON ra.contextid = ctx.id
JOIN mdl_user AS u ON u.id = ra.userid
JOIN mdl_grade_grades AS gg ON gg.userid = u.id
JOIN mdl_grade_items AS gi ON gi.id = gg.itemid
JOIN mdl_course_categories AS cc ON cc.id = c.category
WHERE gi.courseid = c.id AND gi.itemtype = 'course'

You would need to change your database prefix if it is not mdl_