Browse Source

#5 max playing time added

pull/14/head
Rogier Neeleman 8 years ago
parent
commit
abfd516e19
  1. 4
      nfgame.py
  2. 9
      templates/timeout.html

4
nfgame.py

@ -19,6 +19,7 @@ app.config.update(dict( @@ -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): @@ -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()

9
templates/timeout.html

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
{% extends "layout.html" %}
{% block body %}
<center>
<h1>Timeout!</h1>
Your time is up!<br>
Please return to the registration desk.
</center>
{% endblock %}
Loading…
Cancel
Save