Re: New plugin: Custom reports

Re: New plugin: Custom reports

by Nico Potgieter -
Number of replies: 0

I managed to resolve this. I created a new filter called users. This must be uploaded in to the configurable_reports\components\filters\users folder.

It also does a sort on the usernames before giving the list to the user.

Any improvements on this will appreciated.

The SQL statement is

SELECT u.username As EmpNo, u.firstname AS 'Name' , u.lastname AS 'Surname',cc.name AS 'Category', c.fullname AS 'Course',
gi.itemname AS 'Item Name', ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max, ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) as '%',
 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
WHERE  gi.courseid = c.id and gi.itemname != 'Attendance' and u.username != '' %%FILTER_USERS:u.id%%
ORDER BY `Name` ASC