Reports
When building reports we should aim for them to work consistently with other reports, for example if we have similar criteria for selecting users then the different reports should probably return the same set of users.
Paper attempts
When working with reports dealing with paper attempts you will need to keep in mind some things
Start time
When building a report based on user attempts of papers the start time on some papers should include a grace period.
The grace period is calculated using something like $time_int = \log::getStartInterval($papertype)
it returns a value in minutes that should be used in the queries where statement similar to:
DATE_ADD(l4o.started, INTERVAL $time_int MINUTE) >= ?
We “add” the time so that we can bring the start time to within the allowed period. I.e. add the allowed interval (for that kind of paper, which currently is only summative and progressive papers) to the student’s start time to see if it now falls within the official exam times, if they started earlier.
Selecting students
When selecting students you should use the $rolesjoin = \log::get_student_only()
it has optional parameters that let you change which table it joins with (by default it will join with users) and then use it like:
FROM users $rolesjoin WHERE