Graphe également présent pour les ban

This commit is contained in:
guimoz 2017-01-30 02:28:45 +01:00
parent c6c6b1c66d
commit 774f0ff1e1

View file

@ -296,10 +296,31 @@ def banned():
else: else:
explanation = u'Tu t\'es tranché toi-même, pas de chance...' explanation = u'Tu t\'es tranché toi-même, pas de chance...'
#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)
timeleft = int(player['ban_end'] - time()) timeleft = int(player['ban_end'] - time())
return render_template('banned.html', \ return render_template('banned.html', \
explanation=explanation, timeleft=timeleft) explanation=explanation, timeleft=timeleft, stats=stats)
@app.route('/banned_ip') @app.route('/banned_ip')
@ -367,6 +388,7 @@ def home():
bans_hist.append(entry) bans_hist.append(entry)
#Calcul des statistiques
con = connect_sqlite() con = connect_sqlite()
cur = con.cursor() cur = con.cursor()