ka-lite
ka-lite copied to clipboard
Does not appear to be recording logged in time correctly
KA-Lite does not appear to be recording the time a student spends logged in correctly, or at all. Tested on latest develop as well as an older (by a few months possibly) fork of develop I had.
Steps to Reproduce:
- Create a new student or log in with an existing student.
- Spend some time doing whatever.
- Log in as admin and view either the manage tab or the /admin interface.
- Observe the lack of time added to time logged in.
Seems like a somewhat broken statistic. It just tries to summarize total_seconds
from UserLogSummary
, which seems to just be updated during exercise attempts. Watching videos is counted in VideoLog.total_seconds_watched
, but this isn't added to the statistic in the control panel.
I was checking out this issue. I've found out that logged in time for a user only gets update if he/she logouts.
What I did:
- Registered a new user
- Watched a 55 second video. (Note: 2 browsers. I'm using firefox for the user I created and Google Chrome for the Admin.)
- Navigated to another tab
- Refreshed the admin page.
- Checked the
student.total_hours
, it was set to 0. - Logged out the student.
- Refreshed the admin page.
- Checked the
student.total_hours
, it has now 0.031666667 (I hope I the steps were clear 🤞 )
So, I think we can safely close this issue. The reason why it is still set to 0 was because of student.total_hours|floatformat
. I think it is rounding it off to the nearest hundredths value?
E.g.
0.03 -> 0.0
0.07 -> 0.1
What are your thoughts about this @benjaoming ?
@mrpau-eugene
Good ting to know, but I don't think it closes the issue.
Statistic about logged in time are broken / unreliable because they don't account for watching videos and because of what you just described :)
@benjaoming What do you mean it by doesn't account for watching videos?
- do you mean time spent watching doesn't get recorded?
Edit:
Oh, I see. How is total_hours
being computed by the way? 55 seconds isn't equivalent to 0.0316666666667 hours.. 🤔
Watching videos is counted in VideoLog.total_seconds_watched, but this isn't added to the statistic in the control panel.
But all I did was watch a 55 second video. I'm now wondering how it became 0.03 hours 😕
@benjaoming I would just like to clear out some stuffs:
I just wanted to know if this is the statistics in the control panel
you were referring to:
And, if you meant that VideoLog.total_seconds_watched
don't get added to the login time?
@mrpau-eugene yes, that's the page with the problem! :)
@benjaoming So, you mentioned that the statistics is broken because VideoLog.total_seconds_watched
don't get added to Login Time
? What is the supposedly expected behavior by the way? Should it be that when a user is watching a 1-minute video, and has been logged in for 1 minute, and decides to logout, the login time should be 2-minutes in total?
Because, the way KA Lite handles this one is that VideoLog.total_seconds_watched
doesn't get added to UserLogSummary but it just computes how long a user stayed logged in. So, if I logged in for 1 minute, and was doing nothing.. and then I decided to watch a 5-minute video, my total logged in time would be around 6 minutes.
Btw, maybe there was a reason to why you only wanted to display 1 decimal
in hours but I would like to suggest to make the hour(s) be a 2-decimal value instead of just one so, if you logged in for just 1-minute, it would display 0.01
instead of 0.0
so it will make the Coach/Admin think that the statistics are fine, like the one here
Btw, maybe there was a reason to why you only wanted to display 1 decimal in hours but I would like to suggest to make the hour(s) be a 2-decimal value instead of just one so, if you logged in for just 1-minute, it would display 0.01 instead of 0.0 so it will make the Coach/Admin think that the statistics are fine, like the one here
Good point! If you can do a PR for this small change, we can close the issue.
Regarding calculating login time, it's true that we can't just add video durations to login times, and that login times are wrong when the last session is missing an end time. The only solution to up the accuracy would be if we can add relevant VideoLog
data when a login session's end timestamp is missing. This is provided that we can identify VideoLog
rows after the unclosed login session's starting timestamp. So let's leave it out, it probably won't do any harm with this inaccuracy, and adding more accuracy will never accomplish more than an approximation.