From 9498bf3183329132d9dffa5c263ccd73a776cbcf Mon Sep 17 00:00:00 2001 From: Petzys <87223648+Petzys@users.noreply.github.com> Date: Fri, 15 Mar 2024 14:23:39 +0100 Subject: [PATCH] Feat(client): TTTK-84 Sort statistics received from server --- Client/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Client/client.py b/Client/client.py index 5594c71..216ebee 100644 --- a/Client/client.py +++ b/Client/client.py @@ -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"])