From 78e172fb9d7f3493605a851a4f5f49c0f34d42e3 Mon Sep 17 00:00:00 2001 From: Ant Zucaro Date: Thu, 27 Sep 2012 22:38:42 -0400 Subject: [PATCH] Determine overall best rank by percentile, not the rank value. --- xonstat/views/player.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.2