Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c654612a9 | ||
|
|
e836ead399 |
@@ -31,6 +31,9 @@ def get_datetime(day: str) -> datetime:
|
|||||||
if datetime.today().month == 12 and month < 12:
|
if datetime.today().month == 12 and month < 12:
|
||||||
year += 1
|
year += 1
|
||||||
|
|
||||||
|
if datetime.today().month == 1 and month > 1:
|
||||||
|
year -= 1
|
||||||
|
|
||||||
return datetime(year, month, day)
|
return datetime(year, month, day)
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +50,9 @@ def get_election_cycle_name(config: DakinyConfig) -> str:
|
|||||||
cycle = get_current_cycle(config)
|
cycle = get_current_cycle(config)
|
||||||
current_cycle = config.election_cycles[cycle]
|
current_cycle = config.election_cycles[cycle]
|
||||||
|
|
||||||
return f"vote-{get_datetime(current_cycle.term_start).year}-{current_cycle.name}"
|
return (
|
||||||
|
f"vote-{get_datetime(current_cycle.election_start).year}-{current_cycle.name}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_dm_election_name(config: DakinyConfig) -> str:
|
def get_dm_election_name(config: DakinyConfig) -> str:
|
||||||
@@ -86,7 +91,7 @@ def get_current_cycle(config: DakinyConfig) -> int:
|
|||||||
config (DakinyConfig): Config object to use
|
config (DakinyConfig): Config object to use
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: cycle index for active election. -1 for no active cycle
|
int: cycle index for active election. None for no active cycle
|
||||||
"""
|
"""
|
||||||
|
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
@@ -98,7 +103,7 @@ def get_current_cycle(config: DakinyConfig) -> int:
|
|||||||
):
|
):
|
||||||
return cycle
|
return cycle
|
||||||
|
|
||||||
return -1
|
return None
|
||||||
|
|
||||||
|
|
||||||
def build_votes_str(config: DakinyConfig) -> str:
|
def build_votes_str(config: DakinyConfig) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user