Compare commits

..

2 Commits

Author SHA1 Message Date
84791e6b91 (channel): Add basic logging to event 2025-10-30 22:24:12 +10:00
7a9a47f11f fix: More typos in raw data query 2025-10-30 22:23:49 +10:00
2 changed files with 14 additions and 9 deletions

View File

@@ -1,4 +1,5 @@
from typing import Optional, TypeAlias, TypedDict from typing import Optional, TypeAlias, TypedDict
import json
from collections import defaultdict from collections import defaultdict
from datetime import datetime, timedelta from datetime import datetime, timedelta
@@ -255,3 +256,7 @@ class TimerChannel(Channel):
}, },
websocket=ws, websocket=ws,
) )
async def send_event(self, event, **kwargs):
logger.info(f"Sending websocket event: {json.dumps(event, indent=1)}")
await super().send_event(event, **kwargs)

View File

@@ -161,7 +161,7 @@ class ActiveSubathon:
result = await ( result = await (
SubathonContribution.table.select_where( SubathonContribution.table.select_where(
subathoid=self.subathondata.subathon_id subathon_id=self.subathondata.subathon_id
) )
.join( .join(
"subscribe_events", "subscribe_events",
@@ -172,11 +172,11 @@ class ActiveSubathon:
.with_no_adapter() .with_no_adapter()
) )
total_points += result["total"] total_points += result[0]["total"] or 0
result = await ( result = await (
SubathonContribution.table.select_where( SubathonContribution.table.select_where(
subathoid=self.subathondata.subathon_id subathon_id=self.subathondata.subathon_id
) )
.join( .join(
"subscribe_message_events", "subscribe_message_events",
@@ -187,14 +187,14 @@ class ActiveSubathon:
.with_no_adapter() .with_no_adapter()
) )
total_points += result["total"] total_points += result[0]["total"] or 0
result = await ( result = await (
SubathonContribution.table.select_where( SubathonContribution.table.select_where(
subathoid=self.subathondata.subathon_id subathon_id=self.subathondata.subathon_id
) )
.join( .join(
"subscribe_gift_events", "gift_events",
using=("event_id",), using=("event_id",),
join_type=JOINTYPE.INNER, join_type=JOINTYPE.INNER,
) )
@@ -202,7 +202,7 @@ class ActiveSubathon:
.with_no_adapter() .with_no_adapter()
) )
total_points += result["total"] total_points += result[0]["total"] or 0
return total_points return total_points
@@ -213,7 +213,7 @@ class ActiveSubathon:
""" """
result = await ( result = await (
SubathonContribution.table.select_where( SubathonContribution.table.select_where(
subathoid=self.subathondata.subathon_id subathon_id=self.subathondata.subathon_id
) )
.join( .join(
"bits_events", "bits_events",
@@ -223,7 +223,7 @@ class ActiveSubathon:
.select(total="SUM(bits)") .select(total="SUM(bits)")
.with_no_adapter() .with_no_adapter()
) )
return result["total"] return result[0]["total"] or 0
class SubathonRegistry: class SubathonRegistry: