Global report isn't shown in any other course

Global report isn't shown in any other course

by Yuka Chen -
Number of replies: 8

Hi,

I have just created a SQL report which is set as 'Global report' in a course, but I cannot see it from any other course, even if the Configurable Reports Blocks are already set to "Display global report". Has anyone ever encountered the same issue, or can anyone tell me what the problem probably is? 


Many thanks!

Average of ratings: -
In reply to Yuka Chen

Re: Global report isn't shown in any other course

by Yuka Chen -
To be more clearly, I can access this global report by appending ''&courseid=COURSE_ID" in the report URL, but I thought it would be possible to see global reports directly in the Configurable Reports Blocks in other courses, otherwise this function seems not so convenient to the teachers.
In reply to Yuka Chen

Re: Global report isn't shown in any other course

by Randy Thornton -
Picture of Documentation writers

Right, that's actually all the global setting does.

I won't speak for Juan but I don't think he had teachers in mind when he did that since you have to know the URL of the report (and have rights to run it) to use it.

I usually used the Permissions tab to set course level roles for reports...

Average of ratings: Useful (1)
In reply to Yuka Chen

Re: Global report isn't shown in any other course

by Benoît M -

I encountered the exact same problem. After a debug session, this behavior comes from the following line in  blocks/configurable_reports/block_configurable_reports.php' at line 113:

        // Site (Shared) reports.
        if (!empty($this->config->displayglobalreports)) {


What's happened?
When we had a new configurable report block, the `config` property used in the if statement above is NULL so the condition is not met and the global reports are not displayed

How to display global reports?
Simply, edit our block instance settings by clicking on "Configure Configurable Block". Then save the page with default settings (Display global reports is set to true by default).
When you go back to your block instance you will see the global reports!
By editing the block settings,  the `config` property is created and the option are saved, the condition in the if statement are met, so the code displays global reports.

I will try to fix it in the code and ask for a pull request.

Greetings,

ben

Average of ratings: Useful (1)
In reply to Benoît M

Re: Global report isn't shown in any other course

by Randy Thornton -
Picture of Documentation writers

Thank you, Benoît!

That is excellent troubleshooting and debugging.

I just used your workaround and now the global reports show up at the top of the block in the various courses. What an obscure bug!


- Randy

In reply to Randy Thornton

Re: Global report isn't shown in any other course

by Benoît M -

You are welcome. I hope the pull request will be merged soon.
I created an issue on github that describes the situation.

Greetings,

Ben

In reply to Benoît M

Re: Global report isn't shown in any other course

by Randy Thornton -
Picture of Documentation writers

To say thanks, here's a configurable report that shows you which configurable reports are global smile

Basic report is:

SELECT cr.name,
cr.type,
CASE
  WHEN c.id = 1 THEN 'Site'
  ELSE c.shortname
END AS Location
FROM prefix_block_configurable_reports cr
JOIN prefix_course c ON c.id = cr.courseid
# global 0 = no 1= yes
WHERE cr.global = 1
ORDER BY cr.name

But the attachment has a nice CONCAT with a link to the report itself (which the editor here will mess up if I paste the code)