Is it possible to show grades across a category?

Is it possible to show grades across a category?

by Richard Clay -
Number of replies: 4

Hi,

Thanks for this block it looks very useful.

A question I have is whether using this block it's possible to configure a report to show students and grades across a whole category. I've been investigating this but can't see an obvious way to do it.

Any help would be greatly appreciated.

Thanks

Richard

 

 

Average of ratings: -
In reply to Richard Clay

Re: Is it possible to show grades across a category?

by Richard Clay -

To answer myself, yes it seems it is possible. I added a custom SQL report that included a category filter and all seemed to work ok. If anyone else needs to do this the SQL is as below: 

 

SELECT u.firstname AS 'Name' , u.lastname AS 'Surname', c.fullname AS 'Course', cc.name AS 'Category',
CASE WHEN gi.itemtype = 'Course'
THEN c.fullname + ' Course Total'
ELSE gi.itemname
END AS 'Item Name', ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS MAX, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) AS Percentage,

IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 79,'Yes' , 'No') AS Pass

FROM prefix_course AS c
JOIN prefix_context AS ctx ON c.id = ctx.instanceid
JOIN prefix_role_assignments AS ra ON ra.contextid = ctx.id
JOIN prefix_user AS u ON u.id = ra.userid
JOIN prefix_grade_grades AS gg ON gg.userid = u.id
JOIN prefix_grade_items AS gi ON gi.id = gg.itemid
JOIN prefix_course_categories AS cc ON cc.id = c.category
%%FILTER_CATEGORIES:c.category%%
WHERE gi.courseid = c.id AND gi.itemname != 'Attendance'
ORDER BY `Name` ASC

 

In reply to Richard Clay

Re: Is it possible to show grades across a category?

by Randy Thornton -
Picture of Documentation writers

Nicely done.

You should consider sharing this over in the ad-hoc contributed queries area, too.

In reply to Richard Clay

Re: Is it possible to show grades across a category?

by Troy May -

That script does not work on my Moodle.

I understand if you look at the notes on an ad hoc edit page, you can see:

  • You can put parameters into the SQL using named placeholders, for example :parameter_name. Then, when the report is run, the user can enter values for the parameters to use when running the query.
  • If the :parameter_name starts or ends with the characters date then a date-time selector will be used to input that value, otherwise a plain text-box will be used.
  • You cannot use the characters : or ? in strings in your query. If you need them, you can use CHR(58) and CHR(63) respectively, along with string concatenation. (It is CHR for Postgres or Oracle, CHAR for MySQL or SQL server.)

However, I have no idea how this is usable, nor how your script works on your LMS.


In reply to Richard Clay

Re: Is it possible to show grades across a category?

by Steve Daly -

This looks like it could help me - Thanks!

In my case, I only want to show certain quiz score from courses. Anyone have an idea if it possible to limit the grades shown?

More details: I have 10 courses with 100 quizzes  (90 review quizzes and 10 progress check quizzes)  in each but I only want to show the scores for 10 special quizzes (progress check) from each course. 

If this plug-in lets me cheery pick the quizzes then I would save a lot of time generating reports.