diff --git a/web/pw-server/src/routes/bots/[bot_name].svelte b/web/pw-server/src/routes/bots/[bot_name]/index.svelte similarity index 93% rename from web/pw-server/src/routes/bots/[bot_name].svelte rename to web/pw-server/src/routes/bots/[bot_name]/index.svelte index 58e89ad..6e93834 100644 --- a/web/pw-server/src/routes/bots/[bot_name].svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/index.svelte @@ -5,8 +5,10 @@ const apiClient = new ApiClient(fetch); try { - const [botData, matchesPage] = await Promise.all([ - apiClient.get(`/api/bots/${params["bot_name"]}`), + const bot_name = params["bot_name"]; + const [botData, botStats, matchesPage] = await Promise.all([ + apiClient.get(`/api/bots/${bot_name}`), + apiClient.get(`/api/bots/${bot_name}/stats`), apiClient.get("/api/matches", { bot: params["bot_name"], count: "20" }), ]); @@ -19,6 +21,7 @@ bot, owner, versions, + botStats, matches: matchesPage["matches"], }, }; @@ -41,7 +44,7 @@ export let owner: object; export let versions: object[]; export let matches: object[]; - + export let botStats: object; // function last_updated() { // versions.sort() // } diff --git a/web/pw-server/src/routes/bots/[bot_name]/stats.svelte b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte new file mode 100644 index 0000000..6b5a2e1 --- /dev/null +++ b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte @@ -0,0 +1,169 @@ + + + + +
Rank | +Rating | +Bot | +Author | +Winrate | +Matches | +||
---|---|---|---|---|---|---|---|
{index + 1} | ++ {entry["rating"].toFixed(0)} + | ++ {entry["bot"]["name"]} + | ++ {#if entry["author"]} + + {entry["author"]["username"]} + {/if} + | + {#if mergedStats[entry["bot"]["name"]]} ++ {winRate(mergedStats[entry["bot"]["name"]]).toFixed(2)} + | ++ view matches + | + {:else} ++ | no matches yet | {/if} +