Skip to content

Different 'Longest Streak' values when logged in vs. logged out. #7468

Open
pradeepce opened this Issue · 3 comments

3 participants

@pradeepce

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:

  1. Log in to FCC and visit your profile page.
  2. Note your 'Longest Streak'.
  3. Log out of FCC.
  4. Visit your profile page and note your 'Longest Streak'.

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:

  • I asked in chat (FreeCodeCamp/FreeCodeCamp), and no one else seems to have (or have noticed) this issue right now.
  • My streak, on some days, is made up of points awarded for solving waypoints; on some days, it's made up of points received via camperbot on Gitter (when I was thanked); on other days, it's made up of a combination of both.
@LenaBarinova

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

@pradeepce

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

@LenaBarinova

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.