From 93730d95fbce05b53351310250a1e6009d523353 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sat, 5 Nov 2022 12:09:00 +0100 Subject: [PATCH] Fix vote update --- app.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 4ca5026..0d35a72 100644 --- a/app.py +++ b/app.py @@ -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)",