Browse Source

#11 user get an end-messages on his last tag.

pull/14/head
Rogier Neeleman 8 years ago
parent
commit
e919574d47
  1. 17
      nfgame.py
  2. 5
      templates/tagfound.html

17
nfgame.py

@ -249,7 +249,22 @@ def tag_found(taghash):
cur = db.execute('update score set tags = ?, lasttime = datetime(), duration = ? where id = ?', [cur_score, time, session['id']]) cur = db.execute('update score set tags = ?, lasttime = datetime(), duration = ? where id = ?', [cur_score, time, session['id']])
db.commit() db.commit()
return render_template('tagfound.html', tagname=tags.get(taghash), color='#00FF00', time=timeremaining) '''Check if this was the user his last item'''
tagquery = ""
for tag in app.config['TAGS']:
if tagquery == "":
tagquery = 'where tags like "%' + tag + '%"'
else:
tagquery = tagquery + ' and tags like "%' + tag + '%"'
db = get_db()
cur = db.execute('select * from score ' + tagquery + ' and id = ?', [session['id']])
entries = cur.fetchall()
if entries:
return render_template('tagfound.html', tagname=tags.get(taghash), color='#00FF00', time=timeremaining, endgame='yes')
else:
return render_template('tagfound.html', tagname=tags.get(taghash), color='#00FF00', time=timeremaining, endgame='no')
@app.route('/admin/<string:password>') @app.route('/admin/<string:password>')
def admin_page(password): def admin_page(password):

5
templates/tagfound.html

@ -4,7 +4,12 @@
<h1>Found tag!</h1> <h1>Found tag!</h1>
You found tag: {{ tagname }}!<br> You found tag: {{ tagname }}!<br>
<span uk-icon="icon: happy; ratio: 2"></span><br> <span uk-icon="icon: happy; ratio: 2"></span><br>
{% if endgame == 'yes' %}
Good job! You got all the tags!<br>
Return to the the registration desk.
{% else %}
Time left to play: {{ time }} Time left to play: {{ time }}
{% endif %}
</center> </center>
{% endblock %} {% endblock %}

Loading…
Cancel
Save