Only delete specified user. cat_name is already the string.
This commit is contained in:
@@ -113,10 +113,10 @@ class DataManagementCog(commands.Cog, name="Table Management"):
|
||||
stmt = select(Category.CategoryName).where(Category.CategoryId == int(category_id))
|
||||
category_name = session.scalar(stmt)
|
||||
|
||||
stmt = select(Score).where(Score.CategoryId == int(category_id))
|
||||
stmt = select(Score).where(Score.CategoryId == int(category_id)).where(Score.UserName == user_name)
|
||||
|
||||
for score in session.scalars(stmt):
|
||||
session.delete(score)
|
||||
# there should only be one because category id and username are a composite primary key in score
|
||||
session.delete(session.scalar(stmt))
|
||||
session.commit()
|
||||
|
||||
await send_highscore_message(interaction.guild.get_channel(group.ChannelId), group)
|
||||
|
||||
+1
-3
@@ -48,9 +48,7 @@ def autofill_categories(guild_id: int, group_id: int, category_begin: str) -> "d
|
||||
# else find all categories that start with category_begin
|
||||
# TODO is it better to have sql handle the starts with or python?
|
||||
categories: dict = {
|
||||
cat_name: cat_id
|
||||
for cat_name, cat_id in categories_dict.items()
|
||||
if category_begin.lower() in cat_name.CategoryName.lower()
|
||||
cat_name: cat_id for cat_name, cat_id in categories_dict.items() if category_begin.lower() in cat_name.lower()
|
||||
}
|
||||
return categories
|
||||
|
||||
|
||||
Reference in New Issue
Block a user