diff --git a/subathon/component.py b/subathon/component.py index 443521e..ab938f7 100644 --- a/subathon/component.py +++ b/subathon/component.py @@ -552,10 +552,11 @@ class SubathonComponent(cmds.Component): if (active := await self.get_active_subathon(cid)) is not None: # 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.select('profileid', total="SUM(score)") + query.select('subathon_id', 'profileid', total="SUM(score)") query.order_by('total', direction=ORDER.DESC) + query.group_by('subathon_id', 'profileid') query.with_no_adapter() results = await query