From 1d948b5087f9c0c2ae1029fdd83f87d259b37f48 Mon Sep 17 00:00:00 2001 From: Jiri Kalvoda Date: Mon, 26 Sep 2022 16:32:43 +0200 Subject: [PATCH] =?UTF-8?q?Strategick=C3=A1:=20Print=20set=C5=99=C3=ADd?= =?UTF-8?q?=C4=9Bn=C3=A9=20v=C3=BDsledkov=C3=A9=20listiny?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/bin/control_game | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/server/bin/control_game b/server/bin/control_game index 20b8330..9ab09a3 100755 --- a/server/bin/control_game +++ b/server/bin/control_game @@ -18,6 +18,7 @@ parser.add_argument("--restore", action="store_true") parser.add_argument("--set-step-mode", type=str) parser.add_argument("--set-step-s", type=int) parser.add_argument("--autosteps", action="store_true", help="Bude periodicky posouvat hru podle konfigurace") +parser.add_argument("--ranking", action="store_true", help="Výsledky") args = parser.parse_args() @@ -64,6 +65,14 @@ if args.autosteps: sleep(step_in) else: game.lock() + if args.ranking: + round_id = game.current_state().round + teams = ses.query(db.Team).filter_by(game_id=game_id).order_by(db.Team.team_id).all() + moves = ses.query(db.Move).filter_by(game_id=game_id, round=round_id).order_by(db.Move.team_id).all() + a = list(zip(teams, moves)) + a.sort(key=lambda x: -x[1].points) + for i, x in enumerate(a): + print(f"{i+1:2} {x[1].points:6} {x[0].user.username}: {x[0].team_id}") if args.born_per_round: print(args.born_per_round) c = game.get_configuration()