This commit is contained in:
2024-05-24 10:09:50 +02:00
parent cfe3d3f329
commit c390a3eb9a
8 changed files with 68 additions and 23 deletions

View File

@ -32,7 +32,17 @@ def font_game():
game = read_file(f"current_games/{game_id}")
if int(game['i']) == int(game['game_length']):
end_game = (
(
int(game['game_length']) != 0 and
int(game['i']) == int(game['game_length'])
) or
(
int(game['game_length']) == 0 and
int(game['i']) > int(game['points'])
)
)
if end_game:
os.remove(f"current_games/{game_id}")
return flask.render_template("final.html", points=game['points'],
game_length=game['game_length'])
@ -45,7 +55,8 @@ def font_game():
"url": url,
"i": str(int(game['i']) + 1),
"round_n": game['i'],
"game_length": game['game_length'],
"game_length": int(game['game_length']),
"hard_mode": game['hard_mode'] == 'True',
"points":game['points'],
"fonts":FONTS,
"id":args['id']
@ -63,7 +74,9 @@ def start():
else:
game_length = 10
game_id = start_game(game_length)
hard_mode = 'hard_mode' in flask.request.form
game_id = start_game(game_length, hard_mode)
return flask.redirect(f"/fontgame?id={game_id}")
@app.route("/all")