Fix vote update

This commit is contained in:
Peter J. Holzer 2022-11-05 12:09:00 +01:00
parent 8143c6286f
commit 93730d95fb
1 changed files with 9 additions and 3 deletions

12
app.py
View File

@ -133,7 +133,9 @@ def vote_date():
abort(400)
meet_id = r[0].meet
csr.execute("delete from date_vote where date = any (%s)", (date_ids,))
csr.execute(
"delete from date_vote where date = any (%s) and bod = %s",
(date_ids, session["user"]["id"]))
for pos, date_id in enumerate(date_ids):
csr.execute(
"insert into date_vote(date, bod, position) values(%s, %s, %s)",
@ -167,7 +169,9 @@ def vote_time():
abort(400)
meet_id = r[0].meet
csr.execute("delete from time_vote where time = any (%s)", (time_ids,))
csr.execute(
"delete from time_vote where time = any (%s) and bod = %s",
(time_ids, session["user"]["id"]))
for pos, time_id in enumerate(time_ids):
csr.execute(
"insert into time_vote(time, bod, position) values(%s, %s, %s)",
@ -201,7 +205,9 @@ def vote_place():
abort(400)
meet_id = r[0].meet
csr.execute("delete from place_vote where place = any (%s)", (place_ids,))
csr.execute(
"delete from place_vote where place = any (%s) and bod = %s",
(place_ids, session["user"]["id"]))
for pos, place_id in enumerate(place_ids):
csr.execute(
"insert into place_vote(place, bod, position) values(%s, %s, %s)",