Graphe également présent pour les ban
This commit is contained in:
parent
c6c6b1c66d
commit
774f0ff1e1
1 changed files with 23 additions and 1 deletions
24
roulette.py
24
roulette.py
|
@ -296,10 +296,31 @@ def banned():
|
|||
else:
|
||||
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())
|
||||
|
||||
return render_template('banned.html', \
|
||||
explanation=explanation, timeleft=timeleft)
|
||||
explanation=explanation, timeleft=timeleft, stats=stats)
|
||||
|
||||
|
||||
@app.route('/banned_ip')
|
||||
|
@ -367,6 +388,7 @@ def home():
|
|||
|
||||
bans_hist.append(entry)
|
||||
|
||||
#Calcul des statistiques
|
||||
con = connect_sqlite()
|
||||
cur = con.cursor()
|
||||
|
||||
|
|
Loading…
Reference in a new issue