fix: Fix minor statistics bugs
This commit is contained in:
@@ -87,7 +87,7 @@ async def get_goals_card(
|
||||
# Get member profile
|
||||
if user:
|
||||
username = (user.display_name, user.discriminator)
|
||||
avatar = user.avatar.key
|
||||
avatar = user.avatar.key if user.avatar else user.default_avatar.key
|
||||
else:
|
||||
username = (lion.data.display_name, '#????')
|
||||
avatar = luser.data.avatar_hash
|
||||
|
||||
@@ -390,6 +390,14 @@ class StatisticsConfigUI(ConfigUI):
|
||||
embed.add_field(**setting.embed_field, inline=False)
|
||||
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):
|
||||
section_name = _p(
|
||||
|
||||
@@ -473,7 +473,7 @@ class WeeklyMonthlyUI(StatsUI):
|
||||
# Update the tasklist
|
||||
if len(new_tasks) != len(tasks) or not all(t == new_t for (t, new_t) in zip(tasks, new_tasks)):
|
||||
modified = True
|
||||
async with self._connector.connection() as conn:
|
||||
async with self.bot.db.connection() as conn:
|
||||
async with conn.transaction():
|
||||
await tasks_model.table.delete_where(**key).with_connection(conn)
|
||||
if new_tasks:
|
||||
|
||||
@@ -250,7 +250,7 @@ class TextTrackerData(Registry):
|
||||
query,
|
||||
tuple(chain((userid, guildid), *blocks))
|
||||
)
|
||||
return [r['period_m'] or 0 for r in await cursor.fetchall()]
|
||||
return [r['period_m'] or 0 for r in await cursor.fetchall()]
|
||||
|
||||
@classmethod
|
||||
@log_wrap(action='member_messages_since')
|
||||
|
||||
Reference in New Issue
Block a user