|
|
@ -268,6 +268,8 @@ def web_game(game_id): |
|
|
|
if right_for_step(game): |
|
|
|
with b.form(method="POST", _class="btn-group", action=app.url_for(web_game_step.__name__, game_id=game_id)): |
|
|
|
b.button(_class="btn btn-primary", type="submit", name="su", value="yes")("Krok") |
|
|
|
if g.org: |
|
|
|
b.a(_class="btn btn-default", href=app.url_for(web_org_game_round_inspect.__name__, game_id=game_id))("Inspekce kola") |
|
|
|
|
|
|
|
if g.org: |
|
|
|
b.h3("Aktuální konfigurace") |
|
|
@ -347,6 +349,46 @@ class GameUserchangeForm(FlaskForm): |
|
|
|
submit_no_change = wtforms.SubmitField("Bez změny", render_kw={"style": "display: none"}) |
|
|
|
|
|
|
|
|
|
|
|
@app.route("/org/game/<int:game_id>/round_inspect", methods=['GET']) |
|
|
|
@app.route("/org/game/<int:game_id>/round_inspect/<int:round_id>", methods=['GET']) |
|
|
|
def web_org_game_round_inspect(game_id, round_id=None): |
|
|
|
ses = db.get_session() |
|
|
|
game = ses.query(db.Game).filter_by(game_id=game_id).one_or_none() |
|
|
|
if round_id is None: |
|
|
|
round_id = game.current_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() |
|
|
|
assert len(teams) == len(moves) |
|
|
|
|
|
|
|
if game is None: |
|
|
|
raise werkzeug.exceptions.NotFound() |
|
|
|
if not right_for_game(game): |
|
|
|
raise werkzeug.exceptions.Forbidden() |
|
|
|
|
|
|
|
b = BasePage() |
|
|
|
b.h2(f"Inspekce kola {round_id} hry {game.print()}") |
|
|
|
with b.line().p("Aktuální kolo: "): |
|
|
|
if game.working_on_next_state: |
|
|
|
b.b()(game.current_round, "++") |
|
|
|
else: |
|
|
|
b(game.current_round) |
|
|
|
with b.p().table(_class="data full"): |
|
|
|
with b.thead(): |
|
|
|
b.line().th()("Id") |
|
|
|
b.line().th()("User") |
|
|
|
b.line().th()("Bodů") |
|
|
|
b.line().th()("Stažení") |
|
|
|
b.line().th()("Nahrání") |
|
|
|
for team, move in zip(teams, moves): |
|
|
|
with b.tr(): |
|
|
|
b.line().td()(team.team_id) |
|
|
|
b.line().td()(user_link(team.user),": ", team.name) |
|
|
|
b.line().td()(move.points) |
|
|
|
b.line().td()(move.reads_count) |
|
|
|
b.line().td()(f"{move.ok_pushs_count} {move.warnings_pushs_count} {move.err_pushs_count}") |
|
|
|
return b.print_file() |
|
|
|
|
|
|
|
|
|
|
|
@app.route("/org/game/<int:game_id>/team/<int:team_id>/change_user", methods=['GET', 'POST']) |
|
|
|
def web_org_game_userchange(game_id, team_id): |
|
|
|
ses = db.get_session() |
|
|
|