From abfd516e199eb55dd7598cd65e37eca24e364f01 Mon Sep 17 00:00:00 2001 From: Rogier Neeleman Date: Thu, 29 Jun 2017 17:55:12 +0200 Subject: [PATCH] #5 max playing time added --- nfgame.py | 4 ++++ templates/timeout.html | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 templates/timeout.html diff --git a/nfgame.py b/nfgame.py index e1b3f85..6b66025 100644 --- a/nfgame.py +++ b/nfgame.py @@ -19,6 +19,7 @@ app.config.update(dict( 'taghash4': 'tagname4' }, START_KEY = 'None', + MAX_TIME = '3600', SECRET_KEY = 'Very secret key!', ADMIN_PASSWORD = 'changeme!' )) @@ -162,6 +163,9 @@ def tag_found(taghash): seconds = timediff.seconds - (minutes * 60) time = str(hours) + ":" + str(minutes) + ":" + str(seconds) + if int(timediff.seconds) > int(app.config['MAX_TIME']): + return render_template('timeout.html', color='#FF9999') + db = get_db() cur = db.execute('update score set tags = ?, lasttime = datetime(), duration = ? where id = ?', [cur_score, time, session['id']]) db.commit() diff --git a/templates/timeout.html b/templates/timeout.html new file mode 100644 index 0000000..d619fe1 --- /dev/null +++ b/templates/timeout.html @@ -0,0 +1,9 @@ +{% extends "layout.html" %} +{% block body %} +
+

Timeout!

+ Your time is up!
+ Please return to the registration desk. +
+{% endblock %} +