moar moar

This commit is contained in:
2024-09-18 21:37:50 -04:00
parent 3d554f5ad9
commit 6265342393
3 changed files with 30 additions and 8 deletions

View File

@@ -36,4 +36,5 @@ class CAHGame:
self.state_changed_at: int = state_changed_at
def __iter__(self):
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()
return [value for value in self.__dict__.values() if isinstance(value, int) or isinstance(value, float)].__iter__()

View File

@@ -20,7 +20,7 @@ class ConnectionManager:
async def send_client_and_game_lists(self, state, websocket: WebSocket):
clients = []
games = [game for game in state.games]
games = [game.__dict__ for game in state.games]
for ws, client in self.active_connections.items():
print(f"Client: {client}")
@@ -29,7 +29,7 @@ class ConnectionManager:
'resource': _client.resource,
'platform': _client.platform,
'connected_at': _client.connected_at,
'current_game': _client.current_game.id if _client.current_game else None,
'current_game': _client.current_game if _client.current_game else None,
})
await websocket.send_json({
@@ -44,7 +44,7 @@ class ConnectionManager:
"ts": int(time.time()),
"data":
{
"games": [str(game.id) for game in games],
"games": state.get_games()
}
})