From 0caa41cc9036b771ffad342203de7233b2cd660f Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sun, 19 May 2024 10:40:41 -0400 Subject: [PATCH] use VoteType in voting views. --- classes/voting_views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classes/voting_views.py b/classes/voting_views.py index 6d1694d..cdfc8ca 100644 --- a/classes/voting_views.py +++ b/classes/voting_views.py @@ -17,7 +17,7 @@ from database_setup.sql_data_classes import ( Votes, engine, ) -from utils import build_votes_str, get_election_name +from utils import VoteType, build_votes_str, get_election_name class VoteSelect(nextcord.ui.StringSelect): @@ -47,6 +47,7 @@ class VoteSelect(nextcord.ui.StringSelect): ElectionCycle=election_name, VoterId=interaction.user.id, VotedForId=voted_for, + Type=VoteType.COUNCIL, ) try: @@ -59,6 +60,7 @@ class VoteSelect(nextcord.ui.StringSelect): update(Votes) .where(Votes.ElectionCycle == election_name) .where(Votes.VoterId == interaction.user.id) + .where(Votes.Type == VoteType.COUNCIL) .values(VotedForId=voted_for) ) session.execute(stmt) @@ -121,6 +123,7 @@ class VoteView(nextcord.ui.View): select(Votes.VotedForId) .where(Votes.ElectionCycle == election) .where(Votes.VoterId == interaction.user.id) + .where(Votes.Type == VoteType.COUNCIL) ) voted_for = session.scalar(stmt)