diff --git a/src/query/tournaments/analyzeTournament.ts b/src/query/tournaments/analyzeTournament.ts index cf25e996a7..772693b6a3 100644 --- a/src/query/tournaments/analyzeTournament.ts +++ b/src/query/tournaments/analyzeTournament.ts @@ -1,6 +1,8 @@ -import { analyzeDraws } from './analyzeDraws'; -import { checkIsDual } from './checkIsDual'; +import { getParticipants } from '@Query/participants/getParticipants'; +import { analyzeDraws } from '@Query/tournaments/analyzeDraws'; +import { checkIsDual } from '@Query/tournaments/checkIsDual'; +// constants import { MISSING_TOURNAMENT_RECORD } from '@Constants/errorConditionConstants'; import { SUCCESS } from '@Constants/resultConstants'; @@ -9,10 +11,15 @@ export function analyzeTournament({ tournamentRecord }) { const { drawsAnalysis } = analyzeDraws({ tournamentRecord }); - const analysis = { + const analysis: any = { isDual: checkIsDual(tournamentRecord), drawsAnalysis, }; + const participantResult = getParticipants({ tournamentRecord }); + if (participantResult.missingParticipantIds?.length) { + analysis.missingParticipantIds = participantResult.missingParticipantIds; + } + return { ...SUCCESS, analysis }; } diff --git a/src/query/tournaments/getTournamentInfo.ts b/src/query/tournaments/getTournamentInfo.ts index ca2396f791..a94d921345 100644 --- a/src/query/tournaments/getTournamentInfo.ts +++ b/src/query/tournaments/getTournamentInfo.ts @@ -62,12 +62,13 @@ export function getTournamentInfo(params?: { tournamentRecord: Tournament; usePu updatedAt, }))(tournamentRecord); - const tournamentContacts = getParticipants({ + const participantResult = getParticipants({ participantFilters: { participantRoles: [ADMINISTRATION, OFFICIAL, MEDIA, MEDICAL, SECURITY] }, policyDefinitions: POLICY_PRIVACY_STAFF, tournamentRecord, - }).participants; + }); + const tournamentContacts = participantResult?.participants ?? []; if (tournamentContacts) tournamentInfo.tournamentContacts = tournamentContacts; const publishState = getPublishState({ tournamentRecord })?.publishState;