Add rating and games-played fields for every account perf#1
Merged
Merged
Conversation
Extend LichessStatistics to cover ultraBullet, correspondence_games, and all eight variant perfs (chess960, crazyhouse, antichess, atomic, horde, kingOfTheHill, racingKings, threeCheck) returned by /api/account. Perfs the user has never played are reported as None. Add unit tests for both the populated and sparse perf cases, and document the new fields in the README. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closed
21 tasks
aryanhasgithub
approved these changes
May 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LichessStatisticstoday exposes only six rating fields and five games fields, even though/api/accountreturns a richerperfsobject covering nine more time controls / variants and an additionalcorrespondence_gamescount. This PR fills in the gap so consumers can read every perf the API publishes.Changes
LichessStatisticsgainsratingandgamesfields for:ultra_bulletcorrespondence_games(rating already existed; games was missing)chess960,crazyhouse,antichess,atomic,horde,king_of_the_hill,racing_kings,three_checkpuzzle_games(already existed; kept for clarity)AioLichess.get_statistics()populates all new fields from the same/api/accountresponse — no extra HTTP calls.None(not0), preserving the existing distinction between "no record" and "zero games".Backwards compatibility
All existing fields keep their names, types, and semantics. The change is purely additive, so this is a non-breaking minor bump (1.2.0 → 1.3.0).
Tests
Added
tests/test_client.pycovering:/api/accountresponse: every new field is read correctly, and storm/racer/streak entries (which lackrating/games) are ignored.bulletset: every other perf comes back asNone.Motivation
Used by the Home Assistant Lichess integration, which currently can only surface 4 of the ~15 perfs Lichess users care about. A companion PR against home-assistant/core consumes the new fields.