Affichage de l'historique plus souvent
This commit is contained in:
parent
115c81f283
commit
10bbc40117
1 changed files with 41 additions and 16 deletions
35
roulette.py
35
roulette.py
|
@ -357,12 +357,8 @@ def home():
|
|||
player = get_player_from_ip(get_ip())
|
||||
if DEBUG:
|
||||
print(STATE)
|
||||
if "down" in STATE:
|
||||
return render_template('down.html', user=player,stats=statistiques())
|
||||
elif "up" in STATE:
|
||||
if DEBUG:
|
||||
print(player, 'arrived')
|
||||
|
||||
bans = sorted(get_bans(player['id']), \
|
||||
key=lambda ban: ban['time'], \
|
||||
reverse=True)
|
||||
|
@ -387,8 +383,11 @@ def home():
|
|||
else:
|
||||
entry = ('ban', u'%s : Tu as échoué en voulant trancher %s %s.' \
|
||||
% (date, target['firstname'], target['name']))
|
||||
|
||||
bans_hist.append(entry)
|
||||
|
||||
if "down" in STATE:
|
||||
return render_template('down.html', user=player, stats=statistiques(), bans_hist=bans_hist)
|
||||
elif "up" in STATE:
|
||||
return render_template('home.html', bans_hist=bans_hist, stats=statistiques())
|
||||
else:
|
||||
return render_template('precampagne.html', user=player,stats=statistiques())
|
||||
|
@ -399,7 +398,33 @@ def play():
|
|||
ip = get_ip()
|
||||
player = get_player_from_ip(ip)
|
||||
if "down" in STATE:
|
||||
bans = sorted(get_bans(player['id']), \
|
||||
key=lambda ban: ban['time'], \
|
||||
reverse=True)
|
||||
|
||||
bans_hist = []
|
||||
for ban in bans:
|
||||
date = strftime('%Hh%M (%A)', localtime(ban['time']))
|
||||
source = get_player(ban['player_id'])
|
||||
target = get_player(ban['target_id'])
|
||||
|
||||
if target['id'] == player['id']:
|
||||
if ban['success']:
|
||||
entry = ('ban', u'%s : %s %s a réussi à t\'avoir.' \
|
||||
% (date, source['firstname'], source['name']))
|
||||
else:
|
||||
entry = ('warn', u'%s : %s %s a essayé de te trancher, en vain.' \
|
||||
% (date, source['firstname'], source['name']))
|
||||
else:
|
||||
if ban['success']:
|
||||
entry = ('ok', u'%s : Tu as tranché %s %s avec succès.' \
|
||||
% (date, target['firstname'], target['name']))
|
||||
else:
|
||||
entry = ('ban', u'%s : Tu as échoué en voulant trancher %s %s.' \
|
||||
% (date, target['firstname'], target['name']))
|
||||
bans_hist.append(entry)
|
||||
return render_template('down.html', user=player,stats=statistiques())
|
||||
|
||||
elif "up" in STATE:
|
||||
# Traitement de la requête de bannissement
|
||||
if request.method == 'POST':
|
||||
|
|
Loading…
Reference in a new issue