only show last 5000 games

This commit is contained in:
fk 2024-10-11 11:51:55 +02:00
parent 9cc0767c3e
commit c8d1261f5d
Signed by: fk
SSH key fingerprint: SHA256:KQRtpoT/zoUtKcHNokD4N151te4gRMvc/3RHpxNd+Pk
2 changed files with 5 additions and 4 deletions

View file

@ -11,7 +11,7 @@ users = {
} }
def get_game_data(): def get_game_data():
res = requests.get("https://botbattle.be/api/games") res = requests.get("https://botbattle.be/api/games?num=5000")
return sorted(res.json(), key=lambda x: x['gid']) return sorted(res.json(), key=lambda x: x['gid'])
def get_data(): def get_data():
@ -47,7 +47,8 @@ def process_game_data(game_data):
'bots': bots, 'bots': bots,
'min_elo': min_elo, 'min_elo': min_elo,
'max_elo': max_elo, 'max_elo': max_elo,
'game': game_data[-1]['gid'], 'min_game': game_data[0]['gid'],
'max_game': game_data[-1]['gid'],
} }
def filter_date(data): def filter_date(data):

View file

@ -99,9 +99,9 @@
ctx.lineWidth = 4 ctx.lineWidth = 4
ctx.strokeStyle = bot.color_ring ctx.strokeStyle = bot.color_ring
ctx.beginPath() ctx.beginPath()
ctx.moveTo(getX(width, margin, 0, graph_data.game, bot.x[0]), getY(height, margin, graph_data.min_elo, graph_data.max_elo, bot.y[0])) ctx.moveTo(getX(width, margin, graph_data.min_game, graph_data.max_game, bot.x[0]), getY(height, margin, graph_data.min_elo, graph_data.max_elo, bot.y[0]))
for (let i = 1; i < bot.x.length; i++) { for (let i = 1; i < bot.x.length; i++) {
ctx.lineTo(getX(width, margin, 0, graph_data.game, bot.x[i]), getY(height, margin, graph_data.min_elo, graph_data.max_elo, bot.y[i])) ctx.lineTo(getX(width, margin, graph_data.min_game, graph_data.max_game, bot.x[i]), getY(height, margin, graph_data.min_elo, graph_data.max_elo, bot.y[i]))
} }
ctx.stroke() ctx.stroke()
} }