diff --git a/ranked/templates/ranked/leaderboard.html b/ranked/templates/ranked/leaderboard.html index 15aae40..3571a84 100644 --- a/ranked/templates/ranked/leaderboard.html +++ b/ranked/templates/ranked/leaderboard.html @@ -1,5 +1,5 @@ -{% extends 'home/base.html' %} -{% block content %} +{% extends 'home/base.html' %} +{% block content %} {% load rank_filter %}
@@ -10,7 +10,10 @@

- +
@@ -28,19 +31,21 @@

{% for player in players %} - + - {% mmr_to_rank player.mmr highest_mmr lowest_mmr as rank rank_color %} - - + {% mmr_to_rank player.mmr highest_mmr lowest_mmr as rank %} + + - - - + + + {% endfor %} diff --git a/ranked/templatetags/rank_filter.py b/ranked/templatetags/rank_filter.py index b2f3e68..e1037c0 100644 --- a/ranked/templatetags/rank_filter.py +++ b/ranked/templatetags/rank_filter.py @@ -5,11 +5,11 @@ @register.simple_tag def mmr_to_rank(mmr, highest_mmr, lowest_mmr): if highest_mmr == lowest_mmr: - return 'Stone', '#ffffff' # All players have the same MMR, edge case + return 'Stone', '#ffffff' # Calculate the percentile percentile = (highest_mmr - mmr) / (highest_mmr - lowest_mmr) - + # Determine rank based on percentile if percentile <= 0.1: return 'Challenger', '#ffffff'
#
{{ forloop.counter }}{{forloop.counter}} - {{ player.player }} + {{player.player}} {{ player.elo|floatformat:1 }} {{ player.mmr|floatformat:1 }}{{ rank }} ({{ rank_color }}){{ player.matches_played }}{{ rank }}{{player.matches_played}} {{ player.win_rate|floatformat:2 }}%{{ player.matches_won }}{{ player.matches_lost }}{{ player.matches_drawn }}{{player.matches_won}}{{player.matches_lost}}{{player.matches_drawn}}