forked from Kelder/ceneka-bot-battle
only show last 5000 games
This commit is contained in:
parent
9cc0767c3e
commit
c8d1261f5d
2 changed files with 5 additions and 4 deletions
5
main.py
5
main.py
|
@ -11,7 +11,7 @@ users = {
|
|||
}
|
||||
|
||||
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'])
|
||||
|
||||
def get_data():
|
||||
|
@ -47,7 +47,8 @@ def process_game_data(game_data):
|
|||
'bots': bots,
|
||||
'min_elo': min_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):
|
||||
|
|
|
@ -99,9 +99,9 @@
|
|||
ctx.lineWidth = 4
|
||||
ctx.strokeStyle = bot.color_ring
|
||||
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++) {
|
||||
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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue