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 %} +