fix: Fix minor statistics bugs

This commit is contained in:
2023-08-24 14:40:32 +03:00
parent 9b2af56d64
commit 2e9b438a04
4 changed files with 11 additions and 3 deletions

View File

@@ -87,7 +87,7 @@ async def get_goals_card(
# Get member profile # Get member profile
if user: if user:
username = (user.display_name, user.discriminator) username = (user.display_name, user.discriminator)
avatar = user.avatar.key avatar = user.avatar.key if user.avatar else user.default_avatar.key
else: else:
username = (lion.data.display_name, '#????') username = (lion.data.display_name, '#????')
avatar = luser.data.avatar_hash avatar = luser.data.avatar_hash

View File

@@ -390,6 +390,14 @@ class StatisticsConfigUI(ConfigUI):
embed.add_field(**setting.embed_field, inline=False) embed.add_field(**setting.embed_field, inline=False)
return MessageArgs(embed=embed) return MessageArgs(embed=embed)
async def reload(self):
# Re-fetch data for each instance
# This should generally hit cache
self.instances = [
await setting.get(self.guildid)
for setting in self.setting_classes
]
class StatisticsDashboard(DashboardSection): class StatisticsDashboard(DashboardSection):
section_name = _p( section_name = _p(

View File

@@ -473,7 +473,7 @@ class WeeklyMonthlyUI(StatsUI):
# Update the tasklist # Update the tasklist
if len(new_tasks) != len(tasks) or not all(t == new_t for (t, new_t) in zip(tasks, new_tasks)): if len(new_tasks) != len(tasks) or not all(t == new_t for (t, new_t) in zip(tasks, new_tasks)):
modified = True modified = True
async with self._connector.connection() as conn: async with self.bot.db.connection() as conn:
async with conn.transaction(): async with conn.transaction():
await tasks_model.table.delete_where(**key).with_connection(conn) await tasks_model.table.delete_where(**key).with_connection(conn)
if new_tasks: if new_tasks: