From 55c8ce6e9d03161ed62210e49c2f659209acd263 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Tue, 1 Nov 2022 01:36:41 -0500 Subject: [PATCH] leaderboard: set value func in all cases --- files/classes/leaderboard.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/files/classes/leaderboard.py b/files/classes/leaderboard.py index 46140b710..ad762db23 100644 --- a/files/classes/leaderboard.py +++ b/files/classes/leaderboard.py @@ -32,12 +32,11 @@ class Leaderboard: self.all_users = lb[0] self.v_position = lb[1] self.v_value = lb[2] - if self.v_value is None: - if value_func: - self.value_func = value_func - self.v_value = value_func(v) - else: - self.value_func = lambda u: u[1] or 0 + if value_func: + self.value_func = value_func + self.v_value = value_func(v) + else: + 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):