diff --git a/roulette.py b/roulette.py index 4c692de..3ad7f5f 100644 --- a/roulette.py +++ b/roulette.py @@ -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) diff --git a/templates/down.html b/templates/down.html index b132287..ee052f5 100644 --- a/templates/down.html +++ b/templates/down.html @@ -18,6 +18,8 @@

Rien pour l'instant

+ +{% endif %} -{% endif %} {% endblock %} diff --git a/templates/home.html b/templates/home.html index 7ba174b..87b0022 100644 --- a/templates/home.html +++ b/templates/home.html @@ -19,6 +19,7 @@ Rien pour l'instant

+ {% endif %} - {% endif %} {% endblock %}