Bug in player stats endpoint

Sort:
skelos

Hi,

Looking quickly at some player statistics for an ad-hoc report, and came across disagreement between the documentation and what data I received.

 

https://www.chess.com/news/view/published-data-api#pubapi-endpoint-player-stats

says

"The response contains many "stats objects," each identified by the ratings-type from the game, composed of the rules code, an underscore, and the time-class code. If a person has not played a particular game type, no stats object will be present for it." (My emphasis.)

 

https://api.chess.com/pub/player/zoki/stats

{"chess_daily":{"last":{"rating":800,"rd":350},"record":{"win":0,"loss":0,"draw":0,"time_per_move":0,"timeout_percent":0}}
...

https://api.chess.com/pub/player/kadibyek/stats
{"chess_daily":{"last":{"rating":800,"rd":350},"record":{"win":0,"loss":0,"draw":0,"time_per_move":0,"timeout_percent":0}}

Same for daily_960 for that player:
"chess960_daily":{"last":{"rating":800,"rd":350},"record":{"win":0,"loss":0,"draw":0,"time_per_move":0,"timeout_percent":0}}

I've not checked others, but happened across more names I expect to be the same:

@feraonback@slahiry@18jpde@min134@chdboy@theeyeofhorus, and others.

 

The workaround is to treat absence of the "chess_daily" record as 0W-0L-0D but if there is a record to be prepred for 0W-0L-0D. That's good eough for me, today, and I'm glad I'm in the habit of coding for "impossible" conditions!

 

Best,

Giles

andreamorandini

@skelos : now "record "stats won't be shown if the player didn't play any game

Tricky_Dicky

Has this returned? I have instances of stats records for player with no games.

example @sadwasteofbrains. Hasn't played daily, 960 or Rapid according to games archive.

This is data retrieved

{"chess_daily":{"last":{"rating":1800,"rd":350}},
"chess960_daily":{"last":{"rating":1800,"rd":350}},
"chess_rapid":{"last":{"rating":1800,"rd":350}},
"chess_bullet":{"last":{"rating":2134,"date":1475710421,"rd":109},
"best":{"rating":2173,"date":1475697938,"game":"https://www.chess.com/live/game/1756457060"},"record":{"win":9,"loss":4,"draw":0}},
"chess_blitz":{"last":{"rating":2093,"date":1518873908,"rd":25},
"best":{"rating":2222,"date":1479219549,"game":"https://www.chess.com/live/game/2211474327"},"record":{"win":2346,"loss":1923,"draw":217}}}

I have other examples

Tricky_Dicky

Coincidence? 1800 is the lessons rating for this player.

skelos

Haven't seen this again, but I haven't instrumented my code to report it or removed code to treat 0W/0L/0D as if the record was not preset.

Just FYI, as I reported the original bug. It should be easy to find if it's still present.

Indeed, via a browser the first example I reported looks "live" again:

https://api.chess.com/pub/player/zoki/stats

{"chess_daily":{"last":{"rating":800,"rd":350}},"chess960_daily":{"last":{"rating":800,"rd":350}},"chess_blitz":{"last":{"rating":1808,"date":1516729987,"rd":64},"best":{"rating":1960,"date":1492410528,"game":"https://www.chess.com/live/game/2045706317"},"record":{"win":2425,"loss":2221,"draw":221}}}

 

skelos

It's a little different: the record is still returned, but while it has a "last" component with "rating" it looks in each case to be the default rating for this player and there is no "record" value for W/L/D.

Tricky_Dicky

Like yourself, Giles I have now put in an additional test so correct result obtained.

andreamorandini

The problem should be fixed now: if the player hasn't played any game the corresponding section isn't displayed.

Tricky_Dicky

Stats endpoint for this member, @Kinikachi, is returning a rating value of 1400 for daily games. However, web page, https://www.chess.com/member/kinikachi , is showing unrated. All games played have timed out without changing the starting/default daily rating.