Fix bug getting ElectionInformation object correctly.
build_develop / build (push) Successful in 1m31s

This commit is contained in:
2023-11-03 12:06:27 -04:00
parent 81e2885e8d
commit dcea911564
2 changed files with 6 additions and 4 deletions
+5 -3
View File
@@ -183,11 +183,13 @@ class ElectionCycle:
message = self.build_vote_start()
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
await election_channel.send(message, view=VoteView(self.config, self.guild))
vote_msg = await election_channel.send(build_votes_str(self.config))
await election_channel.send(message)
vote_msg = await election_channel.send(build_votes_str(self.config), view=VoteView(self.config, self.guild))
with Session(engine) as session:
stmt = select(ElectionInformation).where(ElectionCycle == get_election_cycle_name(self.config))
stmt = select(ElectionInformation).where(
ElectionInformation.ElectionCycle == get_election_cycle_name(self.config)
)
info = session.scalar(stmt)
info.CouncilVoteMsgId = vote_msg.id
session.commit()
+1 -1
View File
@@ -30,7 +30,7 @@ class VoteSelect(nextcord.ui.StringSelect):
vote_message_str = build_votes_str(self.config)
with Session(engine) as session:
stmt = select(ElectionInformation.CouncilVoteMsgId).where(
ElectionCycle == get_election_cycle_name(self.config)
ElectionInformation.ElectionCycle == get_election_cycle_name(self.config)
)
vote_msg_id = session.scalar(stmt)
vote_msg = await interaction.channel.fetch_message(vote_msg_id)