diff --git a/StorrageBackend.py b/StorrageBackend.py index 2828757..33f1d98 100644 --- a/StorrageBackend.py +++ b/StorrageBackend.py @@ -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" diff --git a/httpAPI.py b/httpAPI.py index 2230513..36c4e35 100644 --- a/httpAPI.py +++ b/httpAPI.py @@ -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)