mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-06 23:01:36 +01:00
implement request for playerlist length
This commit is contained in:
@@ -158,6 +158,14 @@ def quality(team1, team2, names1 = [""], names2 = [""]):
|
||||
|
||||
return string
|
||||
|
||||
def getRankListLength(revalidateRanks=True):
|
||||
global playerRankList
|
||||
|
||||
if revalidateRanks:
|
||||
updatePlayerRanks(revalidateRanks)
|
||||
|
||||
return len(playerRankList)
|
||||
|
||||
def getRankRange(start, end, revalidateRanks=True):
|
||||
'''Returns a list of player, optionally flushing the ranks-cache first'''
|
||||
global playerRankList
|
||||
|
||||
@@ -15,6 +15,10 @@ def _invalidParameters():
|
||||
def getPlayer():
|
||||
raise NotImplementedError()
|
||||
|
||||
@app.route('/getmaxentries')
|
||||
def getMaxEntries():
|
||||
return str(SB.getRankListLength())
|
||||
|
||||
@app.route('/rankrange')
|
||||
def getRankRange():
|
||||
try:
|
||||
@@ -26,8 +30,6 @@ def getRankRange():
|
||||
return invalidParameters()
|
||||
|
||||
players = SB.getRankRange(start, end)
|
||||
if type(players) == int:
|
||||
return "MAXENTRY:{}".format(players)
|
||||
return "\n".join([p.serialize() for p in players])
|
||||
|
||||
@app.route('/findplayer')
|
||||
|
||||
Reference in New Issue
Block a user