Use VoteType in view command.
This commit is contained in:
+11
-1
@@ -14,6 +14,7 @@ from database_setup.sql_data_classes import (
|
|||||||
Votes,
|
Votes,
|
||||||
engine,
|
engine,
|
||||||
)
|
)
|
||||||
|
from utils import VoteType
|
||||||
|
|
||||||
|
|
||||||
class ViewCog(commands.Cog, name="View Commands"):
|
class ViewCog(commands.Cog, name="View Commands"):
|
||||||
@@ -148,6 +149,11 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
election_name: str = nextcord.SlashOption(
|
election_name: str = nextcord.SlashOption(
|
||||||
required=True, description="The election you want to view votes for."
|
required=True, description="The election you want to view votes for."
|
||||||
),
|
),
|
||||||
|
election_type: str = nextcord.SlashOption(
|
||||||
|
required=True,
|
||||||
|
description="The election type. Council, Discord Manager, or Clan Leader.",
|
||||||
|
choices=VoteType,
|
||||||
|
),
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Takes in an election name and sends a response message to the user with a list of people who voted in that
|
Takes in an election name and sends a response message to the user with a list of people who voted in that
|
||||||
@@ -159,7 +165,11 @@ class ViewCog(commands.Cog, name="View Commands"):
|
|||||||
election_name (str): Is SlashOption. The name of the election to view votes for.
|
election_name (str): Is SlashOption. The name of the election to view votes for.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
stmt = select(Votes).where(Votes.ElectionCycle == election_name)
|
stmt = (
|
||||||
|
select(Votes)
|
||||||
|
.where(Votes.ElectionCycle == election_name)
|
||||||
|
.where(Votes.Type == election_type)
|
||||||
|
)
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
# Check if election exists.
|
# Check if election exists.
|
||||||
|
|||||||
Reference in New Issue
Block a user