Remove config param from get_election_name().
This commit is contained in:
@@ -12,7 +12,7 @@ import nextcord
|
||||
from sqlalchemy import select, true, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from DakinySettings import DakinySettings
|
||||
from DakinySettings import settings
|
||||
from database_setup.sql_data_classes import (
|
||||
CouncilMembers,
|
||||
EventPoints,
|
||||
@@ -57,18 +57,15 @@ def get_datetime(day: str) -> datetime:
|
||||
return datetime(year, month, day, tzinfo=UTC)
|
||||
|
||||
|
||||
def get_election_name(config: DakinySettings) -> str:
|
||||
def get_election_name() -> str:
|
||||
"""
|
||||
Builds the unique name of the current election cycle.
|
||||
|
||||
Args:
|
||||
config (DakinyConfig): the config used to know the election cycle.
|
||||
|
||||
Returns:
|
||||
str: the name of the election cycle
|
||||
"""
|
||||
cycle = get_current_election_cycle(config)
|
||||
current_cycle = config.election_cycles[cycle]
|
||||
cycle = get_current_election_cycle(settings)
|
||||
current_cycle = settings.election_cycles[cycle]
|
||||
return f"vote-{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
|
||||
|
||||
|
||||
@@ -145,7 +142,7 @@ def build_votes_str(config: DakinySettings, guild: nextcord.Guild) -> str:
|
||||
"""
|
||||
votes: dict[int, int] = {}
|
||||
|
||||
election_name = get_election_name(config)
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = select(CouncilMembers).where(CouncilMembers.ElectionName == election_name)
|
||||
@@ -182,7 +179,7 @@ def build_highcouncil_votes_str(config: DakinySettings, guild: nextcord.Guild) -
|
||||
cl_votes: dict[int, int] = {}
|
||||
dm_votes: dict[int, int] = {}
|
||||
|
||||
election_name = get_election_name(config)
|
||||
election_name = get_election_name()
|
||||
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
@@ -512,7 +509,7 @@ async def edit_clan_council_info(guild: nextcord.Guild, config: DakinySettings)
|
||||
"""
|
||||
clan_info_channel: nextcord.TextChannel = await guild.fetch_channel(config.params.clan_info_channel_id)
|
||||
|
||||
election_name = get_election_name(config)
|
||||
election_name = get_election_name()
|
||||
with Session(engine) as session:
|
||||
stmt = (
|
||||
select(CouncilMembers.MemberId)
|
||||
|
||||
Reference in New Issue
Block a user