Correction de bugs

This commit is contained in:
guimoz 2017-01-30 09:16:36 +01:00
parent 00728114da
commit 8bd93b22d5
3 changed files with 25 additions and 3 deletions

View file

@ -445,7 +445,28 @@ def play():
# sans le joueur actuel
players = filter(lambda p: p['id'] != player['id'], players)
return render_template('play.html', players=players)
#Calcul des statistiques
con = connect_sqlite()
cur = con.cursor()
cur.execute("""select firstname,name,ban_end from players""")
rows = cur.fetchall()
con.close()
tranchés = 0
n_tranchés = 0
with open(IMMUNITY_FILE, 'r') as f:
immunity = f.read()
for row in rows:
if row[0]+' '+row[1] not in immunity:
if row[2] > time():
tranchés += 1
else:
n_tranchés += 1
stats = (tranchés,n_tranchés)
return render_template('play.html', players=players, stats=stats)
else:
return render_template('precampagne.html', user=player)

View file

@ -18,6 +18,8 @@
<p>
Rien pour l'instant
</p>
{% endif %}
<script type="text/javascript">
$(function () {
Highcharts.chart('container', {
@ -62,5 +64,4 @@ $(function () {
});
});
</script>
{% endif %}
{% endblock %}

View file

@ -19,6 +19,7 @@
Rien pour l'instant
</p>
{% endif %}
<script type="text/javascript">
$(function () {
Highcharts.chart('container', {
@ -63,5 +64,4 @@
});
});
</script>
{% endif %}
{% endblock %}