Change ElectionCycle class to Election. Change ElectionCycle column in database to ElectionName. Update some variables for clarification.
This commit is contained in:
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING
|
||||
import nextcord
|
||||
from nextcord.ext import application_checks, commands
|
||||
|
||||
from classes.election_cycle import ElectionCycle
|
||||
from classes.election import Election
|
||||
from utils import GUILDS, get_current_election_cycle
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -45,7 +45,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -63,7 +63,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -81,7 +81,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -99,7 +99,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -117,7 +117,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -135,7 +135,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
@@ -153,7 +153,7 @@ class TestCog(commands.Cog, name="Test commands."):
|
||||
interaction (nextcord.Interaction): Interaction with the message.
|
||||
"""
|
||||
config: DakinyConfig = self.bot.config
|
||||
cycle = ElectionCycle(
|
||||
cycle = Election(
|
||||
get_current_election_cycle(config),
|
||||
config,
|
||||
self.bot.get_guild(config.params.guild_id),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user