Compare commits

..
Author SHA1 Message Date
imcompiling 2596b9fa7b Merge branch '47-incorrect-election-cycle'
build_latest / build (push) Successful in 44s
build_release / build (push) Successful in 45s
2024-01-01 13:32:41 -05:00
imcompiling 8c654612a9 Ensure that rolback months are properly year-ed.
build_develop / build (push) Successful in 1m27s
2024-01-01 13:32:17 -05:00
imcompiling e836ead399 Force crash on no election cycle. -1 was causing last item in config array to be used.
build_develop / build (push) Successful in 1m38s
2024-01-01 13:23:29 -05:00
imcompiling fa691ced5d Space on the wrong side of the quote.
build_latest / build (push) Successful in 1m33s
build_release / build (push) Successful in 45s
2023-12-27 09:50:01 -05:00
imcompiling 81f4c7741b Merge branch '40-remove-presence'
build_latest / build (push) Successful in 1m29s
build_release / build (push) Successful in 45s
2023-12-23 14:48:23 -05:00
imcompiling ee7cbaf2f6 Merge branch '39-view-presences'
build_latest / build (push) Successful in 1m26s
2023-12-22 21:33:45 -05:00
imcompiling 7ba7d3563c Rework logic to use less loops.
build_develop / build (push) Successful in 1m28s
2023-12-22 21:33:34 -05:00
3 changed files with 14 additions and 11 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ class RequestCog(commands.Cog, name="Request Commands"):
"""
config: DakinyConfig = self.bot.config
content = f'<@{interaction.user.id}> would like to add presence" {presence}."'
content = f'<@{interaction.user.id}> would like to add presence "{presence}."'
view = PresenceChange(presence)
await self.bot.get_channel(config.params.admin_channel_id).send(
content=content, view=view
+8 -8
View File
@@ -54,16 +54,16 @@ class ViewCog(commands.Cog, name="View Commands"):
stmt = select(Presences.Presence)
presences = session.scalars(stmt)
message = ""
# have 2 loops so that the "if search" check isn't done repeatedly
if search:
for presence in presences:
if search.lower() in presence.lower():
message += f"{presence}\n"
message = "\n".join(
[
presence
for presence in presences
if search.lower() in presence.lower()
]
)
else:
for presence in presences:
message += f"{presence}\n"
message = "\n".join(list(presences))
await interaction.followup.send(content=message, ephemeral=True)
+5 -2
View File
@@ -31,6 +31,9 @@ def get_datetime(day: str) -> datetime:
if datetime.today().month == 12 and month < 12:
year += 1
if datetime.today().month == 1 and month > 1:
year -= 1
return datetime(year, month, day)
@@ -88,7 +91,7 @@ def get_current_cycle(config: DakinyConfig) -> int:
config (DakinyConfig): Config object to use
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()
@@ -100,7 +103,7 @@ def get_current_cycle(config: DakinyConfig) -> int:
):
return cycle
return -1
return None
def build_votes_str(config: DakinyConfig) -> str: