Correct election name mixup. Use the highcouncil build string.

This commit is contained in:
2023-12-17 13:52:57 -05:00
parent 55259a2653
commit 09ad45c897
3 changed files with 9 additions and 10 deletions
+4 -1
View File
@@ -21,6 +21,7 @@ from database_setup.sql_data_classes import (
engine,
)
from utils import (
build_highcouncil_votes_str,
build_votes_str,
get_cl_election_name,
get_datetime,
@@ -304,8 +305,10 @@ class ElectionCycle:
election_thread: nextcord.Thread = self.guild.get_thread(
self.get_election_info().ThreadId
)
await election_thread.send(message)
vote_msg = await election_thread.send(
message, view=VoteHighcouncilView(self.config, self.guild)
build_highcouncil_votes_str(self.config),
view=VoteHighcouncilView(self.config, self.guild),
)
with Session(engine) as session:
+1 -1
View File
@@ -32,7 +32,7 @@ class TestCog(commands.Cog, name="Test commands."):
"""
self.bot = bot
@nextcord.slash_command()
@nextcord.slash_command(guild_ids=[1000247361639030804])
async def test(self, interaction: nextcord.Interaction):
"""
Parent slash command for help. Never called.
+4 -8
View File
@@ -154,30 +154,26 @@ def build_highcouncil_votes_str(config: DakinyConfig) -> str:
with Session(engine) as session:
stmt = select(CouncilMembers).where(
CouncilMembers.ElectionCycle == get_cl_election_name(config)
CouncilMembers.ElectionCycle == get_election_cycle_name(config)
)
for nominee in session.scalars(stmt):
cl_votes[nominee.MemberId] = 0
stmt = select(Votes).where(
Votes.ElectionCycle == get_election_cycle_name(config)
)
stmt = select(Votes).where(Votes.ElectionCycle == get_cl_election_name(config))
for vote in session.scalars(stmt):
if vote.VotedForId is not None:
cl_votes[vote.VotedForId] += 1
stmt = select(CouncilMembers).where(
CouncilMembers.ElectionCycle == get_dm_election_name(config)
CouncilMembers.ElectionCycle == get_election_cycle_name(config)
)
for nominee in session.scalars(stmt):
dm_votes[nominee.MemberId] = 0
stmt = select(Votes).where(
Votes.ElectionCycle == get_election_cycle_name(config)
)
stmt = select(Votes).where(Votes.ElectionCycle == get_dm_election_name(config))
for vote in session.scalars(stmt):
if vote.VotedForId is not None: