List people who already voted

This commit is contained in:
Peter J. Holzer 2022-11-09 00:04:07 +01:00
parent 37ed14e1d6
commit b6db3f0ea9
3 changed files with 35 additions and 3 deletions

21
app.py
View File

@ -86,6 +86,25 @@ def vote(key):
if not meet:
abort(404)
csr.execute(
"""
select email from bod where id in (
select date_vote.bod
from date join date_vote on date.id = date_vote.date
where meet = %(meet_id)s
union
select time_vote.bod
from time join time_vote on time.id = time_vote.time
where meet = %(meet_id)s
union
select place_vote.bod
from place join place_vote on place.id = place_vote.place
where meet = %(meet_id)s
) order by 1
""",
{ "meet_id": meet.id,})
voters = csr.fetchall()
csr.execute(
"""
select d.id, d.date, d.display, position
@ -114,7 +133,7 @@ def vote(key):
places = csr.fetchall()
return render_template("vote.html",
meet=meet, dates=dates, times=times, places=places)
meet=meet, voters=voters,dates=dates, times=times, places=places)
@app.post("/vote/date")
def vote_date():

View File

@ -19,16 +19,23 @@ body {
}
body {
padding: 1rem;
display: grid;
grid-template-columns: 1fr 1fr;
grid-column-gap: 2em;
line-height: 1.5em;
}
#hello {
p {
margin-top: 0;
}
#hello, #voters {
grid-column: 1 / 3;
}
h1, h2 {
grid-column: 1 / 3;
line-height: 1.1em;
}
.result-item {

View File

@ -8,7 +8,13 @@
<link rel="stylesheet" href="/static/style.css">
</head>
<body>
<p id="hello">Hallo, {{ session.user.email }}!</p>
<p id="hello">Hallo, {{ session.user.email }}!</p>
<p id="voters">
Bisher haben abgestimmt:
{% for voter in voters %}
{{ voter.email }}{% if not loop.last %},{% endif %}
{% endfor %}
</p>
<h1>
{{ meet.title }}
</h1>