I'm currently working on a configurable report and I may need to get the date of the users' first access to a Course.
I can easily get it via logstore_standard_log with the following query:
SELECT FROM_UNIXTIME(timecreated) AS firstCourseAccess
FROM mdl_logstore_standard_log
WHERE eventname = "\core\event\course_viewed"
AND action = "viewed"
AND target = "course"
AND userid = 3
ORDER BY timecreated
LIMIT 1
However, there is the possibility of purging this logs.
Is there another way to get this record without adding a new field/table on the database?
Any help/idea is very much appreciated. Cheers!