From cc37b093a8907c41d18e2dd92310ca28a62a653f Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Thu, 20 Jun 2024 00:17:18 -0500 Subject: [PATCH] adding helper db script for extracting a range of replays for a given player --- gemp-lotr/db/extract-gameplay-replays.sql | 47 +++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 gemp-lotr/db/extract-gameplay-replays.sql diff --git a/gemp-lotr/db/extract-gameplay-replays.sql b/gemp-lotr/db/extract-gameplay-replays.sql new file mode 100644 index 000000000..27c1398f7 --- /dev/null +++ b/gemp-lotr/db/extract-gameplay-replays.sql @@ -0,0 +1,47 @@ + + +-- SELECT * +-- FROM game_history gh +-- WHERE tournament LIKE '%Yuletide%' +-- AND (winner = 'm_scarpato' OR loser = 'm_scarpato') +-- + +# Get IDs from the appropriate yuletide leagues: + +SELECT * +FROM league l +WHERE name LIKE '%Yuletide%' +ORDER BY id DESC; + + +# Stick those IDs in both of these clauses: + +SELECT player, count(*) AS matches +FROM ( + SELECT winner AS player, + CONCAT('[url=https://play.lotrtcgpc.net/gemp-lotr/game.html?replayId=', CONCAT(REPLACE(winner, '_', '%5F'), '$', win_recording_id), ']') AS ReplayURL + FROM league_match w + WHERE w.league_type IN ('1702871717631', '1702871696832', '1702871668557') + + UNION ALL + + SELECT loser AS player, + CONCAT('[url=https://play.lotrtcgpc.net/gemp-lotr/game.html?replayId=', CONCAT(REPLACE(loser, '_', '%5F'), '$', lose_recording_id), ']') AS ReplayURL + FROM league_match l + WHERE l.league_type IN ('1702871717631', '1702871696832', '1702871668557') +) players +GROUP BY players.player +ORDER BY COUNT(*) DESC; + + + + + + + + + + + + +