-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathleaderboard.html
49 lines (47 loc) · 1.84 KB
/
leaderboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{% extends "base.html" %}
{% block title %}Leaderboard{% endblock %}
{% block content %}
<h2>Leaderboard</h2>
<!--Different information will be displayed here based on whether there's data in the score file and where the user is in their game-->
{% if scores %}
{% if session %}
{% if session['question_number'] == 11 %}
<p>Well done for finishing the game, {{session['user']|title}}! Let's find out where you rank!</p>
<p><a href="{{ url_for('reset') }}" class="btn btn-lg btn-warning">Play Again</a></p>
{% elif session['question_number'] <= 10 %} <p>Hello, {{session['user']|title}}, come to check out the competition?
Let's see, you currently have {{session['score']*10}} points...</p>
<p><a href="{{url_for('show_riddle')}}" class="btn btn-lg btn-warning">Continue playing!</a></p>
{% endif %}
{% endif %}
<table>
<tr>
<th>Rank</th>
<th>Name</th>
<th>Score</th>
</tr>
{% for user in scores|sort(attribute='user')|sort(attribute='score', reverse=True) %}
{% if loop.index <= 5 %}
<tr>
<td>{{loop.index}}</td>
<td>{{user.user|title}}</td>
<td>{{user.score * 10}}</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% else %}
<h3>NO SCORES YET</h3>
<p>Do you want to be the first to make it onto the scoreboard?</p>
{% if session %}
{% if session['question_number'] == 1 %}
<p><a href="{{ url_for('show_riddle') }}" class="btn btn-lg btn-warning">Play Now</a></p>
{% elif session['question_number'] == 11 %}
<p><a href="{{ url_for('reset') }}" class="btn btn-lg btn-warning">Play Again</a></p>
{% else %}
<p><a href="{{ url_for('show_riddle') }}" class="btn btn-lg btn-warning">Continue Playing</a></p>
{% endif %}
{% else %}
<p><a href="{{ url_for('register')}}">Register</a> or <a href="{{ url_for('sign_in') }}">Sign In</a> to play!</p>
{% endif %}
{% endif %}
{% endblock %}