Configurable reports error programming

Re: Configurable reports error programming

by Giancarlo Trezzi -
Number of replies: 6

I tried the solution mentioned above and It works very well for me. BUT I had to modify a little bit the code, this is the correct code:

        $mods = get_fast_modinfo($this->_customdata['report']->courseid)->get_cms();

        $modnames = get_module_types_names();

        $modnamesplural = get_module_types_names(true);

        $modnamesused = get_fast_modinfo($this->_customdata['report']->courseid)->get_used_module_names();


In reply to Giancarlo Trezzi

Re: Configurable reports error programming

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

Hi,

I'll try to apply the fix and release a new version next week.

Juan

In reply to Juan Leyva

Re: Configurable reports error programming

by Jamie Tinley -

Thanks Juan, 

I have it working with the fix I created - was that the right way to fix configurable reports?

My date filter is not doing anything to the data I can change to any date and it  - can you look at my custom sql I created and tell me why the dates are not limiting my output?

  • SELECT U2.firstname, U2.lastname, L2.courseid, C.shortname, L2.action, 
  • FROM_UNIXTIME( C.timecreated, '%m-%d-%Y %r' )
  • FROM `prefix_logstore_standard_log` AS L, prefix_user as U, prefix_course as C 
  • LEFT JOIN prefix_logstore_standard_log AS L2 ON C.id = L2.courseid
  • LEFT JOIN prefix_user as U2 on L2.userid = U2.id
  • WHERE L2.courseid = 21
  • AND L2.action LIKE '%Launched%'
  • AND L2.timecreated > UNIX_TIMESTAMP('2016-08-25') AND L2.timecreated < UNIX_TIMESTAMP('2016-09-26')

result have all same date of 7-20-2016 no matter what I change my search date to like above which should be past 8/25 to 9/26


New at SQL and this is my best after many hours trialing solutions. Thanks.

In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -

ok, solved part of date issue as I pulled it from prefix_course instead of the logstore

I also see I need to join all 3 tables and I'm closer here but still not quite right as I get more users than were there.

  1. SELECT U.firstname, U.lastname, L.courseid, C.shortname, L.action, 
  2. FROM_UNIXTIME( L.timecreated, '%m-%d-%Y %r' )
  3. FROM prefix_logstore_standard_log as L LEFT JOIN prefix_course as C ON L.courseid = C.id LEFT JOIN prefix_user as U on L.userid = U.id
  4. WHERE L.courseid = 21
  5. AND L.action LIKE '%Launched%'
  6. AND L.timecreated > UNIX_TIMESTAMP('2016-09-19') AND L.timecreated < UNIX_TIMESTAMP('2016-09-26')
  7. group by DATE(FROM_UNIXTIME(U.timecreated))
In reply to Jamie Tinley

Re: Configurable reports error programming

by Jamie Tinley -
solved my personal query too! Hopefully this helps anyone else trying to make a report for an event like Blackboard Collaborate, Ultra, or BigBlueButton (in which case change LIKE '%Launched%' to LIKE '%Joined%'

Group by limits your data - grouping by date selected one user from each date, grouping by user selected one date for each user but using a comma lets me group specifically by the day for each user then order by is meant for sorting. I hope this helps someone smile

SELECT U.firstname, U.lastname, L.userid, L.courseid, L.action,

FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ) as DATE, 

FROM_UNIXTIME( L.timecreated, '%r' ) as TIME

FROM prefix_logstore_standard_log as L

LEFT JOIN prefix_course as C ON L.courseid = C.id left JOIN prefix_user as U on L.userid = U.id

WHERE L.action LIKE '%Launched%'

AND L.courseid = %%COURSEID%%

%%FILTER_STARTTIME:L.timecreated:>%% %%FILTER_ENDTIME:L.timecreated:<%%

group by L.userid, FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' )

order by FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ), U.firstname


In reply to Juan Leyva

Re: Configurable reports error programming

by Jose Rivas -

Thanks Juan.

I think we'll  all be very grateful if you fix and release a new versión. 

Congrats for your great plugin.

Regards

In reply to Juan Leyva

Re: Configurable reports error programming

by Jamie Tinley -

HI Juan,

do you know if configurable reports can handle things like Declare SET Define as it throws errors for me when I try to use them.  Any way around that?

I need to use it because I have one table that has the needed information but for some reason registers the course as course 0 when they click it in another course (blackboard collaborate for attendance) yet in the column other in prefix_logstore_standard_log I see the course number easily but I can't seem to query it out various ways as the %%course%% for some reason does not work using my sql below: (the ## I tried various ways without success when the course in my example is 108 so    using AND L.other LIKE '%108%'  works great but I'm trying to replace 108 with a variable or query instead to pull it out)

Thanks, Jamie

## DECLARE @CID

##SELECT @CID = D.id from prefix_course as D WHERE D.id = %%COURSEID%%

SELECT   U.firstname as First, U.lastname as Last,L.userid, L.courseid,L.component,

FROM_UNIXTIME( L.timecreated, '%m-%d-%Y' ) as DATE,  

FROM_UNIXTIME( L.timecreated, '%r' ) as TIME


FROM prefix_logstore_standard_log as L 

LEFT JOIN prefix_course as C ON L.courseid = C.id left 

JOIN prefix_user as U on L.userid = U.id



WHERE L.other  like '%loadmeeting%'

AND L.component like '%mod_elluminate%'

## AND L.other LIKE @CID

## AND D.id = %%COURSEID%%

## WHERE L.courseid = %%COURSEID%%

##AND L.other LIKE '%108%'

## AND L.other LIKE Select %%COURSEID%%

## AND L.courseid = %%COURSEID%%

%%FILTER_STARTTIME:L.timecreated:>%%

%%FILTER_ENDTIME:L.timecreated:<%%