Databases: course_completion.timestarted is reset after cron.php

Databases: course_completion.timestarted is reset after cron.php

by CT Soo -
Number of replies: 1

We are extracting course tracking/progress info for further analysis outside of Moodle. One piece of data we need is when students started on their courses - as in when they first access the resource, not just enrol as they may enrol but not access the course until much later.

We are using Moodle 2.1.1 (20110928) and running SQL queries (read-only) to extract the various fields we need. We noticed that in the table mdl_course_completion, the timestarted field is reset to 0 every now and then when admin/cron.php is run. Then if cron.php is run again after sometime (if the student has accessed the course since the last cron run), the timestarted may be set to the last access time - the actual (original) time started is lost.  

Is this the right table/field to extract the info from? If yes, then how should we deal with this reset? We've checked the database schema and http://docs.moodle.org/dev/Course_completion but it shows course_completion.timeenrolled instead of course_completion.timestarted (as seen in MySQL database). Any help or pointers?

Average of ratings: -
In reply to CT Soo

Re: Databases: course_completion.timestarted is reset after cron.php

by Rob Woof -

Hi CT Soo,

One option might be to work from the log table - it logs all user actions. The volume of data is large, but if you can identify what particular type of entry is generated by the actions you want to track, finding the ones you're interested in shouldn't be too taxing.

Try sifting through the 'action' field in the log table - see where that gets you.

I hope this helps.

Rob