Skip to content

Commit

Permalink
Update ban script for playerid
Browse files Browse the repository at this point in the history
Update the ban script to handle playerids.

Fixes: d9a4651 ("Migrate steamid64 to playerid")
Signed-off-by: Sean Anderson <[email protected]>
  • Loading branch information
Forty-Bot committed Feb 23, 2024
1 parent 13b6397 commit 1aede63
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions trends/ban.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright (C) 2022 Sean Anderson <[email protected]>
# Copyright (C) 2022, 24 Sean Anderson <[email protected]>

import logging
import sys
Expand All @@ -15,7 +15,10 @@ def ban_player(steamid, reason, database):
cur.execute("BEGIN;")
cur.execute("UPDATE player SET banned = TRUE, ban_reason = %s WHERE steamid64 = %s",
(reason, steamid))
cur.execute("CREATE TEMP TABLE to_delete AS SELECT logid FROM log WHERE uploader = %s;",
cur.execute("""CREATE TEMP TABLE to_delete AS SELECT
logid
FROM log
WHERE uploader = (SELECT playerid FROM player WHERE steamid64 = %s);""",
(steamid,))
delete_logs(cur)
cur.execute("COMMIT;")
Expand Down

0 comments on commit 1aede63

Please sign in to comment.