Gradebook

 
 
Picture of Carl Badenhorst
Grade Exports
 

Is there a way to export all a students grades at once, for all courses they are enrolled in, instead of going into each course and exporting one course at a time.

The same for students when viewing their grades. A page with an overview of all their courses. 

Thanks

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

By 'ALL' students do you mean all the students that have ever received a grade in your moodle instance?

Picture of Simon Parr
Re: Grade Exports
 

BUMP! because I would find the answer to this question handy. I'd like to know if there is a way to export EVERY students grades in my entire Moodle instance across all courses.

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

I think you would have to write an mysql script to do that but it would be doable with Adminer or PHPMyAdmin.

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

I think you would have to write an mysql script to do that but it would be doable with Adminer or PHPMyAdmin.

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_

Picture of Michael E
Re: Grade Exports
Group Testers

I want to accomplish the same, but I also want to include all final course grades from already unenrolled users. How can I accomplish that?

I do not want to enroll the users again though.

Picture of Robert Russo
Re: Grade Exports
Group Particularly helpful Moodlers

Try this one if you want all students, even those who have since dropped the course.

 

SELECT c.shortname AS shortname, CONCAT(mu.firstname, ' ', mu.lastname) AS fullname, gg.finalgrade AS finalgrade
FROM mdl_grade_items AS gi
INNER JOIN mdl_course c ON c.id = gi.courseid
LEFT JOIN mdl_grade_grades AS gg ON gg.itemid = gi.id
INNER JOIN mdl_user AS mu ON gg.userid = mu.id
WHERE gi.itemtype = 'course'
ORDER BY c.id asc

Picture of Robert Russo
Re: Grade Exports
Group Particularly helpful Moodlers

The overview report handles the second question you asked.

We also have a plugin, a block called grades at a glance which students can add to their /my page and it gives them their final grade across all enrolled courses.

It's available here: https://github.com/lsuits/grades_at_a_glance for Moodle 2.3.x. We'll soon have a 2.4 branch.