Middle of adding user to council member table. Need to move function for getting election name to utils.
build_develop / build (push) Successful in 1m33s
build_develop / build (push) Successful in 1m33s
This commit is contained in:
@@ -11,7 +11,7 @@ from sqlalchemy.orm import Session
|
||||
from classes.nominate_views import NominateView
|
||||
from config import DakinyConfig
|
||||
from database_setup.sql_data_classes import ElectionInformation, engine
|
||||
from utils import get_datetime
|
||||
from utils import get_datetime, get_election_cycle_name
|
||||
|
||||
|
||||
class ElectionCycle:
|
||||
@@ -152,7 +152,7 @@ class ElectionCycle:
|
||||
"""
|
||||
# create new channel for election
|
||||
category: nextcord.CategoryChannel = self.guild.get_channel(self.config.params.active_category_id)
|
||||
quarter_name: str = self.get_election_cycle_name()
|
||||
quarter_name: str = get_election_cycle_name()
|
||||
|
||||
# create new entry into database.
|
||||
election_channel: nextcord.TextChannel = await category.create_text_channel(quarter_name)
|
||||
@@ -217,16 +217,6 @@ class ElectionCycle:
|
||||
|
||||
await election_channel.move(beginning=True, category=archive)
|
||||
|
||||
def get_election_cycle_name(self) -> str:
|
||||
"""
|
||||
Builds the unique name of the current election cycle
|
||||
|
||||
Returns:
|
||||
str: the name of the election cycle
|
||||
"""
|
||||
|
||||
return f"vote-{self.election_start.year}-{self.election_cycle.name}"
|
||||
|
||||
def get_election_info(self) -> ElectionInformation:
|
||||
"""
|
||||
Gets information for current election.
|
||||
@@ -236,7 +226,5 @@ class ElectionCycle:
|
||||
"""
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(ElectionInformation).where(
|
||||
ElectionInformation.ElectionCycle == self.get_election_cycle_name()
|
||||
)
|
||||
stmt = select(ElectionInformation).where(ElectionInformation.ElectionCycle == get_election_cycle_name())
|
||||
return session.scalar(stmt)
|
||||
|
||||
Reference in New Issue
Block a user