Strategická: Print setříděné výsledkové listiny
This commit is contained in:
parent
7f41e21135
commit
1d948b5087
1 changed files with 9 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue