Add vote type to one statement.
This commit is contained in:
@@ -22,6 +22,7 @@ from database_setup.sql_data_classes import (
|
|||||||
)
|
)
|
||||||
from utils import (
|
from utils import (
|
||||||
TEMPLATES_DIR,
|
TEMPLATES_DIR,
|
||||||
|
VoteType,
|
||||||
build_highcouncil_votes_str,
|
build_highcouncil_votes_str,
|
||||||
build_votes_str,
|
build_votes_str,
|
||||||
edit_clan_council_info,
|
edit_clan_council_info,
|
||||||
@@ -294,7 +295,11 @@ class ElectionCycle:
|
|||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
# add the highcouncil role to everyone with 3 or more votes. set elected to true in database
|
# 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))
|
vote_count = collections.Counter(session.scalars(stmt))
|
||||||
|
|
||||||
for user_id, votes in vote_count.items():
|
for user_id, votes in vote_count.items():
|
||||||
|
|||||||
Reference in New Issue
Block a user