From 60e9f900bd9776c0101f85c81b8e640fa32c7c2e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Fri, 28 Oct 2022 07:46:12 +0200 Subject: show matches that had errors on bot page --- .../src/routes/bots/[bot_name]/index.svelte | 54 +++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'web/pw-server/src/routes/bots') diff --git a/web/pw-server/src/routes/bots/[bot_name]/index.svelte b/web/pw-server/src/routes/bots/[bot_name]/index.svelte index 6e93834..37d9da9 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/index.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/index.svelte @@ -6,10 +6,11 @@ try { const bot_name = params["bot_name"]; - const [botData, botStats, matchesPage] = await Promise.all([ + const [botData, botStats, matchesPage, errorMatchesPage] = 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" }), + apiClient.get("/api/matches", { bot: params["bot_name"], count: "10", had_errors: true }), ]); const { bot, owner, versions } = botData; @@ -23,6 +24,7 @@ versions, botStats, matches: matchesPage["matches"], + errorMatches: errorMatchesPage["matches"], }, }; } catch (error) { @@ -44,31 +46,7 @@ export let owner: object; export let versions: object[]; export let matches: object[]; - export let botStats: object; - // function last_updated() { - // versions.sort() - // } - - // let files; - - // async function submitCode() { - // console.log("click"); - // const token = get_session_token(); - - // const formData = new FormData(); - // formData.append("File", files[0]); - - // const res = await fetch(`/api/bots/${bot["id"]}/upload`, { - // method: "POST", - // headers: { - // // the content type header will be set by the browser - // Authorization: `Bearer ${token}`, - // }, - // body: formData, - // }); - - // console.log(res.statusText); - // } + export let errorMatches: object[];