From 86e9e3e32b45aee9c825ff4c9922c1873cd9dea4 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sat, 14 Dec 2024 17:57:01 -0500 Subject: [PATCH 1/2] Write a new test case for quarter name. --- cogs/commands/test.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cogs/commands/test.py b/cogs/commands/test.py index a53fa9e..208e99b 100644 --- a/cogs/commands/test.py +++ b/cogs/commands/test.py @@ -5,7 +5,7 @@ from nextcord.ext import application_checks, commands from classes.election import Election 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 @@ -141,3 +141,15 @@ class TestCog(commands.Cog, name="Test commands."): ) await cycle.term_start_action() 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) From 1305e15edf5841656caff01a2d046a69858011c4 Mon Sep 17 00:00:00 2001 From: imcompiling Date: Sat, 14 Dec 2024 18:36:47 -0500 Subject: [PATCH 2/2] Change cutoff months for rollover. --- utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index e63846b..80cac9b 100644 --- a/utils.py +++ b/utils.py @@ -48,10 +48,10 @@ def get_datetime(day: str) -> datetime: day = int(day.split("/")[1]) # 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 - if today.month == calendar.JANUARY and month > calendar.JANUARY: + if today.month == calendar.JANUARY and month > calendar.MARCH: year -= 1 return datetime(year, month, day, tzinfo=UTC)