volentixlabsinc / venue-client

The webapp for Venue, a community engagement platform for the Volentix community
https://venue.volentix.io
MIT License
6 stars 1 forks source link

Wrong user highlighted in leaderboard #257

Closed shawnlauzon closed 6 years ago

shawnlauzon commented 6 years ago

Describe the bug The user who is logged in is not being highlighted; a different user is

To Reproduce Steps to reproduce the behavior:

  1. Sign in
  2. Click on Leaderboard
  3. See that a different user than me is highlighted

Expected behavior My user should be highlighted

Screenshots Hawkeye is highlighted image

But I am antman image

Additional context N/A

shawnlauzon commented 6 years ago

It's weird; the data in Nuxt seems to be inconsistent:

The user data is correct: image

But the userStats is wrong (antman is rank 8) image

Lyncis commented 6 years ago

seems like it highlights all users with the same number of tokens wrong (highlights the last one of them in the list)

shawnlauzon commented 6 years ago

Apparently this only happens in a local installation; will have to address it later.

shawnlauzon commented 6 years ago

This definitely is still a problem, and it seems to have to do with logging in and logging out. Will investigate now.

shawnlauzon commented 6 years ago

The problem is the call to retrieve/stats is returning the wrong rank when there are multiple users with the same number of posts.

This can be reproduced by finding a leaderboard that has two users with the same number of points (e.g. thor and wolverine) and signing in with the user who is ranked higher (e.g. thor in dev at the moment). You will see after signing in as thor that the UI highlights the wrong user:

image

This is because the current rank in the stats call is 3:

"user_level": {
...
      "total_posts": 1,
      "total_points": 105,
      "total_points_pct": 7,
      "total_tokens": 8817,
      "overall_rank": 3
}

But then on the same server, /retrieve/leaderboard-data will swt

{"username":"wolverine","total_posts":1,"total_points":105.0,"total_tokens":8817,"rank":2},{"username":"thor","total_posts":1,"total_points":105.0,"total_tokens":8817,"rank":3},

And then if I refresh the UI:

image

So I still cant tell exactly what is going on, but there is inconsistency in the ranking of the users coming back from the server. Assigning to @alexdashkov to investigate.

alexdashkov commented 6 years ago

What is the priority? I'd like to start it when I'll finish with the stats endpoint, does it make sense?

shawnlauzon commented 6 years ago

PM'd.

alexdashkov commented 6 years ago

This issue should be fixed with the stats PR

shawnlauzon commented 6 years ago

Looks good to me!