Clarify parameter name for users, correct id usage for autofills.

This commit is contained in:
alwayscompiling
2022-12-02 17:02:44 -05:00
parent bed07d440b
commit 52305c0107
4 changed files with 28 additions and 20 deletions
+3 -3
View File
@@ -16,14 +16,14 @@ from utilities.sql_alchemy_connection import Category, CategoryGroup, Guild, Sco
MAX_LINE_LENGTH = 142
def autofill_categories(guild_id: int, group_name: str, category_begin: str) -> "dict[str, str]":
def autofill_categories(guild_id: int, group_id: int, category_begin: str) -> "dict[str, str]":
"""
Returns all category names that start with category_begin.
If category_begin is empty, returns list of all category names.
Args:
guild_id (int): Guild id that holds the group and categories.
group_name (str): Group name to search in.
group_id (int): Group id to search in.
category_begin (str): The beginning of a category name to search with. Can be empty.
Returns:
@@ -34,7 +34,7 @@ def autofill_categories(guild_id: int, group_name: str, category_begin: str) ->
subq = (
select(CategoryGroup)
.where(CategoryGroup.GuildId == guild_id)
.where(CategoryGroup.GroupName == group_name)
.where(CategoryGroup.GroupId == group_id)
.subquery()
)
cat_group_alias = aliased(CategoryGroup, subq)