Only the JSON `rankings` object has canonical ids, so use it
authorJacob Casper <dev@jacobcasper.com>
Mon, 9 Aug 2021 00:38:13 +0000 (19:38 -0500)
committerJacob Casper <dev@jacobcasper.com>
Mon, 9 Aug 2021 00:38:13 +0000 (19:38 -0500)
fightID->friendlyPlayerID? nope. rankedCharacters->canonicalID? None.

main.py

diff --git a/main.py b/main.py
index f2c7f90..372bd10 100755 (executable)
--- a/main.py
+++ b/main.py
@@ -53,27 +53,30 @@ params = {
         }
 result = client.execute(query, variable_values=params)
 encounter_ranks = [result['characterData']['character'][encounter_alias] for encounter_alias in encounter_aliases]
-ranks = [rank for encounter in encounter_ranks for rank in encounter['ranks']]
-pulls = [(rank['report']['code'], rank['report']['fightID']) for rank in ranks]
+reports = [rank['report']['code'] for encounter in encounter_ranks for rank in encounter['ranks']]
 query = gql(
         '''
-        query ($code: String!, $fightIds: [Int]!) {
+        query ($code: String!) {
           reportData {
             report (
               code: $code
             )
             {
               code
-              fights (
-                fightIDs: $fightIds
-              )
-              {
-                hasEcho
-                kill
-              }
+              rankings
             }
           }
         }
         '''
         )
-result = client.execute(query, variable_values={"code": pulls[0][0], "fightIds": pulls[0][1]})
+found_ids = {}
+for code in reports:
+    print(code)
+    result = client.execute(query, variable_values={"code": code})
+    for kill_rank in result['reportData']['report']['rankings']['data']:
+        tanks = kill_rank['roles']['tanks']['characters']
+        healers = kill_rank['roles']['healers']['characters']
+        dps = kill_rank['roles']['dps']['characters']
+        report_code = result['reportData']['report']['code']
+        pull = kill_rank['fightID']
+        found_ids[(report_code, pull)] = [char['id'] for char in tanks] + [char['id'] for char in healers] + [char['id'] for char in dps]