Skip to content

Commit c3e33f7

Browse files
committed
✨Fix !wl
1 parent e80c68b commit c3e33f7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/modules/public/dota_rp_flow/component.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -776,11 +776,7 @@ async def conclude_friend_match(self, friend: Friend) -> None:
776776
This nulls `Friend.active_match` attribute as well as adds the match into the database
777777
if it's a play match.
778778
"""
779-
if (
780-
(match := friend.active_match)
781-
and isinstance(match, PlayingMatch)
782-
and match.match_id
783-
):
779+
if (match := friend.active_match) and isinstance(match, PlayingMatch) and match.match_id:
784780
if match.live == LiveIndicator.Live:
785781
match.live = LiveIndicator.Pending
786782
query = """
@@ -1237,19 +1233,21 @@ async def party(self, ctx: IreContext) -> None:
12371233

12381234
async def score_response_helper(self, broadcaster_id: str, stream_started_at: datetime.datetime | None = None) -> str:
12391235
"""Helper function to get !wl commands response."""
1240-
clause = "AND m.start_time > $2" if stream_started_at else ""
1236+
clause = "AND m.start_time > $3" if stream_started_at else ""
12411237
query = f"""
12421238
SELECT d.friend_id, m.start_time, m.lobby_type, m.game_mode, m.outcome, p.player_slot, p.abandon
12431239
FROM ttv_dota_matches m
12441240
JOIN ttv_dota_match_players p ON m.match_id = p.match_id
12451241
JOIN ttv_dota_accounts d ON d.friend_id = p.friend_id
1246-
WHERE d.twitch_id = $1 {clause}
1242+
WHERE d.twitch_id = $1 AND m.live > $2 {clause}
12471243
ORDER BY m.start_time DESC;
12481244
"""
12491245
if stream_started_at:
1250-
rows: list[ScoreQueryRow] = await self.bot.pool.fetch(query, broadcaster_id, stream_started_at)
1246+
rows: list[ScoreQueryRow] = await self.bot.pool.fetch(
1247+
query, broadcaster_id, LiveIndicator.Live, stream_started_at
1248+
)
12511249
else:
1252-
rows: list[ScoreQueryRow] = await self.bot.pool.fetch(query, broadcaster_id)
1250+
rows: list[ScoreQueryRow] = await self.bot.pool.fetch(query, broadcaster_id, LiveIndicator.Live)
12531251

12541252
if not rows:
12551253
return "0 W - 0 L" if stream_started_at else "0 W - 0 L (No games played in the last 2 days)"

0 commit comments

Comments
 (0)