Skip to content

Commit

Permalink
Feat(client): TTTK-84 Sort statistics received from server
Browse files Browse the repository at this point in the history
  • Loading branch information
Petzys committed Mar 15, 2024
1 parent 7830581 commit 9498bf3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ async def _preprocess_message(self, message:str) -> str:
self._playfield = message_json["updated_playfield"]
self._current_player = self.get_player_by_uuid(message_json["next_player_uuid"])
case "statistics/statistics":
for entry in message_json["server_statistics"]:
sorted_statistics = sorted(message_json["server_statistics"], key=lambda x: x["player"]["display_name"])
for entry in sorted_statistics:
self._statistics[Player(**entry["player"])] = entry["statistics"]
case "game/error":
self._error_history.append(message_json["error_message"])
Expand Down

0 comments on commit 9498bf3

Please sign in to comment.