andy3471 / keyshare

A web app for sharing Steam keys with your friends
MIT License
4 stars 2 forks source link

On first login, sometimes Karma displays as 1 on first page #4

Closed andy3471 closed 5 years ago

andy3471 commented 5 years ago

Unkown cause, requires investigation.

andy3471 commented 5 years ago

Can consistently recreate with new steam user.Go into redis-cli on vagrant, "zscore karma (user id)", karma is listed as 0 correctly.

Go to another page, shows 0 correctly. Unknown cause currently

andy3471 commented 5 years ago

Fixed in DLC branch.

The logic was as follows:

  1. Get Karma
  2. If null, run a query to get karma, and add to redis with: $karma = Redis::zadd('karma', $user->karma, $user->id);

This responds with a 1 if it's a success, and not the score, fixed by following this line with: $karma = Redis::zscore('karma', $id);