odota / core

Open source Dota 2 data platform
https://www.opendota.com
MIT License
1.51k stars 303 forks source link

Add a couple decimal points to KDA Query for players in matches. #2668

Closed yungbuck81 closed 1 year ago

yungbuck81 commented 1 year ago

Would it be possible to add 2-3 decimal points to the KDA query for players in matches? Currently it rounds it down to the nearest integer and can skew decently far when pulling multiple games of data and averaging a players kda for a set of matches. In one instance, we had two players whose avg kda shouldve been separated by 3 after each playing two matches, yet because of the rounding down to whole integers for each game, they were the same.

howardchung commented 1 year ago

Do you have a sample API call where this is happening?

yungbuck81 commented 1 year ago

Match ID 7329517346. The KDA value on tide is rounded down from 2.55555556 to 2. In our league of 12-20 teams playing two games per week we've seen some kda discrepancies for a while now when we avg the two games.

yungbuck81 commented 1 year ago

Similarly in Match ID 7329550501, player 9 has their KDA rounded down from what would be 3.5 to 3. https://api.opendota.com/api/matches/7329550501

builder-247 commented 1 year ago

Yeah looks like it's indeed rounded down, wonder what the plan was here https://github.com/odota/core/blob/7f122c9447a93f3bb053cdf602bfa5026cd85c20/util/compute.js#L74

Anyways you could also just calculate the kda from the kills, assists and deaths yourselves

howardchung commented 1 year ago

Looks like I wrote that code like 8 years ago haha so it's probably my fault. We probably could just replace it with Math.round and add a few decimals

yungbuck81 commented 1 year ago

That would be awesome if you would be willing to do that!

yungbuck81 commented 1 year ago

Thanks so much for doing this!