Remove reference to boss_name. Fix a few smells.

This commit is contained in:
2025-02-20 17:13:19 -05:00
parent 9be9279239
commit 36dad683d8
+6 -6
View File
@@ -164,9 +164,12 @@ def autofill_users_in_guild(guild_id: int, user_begin: str) -> "list[str]":
return users[:25] return users[:25]
# TODO(imcompiling): #73 Address complexity warning.
# 073
def format_highscore_message(session: Session, group: CategoryGroup) -> str: def format_highscore_message(session: Session, group: CategoryGroup) -> str:
""" """
Creates a formatted string for a boss's highscore discord message. Creates a formatted string for a category's highscore discord message.
This formatted string is in discord's code block to ensure monospace text. This formatted string is in discord's code block to ensure monospace text.
Loops through each category to build the message one place at a time. Loops through each category to build the message one place at a time.
@@ -213,7 +216,6 @@ def format_highscore_message(session: Session, group: CategoryGroup) -> str:
str_list: list[str] = ["" for i in range(max_cat_size + 1)] str_list: list[str] = ["" for i in range(max_cat_size + 1)]
groups_df = d_f.groupby("CategoryId") groups_df = d_f.groupby("CategoryId")
# TODO figure out how to have less nests.
for category in categories: for category in categories:
# category name string # category name string
str_list[0] += f"{category.CategoryName}".ljust(pad_length, " ") str_list[0] += f"{category.CategoryName}".ljust(pad_length, " ")
@@ -269,10 +271,8 @@ def format_highscore_message(session: Session, group: CategoryGroup) -> str:
ret_string += string.rstrip() + "\n" ret_string += string.rstrip() + "\n"
# add extra newline at category split unless there is already a space. # add extra newline at category split unless there is already a space.
if ((ind + 1) % (max_cat_size + 1)) == 0: if ((ind + 1) % (max_cat_size + 1)) == 0 and not ret_string.endswith("\n\n"):
# checking inside the other if to ensure called as little as possible. ret_string += "\n"
if not ret_string.endswith("\n\n"):
ret_string += "\n"
return ret_string + "```" return ret_string + "```"