Add vote type to one statement.

This commit is contained in:
2024-05-18 16:34:33 -04:00
parent 2efd380a7e
commit 1d14f8171d
+6 -1
View File
@@ -22,6 +22,7 @@ from database_setup.sql_data_classes import (
)
from utils import (
TEMPLATES_DIR,
VoteType,
build_highcouncil_votes_str,
build_votes_str,
edit_clan_council_info,
@@ -294,7 +295,11 @@ class ElectionCycle:
session.commit()
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
stmt = select(Votes.VotedForId).where(Votes.ElectionCycle == election_name)
stmt = (
select(Votes.VotedForId)
.where(Votes.ElectionCycle == election_name)
.where(Votes.Type == VoteType.COUNCIL.value)
)
vote_count = collections.Counter(session.scalars(stmt))
for user_id, votes in vote_count.items():