]> git.rm.cloudns.org Git - xonotic/xonstat.git/commitdiff
Determine overall best rank by percentile, not the rank value.
authorAnt Zucaro <azucaro@gmail.com>
Fri, 28 Sep 2012 02:38:42 +0000 (22:38 -0400)
committerAnt Zucaro <azucaro@gmail.com>
Fri, 28 Sep 2012 02:38:42 +0000 (22:38 -0400)
xonstat/views/player.py

index 87a14cf34da5d63aefa682bf10e71a1532c57d1e..0c4ce59bcfcfee888b6126dbe49722bdb7b8cd0d 100644 (file)
@@ -346,10 +346,14 @@ def get_ranks(player_id):
         rank = Rank(rank=row.rank,
             max_rank=row.max_rank,
             game_type_cd=row.game_type_cd)
-        
+
+        percentile = float(row.rank)/row.max_rank
+
         if not found_top_rank:
             ranks['overall'] = rank
             found_top_rank = True
+        elif percentile < float(ranks['overall'].rank)/ranks['overall'].max_rank:
+            ranks['overall'] = rank
 
         ranks[row.game_type_cd] = rank