Ad - Hoc Reports Creating User Cumulative Time Spent in Site

Ad - Hoc Reports Creating User Cumulative Time Spent in Site

by Ahmad Nugroho -
Number of replies: 2

Hallo guys can somebody help me to find out how to create site report of user acces

i've found some example but it is spesific on a course here's the code :

SELECT 
l.id, 
l.timecreated, 
DATE_FORMAT(FROM_UNIXTIME(l.timecreated),'%d-%m-%Y') AS dTime,
@prevtime := (SELECT MAX(timecreated) FROM mdl_logstore_standard_log 
		WHERE userid = %%USERID%% AND id < l.id ORDER BY id ASC LIMIT 1) AS prev_time,
IF (l.timecreated - @prevtime < 7200, @delta := @delta + (l.timecreated-@prevtime),0) AS sumtime,
l.timecreated-@prevtime AS delta,
"User" AS TYPE
 
FROM prefix_logstore_standard_log AS l, 
(SELECT @delta := 0) AS s_init 
# CHANGE UserID
WHERE l.userid = %%USERID%% AND l.courseid = %%COURSEID%%
%%FILTER_STARTTIME:l.timecreated:>%% %%FILTER_ENDTIME:l.timecreated:<%%


Average of ratings: -
In reply to Ahmad Nugroho

Re: Ad - Hoc Reports Creating User Cumulative Time Spent in Site

by Luis de Vasconcelos -
Just remove the "l.courseid = %%COURSEID%% condition" and it should give you a sitewide report.

# CHANGE UserID
- WHERE l.userid = %%USERID%% AND l.courseid = %%COURSEID%%
+ WHERE l.userid = %%USERID%%

%%FILTER_STARTTIME:l.timecreated:>%% %%FILTER_ENDTIME:l.timecreated:
Average of ratings: Useful (1)
In reply to Luis de Vasconcelos

Re: Ad - Hoc Reports Creating User Cumulative Time Spent in Site

by Ahmad Nugroho -

Hello Luis , Thank you for your feedback,


i see so when i delete l.userid it wil show sitwide report ?