Skip to content

Commit

Permalink
Fixed issue getting teams
Browse files Browse the repository at this point in the history
  • Loading branch information
BenM-BenM committed Mar 8, 2024
1 parent af40479 commit 6d81294
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ function doGet() {

try {
const events = sheet.getSheetByName("Event Data");
const teams = sheet.getRangeByName("SetTeamNumberList")
const response = {
success: true,
matches: [],
Expand All @@ -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] != "");

Expand Down
20 changes: 14 additions & 6 deletions src/lib/components/AddForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -68,7 +68,11 @@
<input type="number" bind:value={match} class="rounded-md bg-background text-text border-2">
{:else}
<!--Non-manual stuff below-->
<div class="text-error">Please change to manual</div>
<select bind:value={match} class="rounded-md bg-background text-text border-2">
{#each Object.values($matches) as match}
<option value={match.number}>{match.number}</option>
{/each}
</select>
{/if}
{#if match == "" || match == null}
<div class="text-error">Need to choose a match</div>
Expand All @@ -81,7 +85,11 @@
<input type="number" bind:value={team} class="rounded-md bg-background text-text border-2">
{:else}
<!--Non-manual stuff below-->
<div class="text-error">Please change to manual</div>
<select bind:value={team} class="rounded-md bg-background text-text border-2">
{#each matchTeams as team}
<option value={team.number}>{team.number}</option>
{/each}
</select>
{/if}
{#if team == "" || team == null}
<div class="text-error">Need to choose a team</div>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type Response = {
match: number | null;
team: number;
scout: string;
alliance: "RED" | "BLUE";
alliance: "RED" | "BLUE" | "ERR";
};

export type Form = {
Expand Down

0 comments on commit 6d81294

Please sign in to comment.