From efd63b8666620ba11fc2f313f93d2bb8a5eb43a8 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Fri, 28 Oct 2022 04:38:52 -0500 Subject: [PATCH] leaderboards: show user as last row if not in lb --- files/classes/leaderboard.py | 2 +- files/templates/leaderboard.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/files/classes/leaderboard.py b/files/classes/leaderboard.py index 29331b610..b7fe8933a 100644 --- a/files/classes/leaderboard.py +++ b/files/classes/leaderboard.py @@ -37,7 +37,7 @@ class Leaderboard: self.value_func = value_func self.v_value = value_func(v) else: - self.value_func = lambda u: u[1] + self.value_func = lambda u: u[1] or 0 @classmethod def get_simple_lb(cls, order_by, v:User, db:scoped_session, users, limit:int): diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index faeb84a2a..255193182 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -39,10 +39,11 @@ {% for user in lb.all_users %} {% if v.id == user.id %} {% set style="class=\"self\"" %} + {% set has_seen_v=true %} {% endif %} {{format_user_in_table(user, style, loop.index, lb.value_func(user))}} {% endfor %} - {% if position %} + {% if position or not has_seen_v %} {{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", lb.v_position, lb.v_value)}} {% endif %}