Compare commits

..

No commits in common. "b7ee8faf4d21a5e2efa7813c24a4238c9dc48cfd" and "ac2e4f0b62809d9a3a26e220c0788d0a414f3360" have entirely different histories.

2 changed files with 10 additions and 32 deletions

20
app.py
View File

@ -31,22 +31,7 @@ def home():
log.debug("session = %s", session)
if "user" not in session:
return redirect(url_for("register", target="/"))
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)
return render_template("home.html")
@app.route("/register", methods=["GET", "POST"])
def register():
@ -157,7 +142,6 @@ def vote(key):
@app.post("/vote/date")
def vote_date():
log.debug("user = %s", session["user"])
log.debug("form = %s", request.form)
meet_id, preferences = get_preferences("date")
date_ids = list(preferences.keys())
@ -227,7 +211,6 @@ def result_date(meet_id):
@app.post("/vote/time")
def vote_time():
log.debug("user = %s", session["user"])
log.debug("form = %s", request.form)
meet_id, preferences = get_preferences("time")
time_ids = list(preferences.keys())
@ -295,7 +278,6 @@ def result_time(meet_id):
@app.post("/vote/place")
def vote_place():
log.debug("user = %s", session["user"])
log.debug("form = %s", request.form)
meet_id, preferences = get_preferences("place")
place_ids = list(preferences.keys())

View File

@ -6,18 +6,14 @@
</head>
<body>
<p>Hallo, {{ session.user.email }}!</p>
{% for meet in meets %}
{% if loop.first %}
<ul>
{% endif %}
<li><a href="{{url_for("vote", key=meet.key)}}">{{meet.title}}</a></li>
{% if loop.last %}
</ul>
{% endif %}
{% else %}
<p>(Du hast noch an keiner Abstimmung teilgenommen)</p>
{% endfor %}
<p>
{{ session }}
</p>
<p>
{{ session.user }}
</p>
<p>
{{ session.user.1 }}
</p>
</body>
</html>