Remove subqueries when sending to IN call.
This commit is contained in:
+3
-3
@@ -109,7 +109,7 @@ def autofill_users_in_group_category(guild_id: int, group_id: int, category_id:
|
||||
|
||||
# If no category id, get all users in group.
|
||||
if category_id == 0:
|
||||
subq = select(Category.CategoryId).where(Category.GroupId == category_group.GroupId).subquery()
|
||||
subq = select(Category.CategoryId).where(Category.GroupId == category_group.GroupId)
|
||||
stmt = select(distinct(Score.UserName)).where(Score.CategoryId.in_(subq))
|
||||
|
||||
else:
|
||||
@@ -146,8 +146,8 @@ def autofill_users_in_guild(guild_id: int, user_begin: str) -> "list[str]":
|
||||
Returns:
|
||||
list[str]: All users with submissions in the guild.
|
||||
"""
|
||||
group_ids = select(CategoryGroup.GroupId).where(CategoryGroup.GuildId == guild_id).subquery()
|
||||
category_ids = select(Category.CategoryId).where(Category.GroupId.in_(group_ids)).subquery()
|
||||
group_ids = select(CategoryGroup.GroupId).where(CategoryGroup.GuildId == guild_id)
|
||||
category_ids = select(Category.CategoryId).where(Category.GroupId.in_(group_ids))
|
||||
stmt = select(distinct(Score.UserName)).where(Score.CategoryId.in_(category_ids))
|
||||
users_list: "list[str]" = list(session.scalars(stmt))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user