Configuring custom graph reports

Configuring custom graph reports

by Prashanth Martin -
Number of replies: 5

Hi all,

I am a user of the Configurable Reports plugin and I recently used a custom SQL query report to display the users' courses and their scores. However I find that I am unable to generate any graphs. Is this a limitation for SQL-based custom query reports?

Attachment graph.png
Average of ratings: -
In reply to Prashanth Martin

Re: Configuring custom graph reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

It should work, the sql query works fine? Can you copy and paste here the sql query?

In reply to Juan Leyva

Re: Configuring custom graph reports

by Prashanth Martin -

This is the SQL report code which I am using:

SELECT cc.name AS 'Category', c.fullname AS 'Course', u.firstname AS 'Name', u.lastname AS 'Surname',
ROUND(gg.finalgrade,2) AS Score,ROUND(gg.rawgrademax,2) AS Max,
IF (ROUND(gg.finalgrade / gg.rawgrademax * 100 ,2) > 59,'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_COURSES:c.id%%
%%FILTER_CATEGORIES:c.category%%
WHERE gi.courseid = c.id AND gi.itemname != 'Attendance'
ORDER BY 'Name' ASC

 

I also get these warning messages appearing:

Warning: array_shift() expects parameter 1 to be array, object given in /home/moodlelm/public_html/moodletest/blocks/configurable_reports/components/plot/pie/form.php on line 45

Warning: Invalid argument supplied for foreach() in /home/moodlelm/public_html/moodletest/blocks/configurable_reports/components/plot/pie/form.php on line 47

In reply to Prashanth Martin

Re: Configuring custom graph reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Please, download the last version of the plugin: https://github.com/jleyva/moodle-block_configurablereports/zipball/MOODLE_21_STABLE where this is fixed

In reply to Juan Leyva

Re: Configuring custom graph reports

by Prashanth Martin -

Hi Juan, It works now but I still can't generate line graphs though. Pie graphs are working now.

This is the debugging error I get when I try to generate the line graphs.

Warning: array_shift() expects parameter 1 to be array, object given in /home/moodlelm/public_html/moodletest/blocks/configurable_reports/components/plot/line/form.php on line 45

Warning: Invalid argument supplied for foreach() in /home/moodlelm/public_html/moodletest/blocks/configurable_reports/components/plot/line/form.php on line 47

Invalid get_string() identifier: 'linegraph' or component 'block_configurable_reports'
  • line 5914 of /lib/moodlelib.php: call to debugging()
  • line 6504 of /lib/moodlelib.php: call to core_string_manager->get_string()
  • line 57 of /blocks/configurable_reports/components/plot/line/form.php: call to get_string()
  • line 154 of /lib/formslib.php: call to line_form->definition()
  • line 144 of /blocks/configurable_reports/editplugin.php: call to moodleform->moodleform()
In reply to Prashanth Martin

Re: Configuring custom graph reports

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Download again the plugin following the link of my previous post, I fixed it also a few days ago

Very thanks for reporting the bug