diff options
author | Tor Andersson <tor@ccxvii.net> | 2025-03-04 13:16:38 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2025-03-04 13:17:31 +0100 |
commit | 845cb682fa01c9d0ac86b51d15e5e50e69ba7b1c (patch) | |
tree | 060b93f0429b8cf44022f77b3428c9786e4ba0ee /tools/lift-bans.sh | |
parent | 69cda7a3a3ed4ccc111f6716dc8f87d051cc24ce (diff) | |
download | server-845cb682fa01c9d0ac86b51d15e5e50e69ba7b1c.tar.gz |
Script to lift tournament bans after time and games finished.
Diffstat (limited to 'tools/lift-bans.sh')
-rw-r--r-- | tools/lift-bans.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/lift-bans.sh b/tools/lift-bans.sh new file mode 100644 index 0000000..e76f621 --- /dev/null +++ b/tools/lift-bans.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +sqlite3 db <<EOF + +begin immediate; + +.mode column + +create temporary view tm_lift_ban_view as + select + user_id, + name, + date(timeout_last), + timeout_total, + games_since_timeout, + (games_since_timeout > timeout_total) and (julianday() > julianday(timeout_last)+14) as lift_ban + from + user_profile_view + where + user_id in (select user_id from tm_banned) + order by lift_ban desc, timeout_last asc +; + +select * from tm_lift_ban_view; + +delete from tm_banned where user_id in (select user_id from tm_lift_ban_view where lift_ban) returning user_id; + +commit; + +EOF |