fix: Join type in lb query.

This commit is contained in:
2025-09-02 22:02:29 +10:00
parent 27103366aa
commit a5dd5ce6ad

View File

@@ -6,7 +6,7 @@ import twitchio
from twitchio import PartialUser, Scopes, eventsub
from twitchio.ext import commands as cmds
from data.queries import ORDER
from data.queries import JOINTYPE, ORDER
from meta import Bot, Context
from meta.sockets import Channel, register_channel
from utils.lib import utc_now, strfdelta
@@ -522,12 +522,13 @@ class SubathonComponent(cmds.Component):
name = None
pid = None
await active.add_contribution(pid, amount, None)
await self.channel.send_updates(cid)
# Build message
if amount > 0:
amountstr = f"Added {amount} point(s) to the timer"
elif amount < 0:
amountstr = f"Removed {amount} point(s) from the timer"
amountstr = f"Removed {-amount} point(s) from the timer"
else:
amountstr = "Did nothing to the timer"
@@ -553,7 +554,7 @@ 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(subathon_id=active.subathondata.subathon_id)
query.join('user_profiles', using=('profileid',))
query.join('user_profiles', using=('profileid',), join_type=JOINTYPE.LEFT)
query.select('subathon_id', 'profileid', total="SUM(score)")
query.order_by('total', direction=ORDER.DESC)
query.group_by('subathon_id', 'profileid')