From a9a778b4c3b95b5962bc6054bf919597456faaec Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 19 Oct 2024 19:17:21 +0200 Subject: [PATCH] Add links to votes --- app.py | 17 ++++++++++++++++- templates/home.html | 22 +++++++++++++--------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/app.py b/app.py index 7595d3c..2cbdc3c 100644 --- a/app.py +++ b/app.py @@ -31,7 +31,22 @@ def home(): log.debug("session = %s", session) if "user" not in session: return redirect(url_for("register", target="/")) - return render_template("home.html") + csr = get_cursor() + csr.execute( + """ + select * from meet where id in ( + select meet from date_vote dv join date d on dv.date = d.id where bod = %(bod_id)s + union + select meet from time_vote tv join time t on tv.time = t.id where bod = %(bod_id)s + union + select meet from place_vote pv join place p on pv.place = p.id where bod = %(bod_id)s + ) + order by id desc + """, + {"bod_id": session["user"]["id"]} + ) + meets = csr.fetchall() + return render_template("home.html", meets=meets) @app.route("/register", methods=["GET", "POST"]) def register(): diff --git a/templates/home.html b/templates/home.html index 1426774..bb3b4b2 100644 --- a/templates/home.html +++ b/templates/home.html @@ -6,14 +6,18 @@

Hallo, {{ session.user.email }}!

-

- {{ session }} -

-

- {{ session.user }} -

-

- {{ session.user.1 }} -

+ + {% for meet in meets %} + {% if loop.first %} + + {% endif %} + {% else %} +

(Du hast noch an keiner Abstimmung teilgenommen)

+ {% endfor %} +