Courses without grades in the gradebook

Courses without grades in the gradebook

by Daniel Becerra -
Number of replies: 1

Hello there,

I was wondering if someone could help me with a Report; if it isn't possible I understand.

The idea is to have a list of Courses that don't have any grades in the Gradebook.

{The real information I need is Courses that don't have the Totals of a single or specific Columns [all Courses have the same exact Gradebook structure; so I believe the column (grade item or grade category) "Name" may work as a reference point]. However that might be too complex to do, I'm not sure.}

Regards.

Average of ratings: -
In reply to Daniel Becerra

Re: Courses without grades in the gradebook

by Randy Thornton -
Picture of Documentation writers
This is a case for a RIGHT JOIN:

SELECT gi.courseid, c.shortname
FROM prefix_grade_items gi
RIGHT JOIN prefix_course c ON c.id = gi.courseid

will show you all the courses and all the grade items, including courses that have none. Add this WHERE clause at the end to only show those without any grades at all. You can test this by creating a new course with nothing in it.

WHERE gi.courseid IS NULL

Hope this starts you out with what you need to do, which may be different depending on the grade category structures, whether they are missing entirely (ie are NULLs) or have entries with zeros or blank spaces; you can never tell how it was coded until you take a look at it. In the above for grade items we are checking for something that does not exist at all, as there is no row for it.


Average of ratings: Useful (2)