Change ElectionCycle class to Election. Change ElectionCycle column in database to ElectionName. Update some variables for clarification.

This commit is contained in:
2024-09-03 11:24:28 -04:00
parent 306e0d687a
commit eb5102578d
10 changed files with 71 additions and 79 deletions
+2 -2
View File
@@ -149,7 +149,7 @@ class ViewCog(commands.Cog, name="View Commands"):
election_name (str): Is SlashOption. The name of the election to view votes for.
election_type(str): Is SlashOption. The type of election to search for. Choice from StrEnum VoteType.
"""
stmt = select(Votes).where(Votes.ElectionCycle == election_name).where(Votes.Type == election_type)
stmt = select(Votes).where(Votes.ElectionName == election_name).where(Votes.Type == election_type)
with Session(engine) as session:
# Check if election exists.
@@ -178,7 +178,7 @@ class ViewCog(commands.Cog, name="View Commands"):
election_name (str): String to run autocomplete on.
"""
with Session(engine) as session:
stmt = select(Votes.ElectionCycle).distinct()
stmt = select(Votes.ElectionName).distinct()
elections = session.scalars(stmt)
# if empty compare string