From b64399093a21667301c58c471dda305180fddeb9 Mon Sep 17 00:00:00 2001 From: asauer Date: Fri, 12 Apr 2019 14:35:12 +0200 Subject: [PATCH] Removed underline from links, generated ids --- gruppenbildungsspiel.py | 17 ++++++++++++++--- static/main.css | 5 +++++ templates/base.html | 2 +- templates/form.html | 2 +- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gruppenbildungsspiel.py b/gruppenbildungsspiel.py index 87fefa7..a8a9a87 100644 --- a/gruppenbildungsspiel.py +++ b/gruppenbildungsspiel.py @@ -11,12 +11,12 @@ datafile = "data.csv" @app.route('/') def index(): - generate_id() return render_template('index.html', title='Test', text='Hallo, Fooboar') @app.route('/form') def form(): - return render_template('form.html', title='Test', text='Hallo, Fooboar') + id = generate_id() + return render_template('form.html', title='Test', text='Hallo, Fooboar', your_id=id) @app.route('/result') def result(): @@ -36,9 +36,20 @@ def solution(): def generate_id(): data = list() - new_id = uuid.uuid1().split("-")[0] if not os.path.exists(datafile): open(datafile, "a").close() with open(datafile, "r") as f: + reader = csv.reader(f) + for line in reader: + data.append(line[0]) + + # best loop ever + while True: + new_id = str(uuid.uuid1()).split("-")[0] + + if new_id in data: + break + else: + return new_id diff --git a/static/main.css b/static/main.css index 570a14e..5145cd5 100644 --- a/static/main.css +++ b/static/main.css @@ -73,6 +73,11 @@ li a{ background-color: #3e8e41; } +/* Remove underline effect if links are inside a div (cf. index.html) */ +div a { + text-decoration: none; +} + /* logo image class */ .logo { width: 10%; diff --git a/templates/base.html b/templates/base.html index d656c81..8c28e2b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,7 +9,7 @@
-

Das Spiel der 1001 Möglichkeiten

+

Sorting is Fun! The Importance of Being Sorted