RiotGames / developer-relations

Riot Games Developer Ecosystem Bug Reporting
http://developer.riotgames.com
747 stars 44 forks source link

[BUG] GET /lol/challenges/v1/challenges/config endpoint is returning incorrect `level` data. #764

Open KerrodY opened 1 year ago

KerrodY commented 1 year ago

Bug Description
This endpoint GET lol/challenges/v1/player-data/{puuid} is returning the wrong data for the level field.

Problem Description
From what I can tell this is a random issue, and when it happens, it seems to return the previous level. This can be verified by calling the GET /lol/challenges/v1/challenges/config endpoint to verify the level thresholds. See 'Actual Results' for API data.

Expected Result
I would expect my level for challenge 302202 to return GRANDMASTER instead of MASTER. As the player data value is larger then the master threshold value.

Actual Result

GET lol/challenges/v1/player-data/{puuid} { "challengeId": 302202, "percentile": 0, "position": 147, "playersInLevel": 6759, "level": "MASTER", "value": 230, "achievedTime": 1674544276167 }

GET /lol/challenges/v1/challenges/config { "id": 302202, "localizedNames": { "en_AU": { "description": "Destroy turrets before Turret Plates fall.", "name": "Shattered Plates", "shortDescription": "Destroy turrets before plates fall" } }, "state": "ENABLED", "leaderboard": true, "thresholds": { "GRANDMASTER": 225, "PLATINUM": 45, "DIAMOND": 90, "SILVER": 7, "MASTER": 150, "CHALLENGER": 450, "IRON": 1, "GOLD": 20, "BRONZE": 3 } }

NOTE: I removed some of the language data for readability.

Developer Impact
It causes inconsistent data in my application for the users.

Player Impact
Describe how this affects League of Legends players. Please include the frequency and severity of the issue.

Preconditions
N/A

Repro Steps
Step by step, what do you need to do to cause the bug? Note that GitHub will automagically number each step if you prefix the line with "1. "

  1. Pull data from the GET lol/challenges/v1/player-data/{puuid} API. Then get data from GET /lol/challenges/v1/challenges/config
  2. Match the level field from the player data to that of the challenge config data. And look for cases where the value from player-data is greater then the current level/threshold value in the config data.

Issue Comments

DarkIntaqt commented 1 year ago

The thresholds given in the /config endpoints are static. Grandmaster and Challenger however only allow a small % of all players to be in these ranks, that's why the thresholds are shifted to a higher value. This is usually shown in the client, however not supported in the API. Actually, I wouldn't consider this a bug but more a missing feature. Just here to clarify some things ^^

KerrodY commented 1 year ago

The thresholds given in the /config endpoints are static. Grandmaster and Challenger however only allow a small % of all players to be in these ranks, that's why the thresholds are shifted to a higher value. This is usually shown in the client, however not supported in the API. Actually, I wouldn't consider this a bug but more a missing feature. Just here to clarify some things ^^

Thanks for the reply. I understand what you are saying. But surely the static /config endpoint should be updated for the new threshold value of the GRANDMASTER/CHALLENGER ranks as they update. Otherwise how would we determine this, short of scraping the client for the data?

DarkIntaqt commented 1 year ago

Currently, you can determine the thresholds for e.g. Challenger pretty we well by taking the highest position of the rank below it, so Grandmaster. That is just a workaround, which I am using in production, however it is not 100% accurate. I agree with you that these dynamic thresholds should be added to the challenges API, as the current workaround requires 2 more requests per leaderboard-enabled challenge.