Variable name changes for clarification and fixing runtime issues.
This commit is contained in:
+8
-10
@@ -83,17 +83,15 @@ def autofill_groups(guild_id: int, group_begin: str) -> dict:
|
||||
return groups
|
||||
|
||||
|
||||
def autofill_users_in_group_category(
|
||||
guild_id: int, group_name: str, category_name: str, user_begin: str
|
||||
) -> "list[str]":
|
||||
def autofill_users_in_group_category(guild_id: int, group_id: int, category_id: int, user_begin: str) -> "list[str]":
|
||||
"""
|
||||
Returns list of users that match user_begin. Either all users in group or just users in category if category is
|
||||
not None. Might be expensive due to unioning all users in group.
|
||||
|
||||
Args:
|
||||
guild_id (int): Guild id corresponding to group and category.
|
||||
group_name (str): group to look in for category.
|
||||
category_name (str): Category to look in for users. Can be None if not looking for category.
|
||||
group_id (str): group to look in for category.
|
||||
category_id (str): Category to look in for users. Can be None if not looking for category.
|
||||
user_begin (str): Beginning of user name to search with. Can be empty.
|
||||
|
||||
Returns:
|
||||
@@ -104,22 +102,22 @@ def autofill_users_in_group_category(
|
||||
subq = (
|
||||
select(CategoryGroup)
|
||||
.where(CategoryGroup.GuildId == guild_id)
|
||||
.where(CategoryGroup.GroupName == group_name)
|
||||
.where(CategoryGroup.GroupId == group_id)
|
||||
.subquery()
|
||||
)
|
||||
category_group = aliased(CategoryGroup, subq)
|
||||
|
||||
# If no category name, get all users in group.
|
||||
if category_name is None:
|
||||
# If no category id, get all users in group.
|
||||
if category_id == 0:
|
||||
subq = select(Category.CategoryId).where(Category.GroupId == category_group.GroupId).subquery()
|
||||
stmt = select(distinct(Score.UserName)).where(Score.CategoryId.in_(subq))
|
||||
|
||||
else:
|
||||
# get all users in category_name
|
||||
# get all users in category_id
|
||||
subq = (
|
||||
select(Category)
|
||||
.where(Category.GroupId == category_group.GroupId)
|
||||
.where(Category.CategoryName == category_name)
|
||||
.where(Category.CategoryId == category_id)
|
||||
.subquery()
|
||||
)
|
||||
category = aliased(Category, subq)
|
||||
|
||||
Reference in New Issue
Block a user