Compare commits

..
Author SHA1 Message Date
imcompiling 1305e15edf Change cutoff months for rollover.
build_latest / build (push) Successful in 1m49s
build_develop / build (push) Successful in 24s
build_release / build (push) Successful in 20s
2024-12-14 18:36:47 -05:00
imcompiling 86e9e3e32b Write a new test case for quarter name. 2024-12-14 17:57:01 -05:00
2 changed files with 15 additions and 3 deletions
+13 -1
View File
@@ -5,7 +5,7 @@ from nextcord.ext import application_checks, commands
from classes.election import Election from classes.election import Election
from DakinySettings import settings from DakinySettings import settings
from utils import GUILDS, get_active_election_cycle from utils import GUILDS, get_active_election_cycle, get_quarter_name
ME = 206602713511886849 ME = 206602713511886849
@@ -141,3 +141,15 @@ class TestCog(commands.Cog, name="Test commands."):
) )
await cycle.term_start_action() await cycle.term_start_action()
await interaction.send("Test command sent.", ephemeral=True) await interaction.send("Test command sent.", ephemeral=True)
@test.subcommand()
@is_me()
async def get_quarter_name(self, interaction: nextcord.Interaction) -> None:
"""
Tests getting the quarter name.
Args:
interaction (nextcord.Interaction): Interaction with the message.
"""
name = get_quarter_name()
await interaction.send(name)
+2 -2
View File
@@ -48,10 +48,10 @@ def get_datetime(day: str) -> datetime:
day = int(day.split("/")[1]) day = int(day.split("/")[1])
# ensure that year rolls over if current month is December and the next month is less than 12. # ensure that year rolls over if current month is December and the next month is less than 12.
if today.month == calendar.DECEMBER and month < calendar.DECEMBER: if today.month == calendar.DECEMBER and month < calendar.OCTOBER:
year += 1 year += 1
if today.month == calendar.JANUARY and month > calendar.JANUARY: if today.month == calendar.JANUARY and month > calendar.MARCH:
year -= 1 year -= 1
return datetime(year, month, day, tzinfo=UTC) return datetime(year, month, day, tzinfo=UTC)