From 21de05106943b4435652f7e747f7639aba2fb214 Mon Sep 17 00:00:00 2001 From: Rogier Neeleman Date: Fri, 7 Jul 2017 20:21:24 +0200 Subject: [PATCH] View will be switching between scoreboard and highscores --- nfgame.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nfgame.py b/nfgame.py index 2afa116..823da9e 100644 --- a/nfgame.py +++ b/nfgame.py @@ -63,6 +63,19 @@ def close_db(error): @app.route('/') def index(): + '''Check if user is returning''' + if not 'board' in session: + session['board'] = 'scoreboard' + + if session['board'] == 'scoreboard': + session['board'] = 'highscores' + return scoreboard() + elif session['board'] == 'highscores': + session['board'] = 'scoreboard' + return highscores() + +@app.route('/scoreboard') +def scoreboard(): """Calculate starttime""" now = datetime.now() - timedelta(seconds=int(app.config['MAX_TIME'])) - timedelta(seconds=int(app.config['SHOW_TIME'])) maxstarttime = datetime.strptime((str(now.year)+"-"+str(now.month)+"-"+str(now.day)+" "+str(now.hour)+":"+str(now.minute)+":"+str(now.second)), "%Y-%m-%d %H:%M:%S")