ka-lite icon indicating copy to clipboard operation
ka-lite copied to clipboard

Does not appear to be recording logged in time correctly

Open sethachoi opened this issue 9 years ago • 10 comments

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:

  1. Create a new student or log in with an existing student.
  2. Spend some time doing whatever.
  3. Log in as admin and view either the manage tab or the /admin interface.
  4. Observe the lack of time added to time logged in.

sethachoi avatar Aug 27 '15 22:08 sethachoi

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.

benjaoming avatar Apr 22 '17 20:04 benjaoming

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:

  1. Registered a new user
  2. Watched a 55 second video. (Note: 2 browsers. I'm using firefox for the user I created and Google Chrome for the Admin.)
  3. Navigated to another tab
  4. Refreshed the admin page.
  5. Checked the student.total_hours, it was set to 0.
  6. Logged out the student.
  7. Refreshed the admin page.
  8. 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 avatar Jun 09 '17 08:06 mrpau-eugene

@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 avatar Jun 09 '17 09:06 benjaoming

@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.. 🤔

mrpau-eugene avatar Jun 09 '17 10:06 mrpau-eugene

Watching videos is counted in VideoLog.total_seconds_watched, but this isn't added to the statistic in the control panel.

benjaoming avatar Jun 09 '17 10:06 benjaoming

But all I did was watch a 55 second video. I'm now wondering how it became 0.03 hours 😕

mrpau-eugene avatar Jun 09 '17 13:06 mrpau-eugene

@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: screen shot 2017-06-12 at 3 06 17 pm

And, if you meant that VideoLog.total_seconds_watched don't get added to the login time?

mrpau-eugene avatar Jun 12 '17 08:06 mrpau-eugene

@mrpau-eugene yes, that's the page with the problem! :)

benjaoming avatar Jun 12 '17 12:06 benjaoming

@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

screen shot 2017-06-13 at 11 03 18 am

mrpau-eugene avatar Jun 13 '17 03:06 mrpau-eugene

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.

benjaoming avatar Jul 05 '17 07:07 benjaoming