Skip to content

Commit

Permalink
Add check for TBD status before summoning
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBottone committed May 17, 2023
1 parent f43881a commit 1d45e96
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/googleSheet.ts
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ export async function getSoonestUnplayedMatch(
const rows = await matchesSheet.getRows();

const row = rows.find((r) => !r["Red Score"] && !r["Blue Score"]);
if (!row) {
if (!row || row["Red 1"] === "TBD" || row["Blue 1"] === "TBD") {
return { row: null, matchNumber: null };
}
const matchNumber = row["Match Number"] as number;
@@ -155,7 +155,10 @@ export async function getSoonestUnplayedMatch(
(r) =>
!r["Red Score"] && !r["Blue Score"] && r["Match Number"] != matchNumber
);
const secondMatchNumber = secondRow ? secondRow["Match Number"] : null;
const secondMatchNumber =
!secondRow || secondRow["Red 1"] === "TBD" || secondRow["Blue 1"] === "TBD"
? null
: (secondRow["Match Number"] as number);

return { row, matchNumber, secondMatchNumber };
}

0 comments on commit 1d45e96

Please sign in to comment.