mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-06 14:51:36 +01:00
improve filter for displayed players in ranking
This commit is contained in:
@@ -56,7 +56,7 @@ def sync_to_database(players, win):
|
|||||||
##################### Handle Rank Cache #####################
|
##################### Handle Rank Cache #####################
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
def updatePlayerRanks(force=False):
|
def updatePlayerRanks(force=False, minGames=10, maxInactivityDays=60):
|
||||||
global last_rank_update
|
global last_rank_update
|
||||||
global player_ranks
|
global player_ranks
|
||||||
global playerRankList
|
global playerRankList
|
||||||
@@ -65,7 +65,8 @@ def updatePlayerRanks(force=False):
|
|||||||
last_rank_update = datetime.now()
|
last_rank_update = datetime.now()
|
||||||
s = sorted(known_players.values(), key=lambda x: TS.getEnviroment().expose(x.rating),reverse=True)
|
s = sorted(known_players.values(), key=lambda x: TS.getEnviroment().expose(x.rating),reverse=True)
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
s = list(filter(lambda p: now - p.lastUpdate < timedelta(days=60), s))
|
s = list(filter(lambda p: now - p.lastUpdate < timedelta(days=maxInactivityDays) \
|
||||||
|
and p.games >= minGames, s))
|
||||||
rank = 1
|
rank = 1
|
||||||
for p in s:
|
for p in s:
|
||||||
if p in player_ranks:
|
if p in player_ranks:
|
||||||
|
|||||||
Reference in New Issue
Block a user