Fix bugs with the voting results string builder.
This commit is contained in:
@@ -153,8 +153,10 @@ def build_highcouncil_votes_str(config: DakinyConfig) -> str:
|
|||||||
dm_votes: dict[int, int] = {}
|
dm_votes: dict[int, int] = {}
|
||||||
|
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
stmt = select(CouncilMembers).where(
|
stmt = (
|
||||||
CouncilMembers.ElectionCycle == get_election_cycle_name(config)
|
select(CouncilMembers)
|
||||||
|
.where(CouncilMembers.ElectionCycle == get_election_cycle_name(config))
|
||||||
|
.filter(CouncilMembers.ClanLeaderSpeechId.is_not(None))
|
||||||
)
|
)
|
||||||
|
|
||||||
for nominee in session.scalars(stmt):
|
for nominee in session.scalars(stmt):
|
||||||
@@ -166,8 +168,10 @@ def build_highcouncil_votes_str(config: DakinyConfig) -> str:
|
|||||||
if vote.VotedForId is not None:
|
if vote.VotedForId is not None:
|
||||||
cl_votes[vote.VotedForId] += 1
|
cl_votes[vote.VotedForId] += 1
|
||||||
|
|
||||||
stmt = select(CouncilMembers).where(
|
stmt = (
|
||||||
CouncilMembers.ElectionCycle == get_election_cycle_name(config)
|
select(CouncilMembers)
|
||||||
|
.where(CouncilMembers.ElectionCycle == get_election_cycle_name(config))
|
||||||
|
.filter(CouncilMembers.DiscordManagerSpeechId.is_not(None))
|
||||||
)
|
)
|
||||||
|
|
||||||
for nominee in session.scalars(stmt):
|
for nominee in session.scalars(stmt):
|
||||||
@@ -199,9 +203,11 @@ def user_vote_str(votes: dict[int, int]) -> str:
|
|||||||
Returns:
|
Returns:
|
||||||
str: The string showing names and number of votes.
|
str: The string showing names and number of votes.
|
||||||
"""
|
"""
|
||||||
|
ret_str: str = ""
|
||||||
|
|
||||||
for user_id, num_votes in votes.items():
|
for user_id, num_votes in votes.items():
|
||||||
return f"\n<@{user_id}>: {'☑️' * num_votes}"
|
ret_str += f"\n<@{user_id}>: {'☑️' * num_votes}"
|
||||||
|
return ret_str
|
||||||
|
|
||||||
|
|
||||||
def decorate_nomination(user_id: int, speech: str) -> str:
|
def decorate_nomination(user_id: int, speech: str) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user