diff --git a/classes/nominate_views.py b/classes/nominate_views.py index 23dda9e..177ae76 100644 --- a/classes/nominate_views.py +++ b/classes/nominate_views.py @@ -9,9 +9,7 @@ from sqlalchemy.orm import Session from config import DakinyConfig from database_setup.sql_data_classes import CouncilMembers, engine -from utils import get_election_cycle_name - -NOMINEE_SPLITTER = "========================================\n\n" +from utils import NOMINEE_SPLITTER, decorate_nomination, get_election_cycle_name class NominateModal(nextcord.ui.Modal): @@ -142,21 +140,3 @@ class NominateView(nextcord.ui.View): self.config, interaction.user.id, usr_nominated, speech_content ) ) - - -def decorate_nomination(user_id: int, speech: str) -> str: - """ - Decorates a nomination speech so that it sits within multiple speeches better. - - Args: - user_id (int): ID of user sending the speech - speech (str): Speech from the user - - Returns: - str: Decorated speech - """ - msg = f"**Clan Council Nominee: <@{user_id}>**\n" - msg += NOMINEE_SPLITTER - msg += speech - - return msg diff --git a/utils.py b/utils.py index 8f2774b..2b64515 100644 --- a/utils.py +++ b/utils.py @@ -10,6 +10,8 @@ from sqlalchemy.orm import Session from config import DakinyConfig from database_setup.sql_data_classes import CouncilMembers, Votes, engine +NOMINEE_SPLITTER = "========================================\n\n" + def get_datetime(day: str) -> datetime: """ @@ -87,7 +89,9 @@ def build_votes_str(config: DakinyConfig) -> str: for nominee in session.scalars(stmt): votes[nominee.MemberId] = 0 - stmt = select(Votes).where(Votes.ElectionCycle == get_election_cycle_name(config)) + stmt = select(Votes).where( + Votes.ElectionCycle == get_election_cycle_name(config) + ) for vote in session.scalars(stmt): if vote.VotedForId is not None: @@ -101,3 +105,21 @@ def build_votes_str(config: DakinyConfig) -> str: votes_str += "☑️" return votes_str + + +def decorate_nomination(user_id: int, speech: str) -> str: + """ + Decorates a nomination speech so that it sits within multiple speeches better. + + Args: + user_id (int): ID of user sending the speech + speech (str): Speech from the user + + Returns: + str: Decorated speech + """ + msg = f"**Clan Council Nominee: <@{user_id}>**\n" + msg += NOMINEE_SPLITTER + msg += speech + + return msg