diff --git a/files/classes/leaderboard.py b/files/classes/leaderboard.py index 055baccb5..87142f351 100644 --- a/files/classes/leaderboard.py +++ b/files/classes/leaderboard.py @@ -17,6 +17,7 @@ class Leaderboard: all_users = None v_position = 0 v_value = None + v_appears_in_ranking = False user_func = None value_func = None @@ -33,6 +34,7 @@ class Leaderboard: self.all_users = lb[0] self.v_position = lb[1] self.v_value = lb[2] + self.v_appears_in_ranking = self.v_position <= limit if value_func: self.user_func = lambda u:u self.value_func = value_func diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 0186c7325..b8ea61be0 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -35,16 +35,14 @@
- {% set v_appears_in_ranking = false %} {% for user in lb.all_users %} {% set user2 = lb.user_func(user) %} {% if v.id == user2.id %} {% set style="class=\"self\"" %} - {% set v_appears_in_ranking = true %} {% endif %} {{format_user_in_table(user2, style, loop.index, lb.value_func(user), lb.user_relative_url)}} {% endfor %} - {% if lb.v_position and not v_appears_in_ranking %} + {% if lb.v_position and not lb.v_appears_in_ranking %} {{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", lb.v_position, lb.v_value, lb.user_relative_url)}} {% endif %}