Trying to figure out why the elections are not starting.
This commit is contained in:
@@ -5,9 +5,6 @@ from datetime import UTC, datetime, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
import nextcord
|
||||
from sqlalchemy import select, true, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from dakiny_bot.classes.nominate_highcouncil_views import NominateHighCouncilView
|
||||
from dakiny_bot.classes.nominate_views import NominateView
|
||||
from dakiny_bot.classes.voting_highcouncil_views import VoteHighcouncilView
|
||||
@@ -19,6 +16,7 @@ from dakiny_bot.database.sql_data_classes import (
|
||||
Votes,
|
||||
engine,
|
||||
)
|
||||
from dakiny_bot.logger import dakiny_logger
|
||||
from dakiny_bot.utils import (
|
||||
TEMPLATES_DIR,
|
||||
VoteType,
|
||||
@@ -28,6 +26,8 @@ from dakiny_bot.utils import (
|
||||
get_datetime,
|
||||
get_election_name,
|
||||
)
|
||||
from sqlalchemy import select, true, update
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
REQUIRED_VOTES_TO_BE_ELECTED = 3
|
||||
|
||||
@@ -144,20 +144,29 @@ class Election:
|
||||
async def check_date(self) -> None:
|
||||
"""Function checks current date to see if something needs to be run."""
|
||||
today = datetime.now(tz=UTC)
|
||||
dakiny_logger.debug("Checking date.")
|
||||
|
||||
# check all dates if action is needed
|
||||
if today.date() == self.election_start.date():
|
||||
dakiny_logger.debug("Election start.")
|
||||
await self.election_start_action()
|
||||
elif today.date() == self.voting_start.date():
|
||||
dakiny_logger.debug("Voting start.")
|
||||
await self.voting_start_action()
|
||||
elif (self.voting_end - timedelta(3)).date() <= today.date() < self.voting_end.date():
|
||||
dakiny_logger.debug("Election reminder.")
|
||||
await self.election_reminder()
|
||||
elif today.date() == self.voting_end.date():
|
||||
dakiny_logger.debug("Voting end.")
|
||||
await self.voting_end_action()
|
||||
elif today.date() == self.highcouncil_election_start.date():
|
||||
dakiny_logger.debug("Highcouncil election start.")
|
||||
await self.highcouncil_election_start_action()
|
||||
elif today.date() == self.term_start.date():
|
||||
dakiny_logger.debug("Term start")
|
||||
await self.term_start_action()
|
||||
else:
|
||||
dakiny_logger.warning("Check date didn't do anything. This should never happen.")
|
||||
|
||||
async def election_start_action(self) -> None:
|
||||
"""Performs required actions for when the election cycle starts."""
|
||||
|
||||
Reference in New Issue
Block a user