Compare commits
4
Commits
f4f3bfe103
...
bc56830396
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc56830396 | ||
|
|
1d14f8171d | ||
|
|
2efd380a7e | ||
|
|
475170025a |
@@ -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():
|
||||
|
||||
@@ -25,7 +25,7 @@ CREATE TABLE Votes(
|
||||
ElectionCycle varchar(30) not null,
|
||||
VoterId bigint unsigned not null,
|
||||
VotedForId bigint unsigned,
|
||||
Type varchar(14) check("Type" in ('Council','DiscordManager','ClanLeader')),
|
||||
Type int unsigned not null,
|
||||
FOREIGN KEY (ElectionCycle) REFERENCES ElectionInformation(ElectionCycle),
|
||||
PRIMARY KEY (ElectionCycle, VoterId, Type)
|
||||
);
|
||||
|
||||
@@ -4,6 +4,7 @@ File contains util functions.
|
||||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Iterable
|
||||
|
||||
import nextcord
|
||||
@@ -24,6 +25,8 @@ REPO_DIR = "./dakiny-messages"
|
||||
MESSAGES_DIR = f"{REPO_DIR}/messages"
|
||||
TEMPLATES_DIR = f"{REPO_DIR}/message_templates"
|
||||
|
||||
VoteType = Enum("VoteType", ["COUNCIL", "DISCORDMANAGER", "CLANLEADER"])
|
||||
|
||||
|
||||
def get_datetime(day: str) -> datetime:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user