fix (stats): Fix global guild goal fetch.

This commit is contained in:
2023-03-12 14:59:49 +02:00
parent 54538aa57e
commit 2657580d6f
2 changed files with 8 additions and 9 deletions

View File

@@ -15,12 +15,11 @@ async def get_goals_card(
):
data: StatsData = bot.get_cog('StatsCog').data
lion = await bot.core.lions.fetch_member(guildid or 0, userid)
luser = lion.luser
if guildid:
lion = await bot.core.lions.fetch_member(guildid, userid)
user = await lion.fetch_member()
luser = lion.luser
else:
lion = luser = await bot.core.lions.fetch_user(userid)
user = await bot.fetch_user(userid)
today = lion.today
@@ -42,7 +41,7 @@ async def get_goals_card(
key = {'guildid': guildid or 0, 'userid': userid, 'monthid': periodid}
# Extract goals and tasks
goals = await goal_model.fetch_or_create(*key.values())
goals = await goal_model.fetch(*key.values())
task_rows = await tasks_model.fetch_where(**key)
tasks = [(i, row.content, bool(row.completed)) for i, row in enumerate(task_rows)]