diff --git a/roulette.py b/roulette.py index 2157824..41b790b 100644 --- a/roulette.py +++ b/roulette.py @@ -10,6 +10,7 @@ import MySQLdb from time import time, localtime, strftime import locale import random +import json # configuration DEBUG = True @@ -164,12 +165,9 @@ def get_players_not_banned(): not_banned = [{'id': row[0], 'firstname': row[1], 'name': row[2]} for row in rows] # Ensuite on applique les règles d'immunité - with open(IMMUNITY_FILE, 'r') as f: - immunity = f.read() - result = [] - for user in not_banned: - if user['firstname']+' '+user['name'] not in immunity: - result.append(user) + result = [] + for user in not_banned: + result.append(user) return result def cheat(player_id, target_id): @@ -419,5 +417,18 @@ def play(): else: return render_template('precampagne.html', user=player,stats=statistiques()) + +@app.route('/complete') +def complete(): + v = request.args['v'] + con = connect_sql() + cur = con.cursor() + cur.execute("""select id, firstname, name from players where + name like "{value}%" or firstname like "{value}%";""".format(value=v)) + rows = [[i[0], i[1]+' '+i[2]] for i in cur.fetchall()] + con.close() + return json.dumps(rows) + + if __name__ == '__main__': app.run() diff --git a/templates/play.html b/templates/play.html index 164616d..5c68dc8 100644 --- a/templates/play.html +++ b/templates/play.html @@ -1,19 +1,38 @@ {% extends "layout.html" %} {% block content %} +

Trancher un joueur

Ta cible sera notifiée quelle que soit l'issue de ta tentative. Question chance, c'est 50-50.

- + + + +