From: Ant Zucaro Date: Fri, 28 Sep 2012 02:38:42 +0000 (-0400) Subject: Determine overall best rank by percentile, not the rank value. X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=78e172fb9d7f3493605a851a4f5f49c0f34d42e3;p=xonotic%2Fxonstat.git Determine overall best rank by percentile, not the rank value. --- diff --git a/xonstat/views/player.py b/xonstat/views/player.py index 87a14cf..0c4ce59 100644 --- a/xonstat/views/player.py +++ b/xonstat/views/player.py @@ -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