numbas / numbas-lti-provider

An LTI tool provider to run Numbas exams
https://docs.numbas.org.uk/lti/en/latest/
Other
11 stars 12 forks source link

LTI v3.0.1 - Statistics page and attempt report displays incorrect time taken #236

Open peterlcsteele opened 2 years ago

peterlcsteele commented 2 years ago

The issue is demonstrated in the following screenshots. This installation is using Sydney/Australia (GMT+10) timezone - perhaps this is causing the issue.

Statistics page: statistics-time-taken-10hr

Attempts: statistics-time-taken-attempts-download

christianp commented 2 years ago

Thanks for reporting this. Yes, it looks like something along the line isn't accounting for timezones. I'll try to investigate tomorrow.

christianp commented 1 year ago

"Tomorrow" is a mere 6 months later, but I've just had a look at this. I couldn't reproduce it, but I have found another exciting bug where the reported time spent was off by an hour. (see numbas/Numbas#17)

I've tried the following combinations of time zones:

The time was recorded correctly in every case. The only difference I can think of is that I'm using a local sqlite3 database, instead of postgresql. I can't easily set up a postgresql server in a different time zone.

Does this happen for every attempt, or just some? It looks like all of them, which suggests that there's just a timezone conversion failing to happen somewhere. I can't see where, though: the "time taken" is calculated on the client, and purely by subtracting Date objects created locally.

What have you put for TIME_ZONE in numbasltiprovider/settings.py? What happens if you set your PC's time to UTC+0 and start an attempt?