Browse Source

Fix seeding infos

Lertsenem 1 year ago
parent
commit
c5e2e062b8
2 changed files with 10 additions and 1 deletions
  1. 6 0
      lokrez/__init__.py
  2. 4 1
      lokrez/smashgg.py

+ 6 - 0
lokrez/__init__.py

@@ -874,10 +874,16 @@ def getTournamentTop(
874 874
     for standing in standings :
875 875
 
876 876
         seeding = None
877
+        seeding32 = None
877 878
         for seed in standing["entrant"]["seeds"]:
878 879
             # Take the seeding from the phase with *all* Event entrants
879 880
             if seed["phase"]["numSeeds"] == tournament.numEntrants:
880 881
                 seeding = seed["groupSeedNum"]
882
+            if seed["phase"]["numSeeds"] == 32:
883
+                seeding32 = seed["groupSeedNum"]
884
+        if seeding is None:
885
+            log.info("no global seeding found, using top 32 seeding")
886
+            seeding = seeding32
881 887
 
882 888
         participant_data = standing["entrant"]["participants"][0]
883 889
 

+ 4 - 1
lokrez/smashgg.py

@@ -46,7 +46,10 @@ class Player():
46 46
         self.prefix        = ( "" if prefix is None else prefix )
47 47
         self.gamerTag      = gamerTag
48 48
         self.placement     = int(placement)
49
-        self.seeding       = int(seeding)
49
+        try:
50
+            self.seeding   = int(seeding)
51
+        except:
52
+            self.seeding   = 0
50 53
         self.twitterHandle = ( "" if twitterHandle is None else twitterHandle )
51 54
 
52 55
         try: