Remove reference to boss_name. Fix a few smells.
This commit is contained in:
+6
-6
@@ -164,9 +164,12 @@ def autofill_users_in_guild(guild_id: int, user_begin: str) -> "list[str]":
|
||||
return users[:25]
|
||||
|
||||
|
||||
# TODO(imcompiling): #73 Address complexity warning.
|
||||
# 073
|
||||
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.
|
||||
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)]
|
||||
groups_df = d_f.groupby("CategoryId")
|
||||
|
||||
# TODO figure out how to have less nests.
|
||||
for category in categories:
|
||||
# category name string
|
||||
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"
|
||||
|
||||
# add extra newline at category split unless there is already a space.
|
||||
if ((ind + 1) % (max_cat_size + 1)) == 0:
|
||||
# checking inside the other if to ensure called as little as possible.
|
||||
if not ret_string.endswith("\n\n"):
|
||||
ret_string += "\n"
|
||||
if ((ind + 1) % (max_cat_size + 1)) == 0 and not ret_string.endswith("\n\n"):
|
||||
ret_string += "\n"
|
||||
|
||||
return ret_string + "```"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user