forked from MarseyWorld/MarseyWorld
leaderboards: show user as last row if not in lb
parent
3aac8f1f24
commit
efd63b8666
|
@ -37,7 +37,7 @@ class Leaderboard:
|
||||||
self.value_func = value_func
|
self.value_func = value_func
|
||||||
self.v_value = value_func(v)
|
self.v_value = value_func(v)
|
||||||
else:
|
else:
|
||||||
self.value_func = lambda u: u[1]
|
self.value_func = lambda u: u[1] or 0
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_simple_lb(cls, order_by, v:User, db:scoped_session, users, limit:int):
|
def get_simple_lb(cls, order_by, v:User, db:scoped_session, users, limit:int):
|
||||||
|
|
|
@ -39,10 +39,11 @@
|
||||||
{% for user in lb.all_users %}
|
{% for user in lb.all_users %}
|
||||||
{% if v.id == user.id %}
|
{% if v.id == user.id %}
|
||||||
{% set style="class=\"self\"" %}
|
{% set style="class=\"self\"" %}
|
||||||
|
{% set has_seen_v=true %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{format_user_in_table(user, style, loop.index, lb.value_func(user))}}
|
{{format_user_in_table(user, style, loop.index, lb.value_func(user))}}
|
||||||
{% endfor %}
|
{% 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)}}
|
{{format_user_in_table(v, "style=\"border-top:2px solid var(--primary)\"", lb.v_position, lb.v_value)}}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue