+ data = _map_info_data(request)
+
+ # convert the top scorers to a dict
+ def top_scorers_dict(tp):
+ return {
+ "player_id": tp[0],
+ "nick": tp[3],
+ "score": tp[2],
+ }
+
+ top_scorers = [top_scorers_dict(ts) for ts in data["top_scorers"]]
+
+ # convert the top players to a dict
+ def top_players_dict(tp):
+ return {
+ "player_id": tp[0],
+ "nick": tp[3],
+ "alivetime": tp[2].total_seconds(),
+ }
+
+ top_players = [top_players_dict(tp) for tp in data["top_players"]]
+
+ def top_servers_dict(ts):
+ return {
+ "server_id": ts[0],
+ "server_name": ts[1],
+ "games": ts[2],
+ }
+
+ top_servers = [top_servers_dict(ts) for ts in data["top_servers"]]
+
+ return {
+ 'map': data["gmap"].to_dict(),
+ 'recent_games': [rg.to_dict() for rg in data["recent_games"]],
+ 'top_scorers': top_scorers,
+ 'top_players': top_players,
+ 'top_servers':top_servers,
+ # 'captimes':captimes,
+ }