mirror of
https://github.com/FAUSheppy/skillbird
synced 2025-12-06 06:51:34 +01:00
add haschange api endpoint
This commit is contained in:
@@ -49,6 +49,7 @@ def sync_to_database(players, win):
|
||||
known_players[p].wins += 1
|
||||
known_players[p].games += 1
|
||||
known_players[p].lastUpdate = datetime.now()
|
||||
|
||||
updatePlayerRanks()
|
||||
|
||||
#############################################################
|
||||
@@ -193,3 +194,10 @@ def getRankRange(start, end, revalidateRanks=False):
|
||||
if start > len(playerRankList) or start >= end:
|
||||
return []
|
||||
return playerRankList[start:end]
|
||||
|
||||
def hasChanged(time):
|
||||
'''Indicates to a http-querier if the availiable data has changed'''
|
||||
if last_rank_update > time:
|
||||
return "True"
|
||||
else:
|
||||
return "False"
|
||||
|
||||
@@ -37,3 +37,9 @@ def findPlayer():
|
||||
string = flask.request.args.get("string")
|
||||
players = SB.findPlayer(string)
|
||||
return "|".join([pt[0].serialize() + "," + str(pt[1]) for pt in players])
|
||||
|
||||
@app.route('/haschanged')
|
||||
def hasChanged():
|
||||
string = flask.request.args.get("time")
|
||||
# TODO get time with timezone
|
||||
return SB.hasChanged(localizedTime)
|
||||
|
||||
Reference in New Issue
Block a user