From f81e95381e80ba30c3a17ae187535ad7831c9f14 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Tue, 3 Sep 2024 16:08:27 -0400 Subject: [PATCH] Remove config param from get_quarter_cycle(). --- utils.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/utils.py b/utils.py index 2f6ecec..0a5d11d 100644 --- a/utils.py +++ b/utils.py @@ -73,13 +73,10 @@ def get_quarter_name() -> str: """ Builds the name of the current cycle/quarter. - Args: - config (DakinyConfig): the config used to know the election cycle. - Returns: str: the name of the cycle. """ - cycle = get_quarter_cycle(settings) + cycle = get_quarter_cycle() current_cycle = settings.election_cycles[cycle] return f"{get_datetime(current_cycle.term_start).year}-{current_cycle.name}" @@ -89,9 +86,6 @@ def get_current_election_cycle() -> int: """ Returns index for active election. An election is considered active between the election start and the term start. - Args: - config (DakinyConfig): Config object to use - Returns: int: cycle index for active election. None for no active cycle """ @@ -105,21 +99,18 @@ def get_current_election_cycle() -> int: return cycle # It isn't a current election, get the quarter - return get_quarter_cycle(settings) + return get_quarter_cycle() -def get_quarter_cycle(config: DakinySettings) -> int: +def get_quarter_cycle() -> int: """ Returns the index for the current cycle/quarter. Defined as between term start and end. Shouldn't return none. - Args: - config (DakinyConfig): Config object to use - Returns: int: cycle index for current cycle. """ today = datetime.now(tz=UTC) - for cycle, election in enumerate(config.election_cycles): + for cycle, election in enumerate(settings.election_cycles): if ( today.date() >= get_datetime(election.term_start).date() and today.date() <= get_datetime(election.term_end).date()