Different 'Longest Streak' values when logged in vs. logged out. #7468
@pradeepce this issue is known and it is caused by the fact that your timezone is different with FreeCodeCamp server's timezone.
When you are logged in your timezone is know to the server and we are able to calculate and show your streak correctly.
When you are not logged in - your streak is being calculated in server's timezone (UTC-05:00) and being showed in your timezone (which I assume is UTC+05:30). Thus the difference in numbers.
For now there is no easy way of unifying streak calculation and representation across different timezones.
@LenaBarinova Is reading the user's computer's time a viable option? This should be possible with simple Javascript. And obviously, there'll be concern over people changing their computer's time when completing challenges; but I think asking for the user's timezone during signup will solve this problem (since you can always count days in that timezone thereafter).
If not, will it make more sense to always calculate time in UTC? StackOverflow seem to be doing this for their Fanatic badge, and it seems to be working out.
@pradeepce there are several things that prevent us from simply reading user's time. First - streak is being calculate on a server side. Though you could simply get user's timezone in JavaScrip on a client side - there is no simple way to pass it to server side at this point.
That's why, now user's timezone is being stored in a user profile and when user is connected - everything is being showed correctly.
There is more to this issue, I've spend some time analyzing and fixing it. If you are interested in how it's work now and why it was done this way - I could explain all the issues.
In addition you could look into previous commits on it - #5134, #6333, #5799, #6850
The Issue:
I see a different value for the Longest Streak in my profile page when I am logged in, and a different value when I am logged out.
How to reproduce:
Browser Information:
User-Agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
.Google Chrome Version 48.0.2564.116 (64-bit)
on Ubuntu 14.04 LTS, 64-bit Desktop.
Screenshots:
Images are on Google Drive. Links open in a new tab.
Additional info: