Total Hours spent by users in moodle courses

Total Hours spent by users in moodle courses

by Hemamalini K R -
Number of replies: 4
We are using moodle 2.9.2 version. We have a requirement of calculating the total hours spent by users in different moodle courses. Used the course dedication plugin. This gives the first name, last name,  total hours spent . I would like to understand in which moodle table this information is getting stored as i would want to join this with mdl_user table to get some additional details about the user. 

I don't see any course dedication tables in moodle. 


Appreciate your help in this regard. Thanks in advance.



Average of ratings: -
In reply to Hemamalini K R

Re: Total Hours spent by users in moodle courses

by Nitesh Kumar -

Hi Hema,

They are using mdl_log table to get the students total time in a course. Open the dedication_lib.php file and check the get_user_dedication() function.


Thanks

In reply to Nitesh Kumar

Re: Total Hours spent by users in moodle courses

by Hemamalini K R -

Thanks a lot for your response Nitesh. 

Saw dedication_lib.php file --> get_user_dedication() function

Just wanted to understand, is there any possibility to show additional details about the user in the report. 

Say for Eg: Username from mdl_user table



In reply to Hemamalini K R

Re: Total Hours spent by users in moodle courses

by Nitesh Kumar -

Try to print the $students variable before foreach loop in  get_students_dedication function and check if username is in array or not.


If username is not there then use $user->id to fetch the username from DB and pass it in array like below.


 $rows[] = (object) array(

                'username' => $username_variable //additional

                'user' => $user,

                'groupid' => $group,

                'dedicationtime' => $dedication,

                'connectionratio' => round($daysconnected / $perioddays, 2),

            );

Thanks