fix: leaderboard query

This commit is contained in:
2025-09-02 21:34:54 +10:00
parent b10098d28f
commit 27103366aa

View File

@@ -552,10 +552,11 @@ class SubathonComponent(cmds.Component):
if (active := await self.get_active_subathon(cid)) is not None: if (active := await self.get_active_subathon(cid)) is not None:
# Get totals for all contributors # Get totals for all contributors
query = self.data.subathon_contributions.select_where(subathonid=active.subathondata.subathon_id) query = self.data.subathon_contributions.select_where(subathon_id=active.subathondata.subathon_id)
query.join('user_profiles', using=('profileid',)) query.join('user_profiles', using=('profileid',))
query.select('profileid', total="SUM(score)") query.select('subathon_id', 'profileid', total="SUM(score)")
query.order_by('total', direction=ORDER.DESC) query.order_by('total', direction=ORDER.DESC)
query.group_by('subathon_id', 'profileid')
query.with_no_adapter() query.with_no_adapter()
results = await query results = await query