diff --git a/frontend/src/pages/tournaments/[id]/dashboard/index.tsx b/frontend/src/pages/tournaments/[id]/dashboard/index.tsx index 1937e84e..0e109654 100644 --- a/frontend/src/pages/tournaments/[id]/dashboard/index.tsx +++ b/frontend/src/pages/tournaments/[id]/dashboard/index.tsx @@ -129,7 +129,8 @@ export function Schedule({ const matches: any[] = Object.values(matchesLookup); const sortedMatches = matches - .sort((m1: any, m2: any) => (m1.match.court.name > m2.match.court.name ? 1 : -1)) + .filter((m1: any) => m1.match.start_time != null) + .sort((m1: any, m2: any) => (m1.match.court?.name > m2.match.court?.name ? 1 : -1)) .sort((m1: any, m2: any) => (m1.match.start_time > m2.match.start_time ? 1 : -1)); const rows: React.JSX.Element[] = []; @@ -137,7 +138,7 @@ export function Schedule({ for (let c = 0; c < sortedMatches.length; c += 1) { const data = sortedMatches[c]; - if (c < 1 || (data.match.start_time && sortedMatches[c - 1].match.start_time)) { + if (c < 1 || sortedMatches[c - 1].match.start_time) { const startTime = formatTime(data.match.start_time); if (c < 1 || startTime !== formatTime(sortedMatches[c - 1].match.start_time)) { diff --git a/frontend/src/pages/tournaments/[id]/results.tsx b/frontend/src/pages/tournaments/[id]/results.tsx index f46504a5..25b89ae8 100644 --- a/frontend/src/pages/tournaments/[id]/results.tsx +++ b/frontend/src/pages/tournaments/[id]/results.tsx @@ -156,7 +156,8 @@ function Schedule({ const matches: any[] = Object.values(matchesLookup); const sortedMatches = matches - .sort((m1: any, m2: any) => (m1.match.court.name > m2.match.court.name ? 1 : -1)) + .filter((m1: any) => m1.match.start_time != null) + .sort((m1: any, m2: any) => (m1.match.court?.name > m2.match.court?.name ? 1 : -1)) .sort((m1: any, m2: any) => (m1.match.start_time > m2.match.start_time ? 1 : -1)); const rows: React.JSX.Element[] = []; @@ -164,7 +165,7 @@ function Schedule({ for (let c = 0; c < sortedMatches.length; c += 1) { const data = sortedMatches[c]; - if (c < 1 || (data.match.start_time && sortedMatches[c - 1].match.start_time)) { + if (c < 1 || (sortedMatches[c - 1].match.start_time)) { const startTime = formatTime(data.match.start_time); if (c < 1 || startTime !== formatTime(sortedMatches[c - 1].match.start_time)) {