Remove config param from get_current_election_cycle(). Update test.py to use new settings.

This commit is contained in:
2024-09-03 16:07:23 -04:00
parent 1dd5a33da5
commit 62f9902298
3 changed files with 20 additions and 32 deletions
+4 -4
View File
@@ -64,7 +64,7 @@ def get_election_name() -> str:
Returns:
str: the name of the election cycle
"""
cycle = get_current_election_cycle(settings)
cycle = get_current_election_cycle()
current_cycle = settings.election_cycles[cycle]
return f"vote-{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
@@ -85,7 +85,7 @@ def get_quarter_name() -> str:
return f"{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
def get_current_election_cycle(config: DakinySettings) -> int:
def get_current_election_cycle() -> int:
"""
Returns index for active election. An election is considered active between the election start and the term start.
@@ -97,7 +97,7 @@ def get_current_election_cycle(config: DakinySettings) -> int:
"""
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.election_start).date()
and today.date() <= get_datetime(election.term_start).date()
@@ -105,7 +105,7 @@ def get_current_election_cycle(config: DakinySettings) -> int:
return cycle
# It isn't a current election, get the quarter
return get_quarter_cycle(config)
return get_quarter_cycle(settings)
def get_quarter_cycle(config: DakinySettings) -> int: