From 6d81294673b887c933115a619d6fa5e77681f6c4 Mon Sep 17 00:00:00 2001 From: Ben M Date: Fri, 8 Mar 2024 09:21:38 -0500 Subject: [PATCH] Fixed issue getting teams --- .github/workflows/build.yml | 2 +- server/server.js | 4 ++-- src/lib/components/AddForm.svelte | 20 ++++++++++++++------ src/lib/types.ts | 2 +- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0bb2fd..339ee02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: env: - PUBLIC_API_URL: https://script.google.com/macros/s/AKfycbwQw-IVNeW--6gx4eu0pIVUeXdSfuyeFnRRnrGEEWovze3aP-BI1W1g0qHpgHd8jRs6/exec + PUBLIC_API_URL: https://script.google.com/macros/s/AKfycbwx6McS3WuOtZ7E4sok6AgsQuVzxIaD8q85uxDsnHF_utx2ADbXl9vx4NQNDo6bpWDk3w/exec # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read diff --git a/server/server.js b/server/server.js index 17df241..1fdf6fe 100644 --- a/server/server.js +++ b/server/server.js @@ -28,6 +28,7 @@ function doGet() { try { const events = sheet.getSheetByName("Event Data"); + const teams = sheet.getRangeByName("SetTeamNumberList") const response = { success: true, matches: [], @@ -37,8 +38,7 @@ function doGet() { .getRange("B2:I1000") .getValues() .filter((lst) => lst[0] != ""); - response.teams = events - .getRange("A2:A1000") + response.teams = teams .getValues() .filter((lst) => lst[0] != ""); diff --git a/src/lib/components/AddForm.svelte b/src/lib/components/AddForm.svelte index 377db7b..8f5f75d 100644 --- a/src/lib/components/AddForm.svelte +++ b/src/lib/components/AddForm.svelte @@ -26,11 +26,11 @@ scout: $scout, team: parseInt(team), match: (formType.name == "Pit Scouting") ? null : parseInt(match), - alliance: $matches[parseInt(match)]?.red_alliance.includes( - parseInt(team) - ) + alliance: $matches[parseInt(match)]?.red_alliance.includes(parseInt(team)) ? "RED" - : "BLUE", + : ($matches[parseInt(match)]?.red_alliance.includes(parseInt(team)) + ? "BLUE" + : "ERR") }; $errors[id] = true; match = ""; @@ -68,7 +68,11 @@ {:else} -
Please change to manual
+ {/if} {#if match == "" || match == null}
Need to choose a match
@@ -81,7 +85,11 @@ {:else} -
Please change to manual
+ {/if} {#if team == "" || team == null}
Need to choose a team
diff --git a/src/lib/types.ts b/src/lib/types.ts index 9785ba8..e45e7dd 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -5,7 +5,7 @@ export type Response = { match: number | null; team: number; scout: string; - alliance: "RED" | "BLUE"; + alliance: "RED" | "BLUE" | "ERR"; }; export type Form = {