Skip to content

Commit

Permalink
feat: ✨ new output for analyzeTournament
Browse files Browse the repository at this point in the history
  • Loading branch information
CourtHive committed Apr 1, 2024
1 parent f9d6204 commit 52cc39b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
13 changes: 10 additions & 3 deletions src/query/tournaments/analyzeTournament.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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 };
}
5 changes: 3 additions & 2 deletions src/query/tournaments/getTournamentInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 52cc39b

Please sign in to comment.