diff --git a/app.py b/app.py index c97569c..afc7521 100644 --- a/app.py +++ b/app.py @@ -8,18 +8,18 @@ app = Flask(__name__) listCadeau = {} def genCadeau(): + global listCadeau tmp = list(myconfig.listGens.keys()) for g in myconfig.listGens.keys(): - a, b = random.choices(tmp, k=2) - if a == g: - listCadeau[g] = b - tmp.remove(b) - else: - listCadeau[g] = a - tmp.remove(a) + pc = [v for v in tmp if v != g] + a = random.choice(pc) + listCadeau[g] = a + tmp.remove(a) @app.route('/') def hello(): + if not listCadeau: + genCadeau() return render_template("index.html") @app.route('/code')