Browse Source

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

pull/14/head
Rogier Neeleman 7 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): @@ -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']])
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>')
def admin_page(password):

5
templates/tagfound.html

@ -4,7 +4,12 @@ @@ -4,7 +4,12 @@
<h1>Found tag!</h1>
You found tag: {{ tagname }}!<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 }}
{% endif %}
</center>
{% endblock %}

Loading…
Cancel
Save