tods-competition-factory 2.1.30 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +6 -6
- package/dist/tods-competition-factory.d.ts +20 -1
- package/dist/tods-competition-factory.development.cjs.js +71 -39
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +17 -17
|
@@ -2387,6 +2387,7 @@ type GroupsMatchUpsResult = {
|
|
|
2387
2387
|
abandonedMatchUps?: HydratedMatchUp[];
|
|
2388
2388
|
completedMatchUps?: HydratedMatchUp[];
|
|
2389
2389
|
upcomingMatchUps?: HydratedMatchUp[];
|
|
2390
|
+
participants?: HydratedParticipant[];
|
|
2390
2391
|
pendingMatchUps?: HydratedMatchUp[];
|
|
2391
2392
|
byeMatchUps?: HydratedMatchUp[];
|
|
2392
2393
|
matchUpsMap?: MatchUpsMap;
|
|
@@ -5585,6 +5586,9 @@ type CompetitionScheduleMatchUpsArgs = {
|
|
|
5585
5586
|
status?: string;
|
|
5586
5587
|
};
|
|
5587
5588
|
declare function competitionScheduleMatchUps(params: CompetitionScheduleMatchUpsArgs): {
|
|
5589
|
+
mappedParticipants?: {
|
|
5590
|
+
[key: string]: HydratedParticipant;
|
|
5591
|
+
};
|
|
5588
5592
|
completedMatchUps?: HydratedMatchUp[];
|
|
5589
5593
|
dateMatchUps?: HydratedMatchUp[];
|
|
5590
5594
|
courtPrefix?: string;
|
|
@@ -5685,6 +5689,7 @@ declare function allCompetitionMatchUps({ scheduleVisibilityFilters, afterRecove
|
|
|
5685
5689
|
type GetAllStructureMatchUps = {
|
|
5686
5690
|
scheduleVisibilityFilters?: ScheduleVisibilityFilters;
|
|
5687
5691
|
tournamentAppliedPolicies?: PolicyDefinitions;
|
|
5692
|
+
participantsProfile?: ParticipantsProfile;
|
|
5688
5693
|
tournamentParticipants?: Participant[];
|
|
5689
5694
|
policyDefinitions?: PolicyDefinitions;
|
|
5690
5695
|
seedAssignments?: SeedAssignment[];
|
|
@@ -5702,6 +5707,7 @@ type GetAllStructureMatchUps = {
|
|
|
5702
5707
|
contextProfile?: ContextProfile;
|
|
5703
5708
|
tournamentRecord?: Tournament;
|
|
5704
5709
|
afterRecoveryTimes?: boolean;
|
|
5710
|
+
useParticipantMap?: boolean;
|
|
5705
5711
|
usePublishState?: boolean;
|
|
5706
5712
|
exitProfiles?: ExitProfiles;
|
|
5707
5713
|
matchUpsMap?: MatchUpsMap;
|
|
@@ -5772,11 +5778,15 @@ type CompetitionMatchUpsArgs = {
|
|
|
5772
5778
|
contextFilters?: MatchUpFilters;
|
|
5773
5779
|
hydrateParticipants?: boolean;
|
|
5774
5780
|
afterRecoveryTimes?: boolean;
|
|
5781
|
+
useParticipantMap?: boolean;
|
|
5775
5782
|
usePublishState?: boolean;
|
|
5776
5783
|
nextMatchUps?: boolean;
|
|
5777
5784
|
inContext?: boolean;
|
|
5778
5785
|
};
|
|
5779
|
-
declare function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs): ResultType & {
|
|
5786
|
+
declare function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, useParticipantMap, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }: CompetitionMatchUpsArgs): ResultType & {
|
|
5787
|
+
mappedParticipants?: {
|
|
5788
|
+
[key: string]: HydratedParticipant;
|
|
5789
|
+
};
|
|
5780
5790
|
abandonedMatchUps?: HydratedMatchUp[];
|
|
5781
5791
|
completedMatchUps?: HydratedMatchUp[];
|
|
5782
5792
|
upcomingMatchUps?: HydratedMatchUp[];
|
|
@@ -6059,6 +6069,7 @@ declare function drawMatchUps({ participants: tournamentParticipants, tournament
|
|
|
6059
6069
|
abandonedMatchUps?: HydratedMatchUp[] | undefined;
|
|
6060
6070
|
completedMatchUps?: HydratedMatchUp[] | undefined;
|
|
6061
6071
|
upcomingMatchUps?: HydratedMatchUp[] | undefined;
|
|
6072
|
+
participants?: HydratedParticipant[] | undefined;
|
|
6062
6073
|
pendingMatchUps?: HydratedMatchUp[] | undefined;
|
|
6063
6074
|
byeMatchUps?: HydratedMatchUp[] | undefined;
|
|
6064
6075
|
matchUpsMap?: MatchUpsMap | undefined;
|
|
@@ -7292,10 +7303,12 @@ type GetEventDataArgs = {
|
|
|
7292
7303
|
policyDefinitions?: PolicyDefinitions;
|
|
7293
7304
|
allParticipantResults?: boolean;
|
|
7294
7305
|
sortConfig?: StructureSortConfig;
|
|
7306
|
+
hydrateParticipants?: boolean;
|
|
7295
7307
|
tournamentRecord: Tournament;
|
|
7296
7308
|
usePublishState?: boolean;
|
|
7297
7309
|
refreshResults?: boolean;
|
|
7298
7310
|
pressureRating?: boolean;
|
|
7311
|
+
contextProfile?: any;
|
|
7299
7312
|
eventId?: string;
|
|
7300
7313
|
status?: string;
|
|
7301
7314
|
event?: Event$1;
|
|
@@ -8129,6 +8142,9 @@ type ProAutoScheduleArgs = {
|
|
|
8129
8142
|
scheduledDate: string;
|
|
8130
8143
|
};
|
|
8131
8144
|
declare function proAutoSchedule({ scheduleCompletedMatchUps, tournamentRecords, scheduledDate, matchUps, }: ProAutoScheduleArgs): {
|
|
8145
|
+
mappedParticipants?: {
|
|
8146
|
+
[key: string]: HydratedParticipant;
|
|
8147
|
+
} | undefined;
|
|
8132
8148
|
completedMatchUps?: HydratedMatchUp[] | undefined;
|
|
8133
8149
|
dateMatchUps?: HydratedMatchUp[] | undefined;
|
|
8134
8150
|
courtPrefix?: string | undefined;
|
|
@@ -8151,6 +8167,9 @@ declare function proAutoSchedule({ scheduleCompletedMatchUps, tournamentRecords,
|
|
|
8151
8167
|
} | {
|
|
8152
8168
|
scheduled: HydratedMatchUp[];
|
|
8153
8169
|
notScheduled: HydratedMatchUp[];
|
|
8170
|
+
mappedParticipants?: {
|
|
8171
|
+
[key: string]: HydratedParticipant;
|
|
8172
|
+
} | undefined;
|
|
8154
8173
|
completedMatchUps?: HydratedMatchUp[] | undefined;
|
|
8155
8174
|
dateMatchUps?: HydratedMatchUp[] | undefined;
|
|
8156
8175
|
courtPrefix?: string | undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.1
|
|
6
|
+
return '2.2.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -7780,7 +7780,7 @@ const membershipMap = {
|
|
|
7780
7780
|
[GROUP]: 'groups',
|
|
7781
7781
|
[TEAM]: 'teams',
|
|
7782
7782
|
};
|
|
7783
|
-
function getParticipantMap({ withIndividualParticipants, convertExtensions, tournamentRecord, withSignInStatus, withScaleValues, internalUse, withISO2, withIOC, }) {
|
|
7783
|
+
function getParticipantMap({ withIndividualParticipants, convertExtensions, tournamentRecord, withSignInStatus, withScaleValues, withGroupings, internalUse, withISO2, withIOC, }) {
|
|
7784
7784
|
const missingParticipantIds = [];
|
|
7785
7785
|
const participantMap = {};
|
|
7786
7786
|
for (const participant of tournamentRecord.participants ?? []) {
|
|
@@ -7811,9 +7811,7 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
|
|
|
7811
7811
|
participantMap[participantId].participant.signedIn = signedIn(participantCopy);
|
|
7812
7812
|
}
|
|
7813
7813
|
if (withScaleValues) {
|
|
7814
|
-
const { ratings, rankings, seedings } = getScaleValues({
|
|
7815
|
-
participant: participantCopy,
|
|
7816
|
-
});
|
|
7814
|
+
const { ratings, rankings, seedings } = getScaleValues({ participant: participantCopy });
|
|
7817
7815
|
participantMap[participantId].participant.seedings = seedings;
|
|
7818
7816
|
participantMap[participantId].participant.rankings = rankings;
|
|
7819
7817
|
participantMap[participantId].participant.ratings = ratings;
|
|
@@ -7829,7 +7827,15 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
|
|
|
7829
7827
|
const template = isObject(withIndividualParticipants) ? withIndividualParticipants : undefined;
|
|
7830
7828
|
addIndividualParticipants({ participantMap, template });
|
|
7831
7829
|
}
|
|
7832
|
-
|
|
7830
|
+
let groupInfo;
|
|
7831
|
+
if (withGroupings) {
|
|
7832
|
+
groupInfo = addParticipantGroupings({
|
|
7833
|
+
participants: Object.values(participantMap).map(({ participant }) => participant),
|
|
7834
|
+
participantsProfile: { convertExtensions },
|
|
7835
|
+
deepCopy: false,
|
|
7836
|
+
}).groupInfo;
|
|
7837
|
+
}
|
|
7838
|
+
return { missingParticipantIds, participantMap, groupInfo };
|
|
7833
7839
|
}
|
|
7834
7840
|
function signedIn(participant) {
|
|
7835
7841
|
const { timeItem } = getTimeItem({
|
|
@@ -7909,12 +7915,11 @@ function initializeParticipantId({ participantMap, participantId }) {
|
|
|
7909
7915
|
|
|
7910
7916
|
function hydrateParticipants({ participantsProfile, useParticipantMap, tournamentRecord, contextProfile, inContext, }) {
|
|
7911
7917
|
if (useParticipantMap) {
|
|
7912
|
-
|
|
7918
|
+
return getParticipantMap({
|
|
7913
7919
|
...participantsProfile,
|
|
7914
7920
|
...contextProfile,
|
|
7915
7921
|
tournamentRecord,
|
|
7916
|
-
})
|
|
7917
|
-
return { participantMap };
|
|
7922
|
+
});
|
|
7918
7923
|
}
|
|
7919
7924
|
let participants = makeDeepCopy(tournamentRecord.participants, false, true) || [];
|
|
7920
7925
|
if (participantsProfile?.withIOC || participantsProfile?.withISO2)
|
|
@@ -10342,7 +10347,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10342
10347
|
});
|
|
10343
10348
|
Object.assign(matchUpWithContext, makeDeepCopy({ sides }, true, true));
|
|
10344
10349
|
}
|
|
10345
|
-
if (tournamentParticipants && matchUpWithContext.sides
|
|
10350
|
+
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
10346
10351
|
const participantAttributes = appliedPolicies?.[POLICY_TYPE_PARTICIPANT];
|
|
10347
10352
|
const getMappedParticipant = (participantId) => {
|
|
10348
10353
|
const participant = participantMap?.[participantId]?.participant;
|
|
@@ -10365,15 +10370,23 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10365
10370
|
})
|
|
10366
10371
|
: undefined), undefined, true);
|
|
10367
10372
|
if (participant) {
|
|
10373
|
+
let entryStatus, entryStage;
|
|
10368
10374
|
if (drawDefinition?.entries) {
|
|
10369
10375
|
const entry = drawDefinition.entries.find((entry) => entry.participantId === side.participantId);
|
|
10370
10376
|
const eEntry = event?.entries?.find((entry) => entry.participantId === side.participantId);
|
|
10371
|
-
|
|
10377
|
+
entryStatus = entry?.entryStatus || eEntry?.entryStatus;
|
|
10378
|
+
participant.entryStatus = entryStatus;
|
|
10372
10379
|
if (entry?.entryStage) {
|
|
10373
|
-
|
|
10380
|
+
entryStage = entry.entryStage;
|
|
10381
|
+
participant.entryStage = entryStage;
|
|
10374
10382
|
}
|
|
10375
10383
|
}
|
|
10376
|
-
|
|
10384
|
+
if (hydrateParticipants !== false) {
|
|
10385
|
+
Object.assign(side, { participant });
|
|
10386
|
+
}
|
|
10387
|
+
else {
|
|
10388
|
+
Object.assign(side, { participant: { entryStage, entryStatus } });
|
|
10389
|
+
}
|
|
10377
10390
|
}
|
|
10378
10391
|
}
|
|
10379
10392
|
if (side?.participant?.individualParticipantIds?.length && !side.participant.individualParticipants?.length) {
|
|
@@ -10389,7 +10402,8 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10389
10402
|
})
|
|
10390
10403
|
: undefined));
|
|
10391
10404
|
});
|
|
10392
|
-
|
|
10405
|
+
if (hydrateParticipants !== false)
|
|
10406
|
+
Object.assign(side.participant, { individualParticipants });
|
|
10393
10407
|
}
|
|
10394
10408
|
});
|
|
10395
10409
|
if (!matchUpWithContext.matchUpType) {
|
|
@@ -10772,17 +10786,28 @@ function getAllStructureMatchUps(params) {
|
|
|
10772
10786
|
structureId,
|
|
10773
10787
|
}).drawPositionsRanges
|
|
10774
10788
|
: undefined;
|
|
10789
|
+
let tournamentParticipants = params.tournamentParticipants;
|
|
10790
|
+
let participantMap = params.participantMap;
|
|
10791
|
+
if (!tournamentParticipants?.length && !participantMap && tournamentRecord) {
|
|
10792
|
+
({ participants: tournamentParticipants = [], participantMap } = hydrateParticipants({
|
|
10793
|
+
participantsProfile: params.participantsProfile,
|
|
10794
|
+
useParticipantMap: params.useParticipantMap,
|
|
10795
|
+
policyDefinitions: params.policyDefinitions,
|
|
10796
|
+
tournamentRecord,
|
|
10797
|
+
contextProfile,
|
|
10798
|
+
inContext,
|
|
10799
|
+
}));
|
|
10800
|
+
}
|
|
10775
10801
|
matchUps = matchUps.map((matchUp) => {
|
|
10776
10802
|
return addMatchUpContext({
|
|
10777
|
-
tournamentParticipants: params.tournamentParticipants ?? tournamentRecord?.participants,
|
|
10778
10803
|
scheduleVisibilityFilters: params.scheduleVisibilityFilters,
|
|
10779
10804
|
hydrateParticipants: params.hydrateParticipants,
|
|
10780
10805
|
afterRecoveryTimes: params.afterRecoveryTimes,
|
|
10781
10806
|
usePublishState: params.usePublishState,
|
|
10782
|
-
participantMap: params.participantMap,
|
|
10783
10807
|
scheduleTiming: params.scheduleTiming,
|
|
10784
10808
|
publishStatus: params.publishStatus,
|
|
10785
10809
|
sourceDrawPositionRanges,
|
|
10810
|
+
tournamentParticipants,
|
|
10786
10811
|
positionAssignments,
|
|
10787
10812
|
drawPositionsRanges,
|
|
10788
10813
|
initialRoundOfPlay,
|
|
@@ -10791,6 +10816,7 @@ function getAllStructureMatchUps(params) {
|
|
|
10791
10816
|
appliedPolicies,
|
|
10792
10817
|
seedAssignments,
|
|
10793
10818
|
contextContent,
|
|
10819
|
+
participantMap,
|
|
10794
10820
|
contextProfile,
|
|
10795
10821
|
drawDefinition,
|
|
10796
10822
|
scoringActive,
|
|
@@ -14395,16 +14421,10 @@ function getParticipants(params) {
|
|
|
14395
14421
|
const template = isObject(withIndividualParticipants) ? withIndividualParticipants : undefined;
|
|
14396
14422
|
for (const participant of filteredParticipants) {
|
|
14397
14423
|
for (const individualParticipantId of participant.individualParticipantIds ?? []) {
|
|
14398
|
-
|
|
14399
|
-
if (!mappedParticipant?.individualParticipants)
|
|
14400
|
-
mappedParticipant.individualParticipants = [];
|
|
14401
|
-
if (!participant.individualParticipants) {
|
|
14424
|
+
if (!participant.individualParticipants)
|
|
14402
14425
|
participant.individualParticipants = [];
|
|
14403
|
-
}
|
|
14404
14426
|
const source = ppMap.get(individualParticipantId);
|
|
14405
14427
|
const individualParticipant = template ? attributeFilter({ template, source }) : source;
|
|
14406
|
-
if (mappedParticipant?.individualParticipants)
|
|
14407
|
-
mappedParticipant.individualParticipants.push(individualParticipant);
|
|
14408
14428
|
participant.individualParticipants.push(individualParticipant);
|
|
14409
14429
|
}
|
|
14410
14430
|
}
|
|
@@ -17695,11 +17715,11 @@ function extractAttributeValues({ policyAttributes, idCollections, participants,
|
|
|
17695
17715
|
}
|
|
17696
17716
|
|
|
17697
17717
|
function getPositionedParticipants({ candidatePositionAssignments, participantsWithGroupings, policyAttributes, idCollections, }) {
|
|
17698
|
-
const
|
|
17718
|
+
const mappedParticipants = Object.assign({}, ...participantsWithGroupings.map((participant) => ({
|
|
17699
17719
|
[participant.participantId]: participant,
|
|
17700
17720
|
})));
|
|
17701
17721
|
return candidatePositionAssignments.map((assignment) => {
|
|
17702
|
-
const participant =
|
|
17722
|
+
const participant = mappedParticipants[assignment.participantId];
|
|
17703
17723
|
const { values } = extractAttributeValues({
|
|
17704
17724
|
participants: participantsWithGroupings,
|
|
17705
17725
|
policyAttributes,
|
|
@@ -34805,7 +34825,7 @@ const displayConstants = {
|
|
|
34805
34825
|
};
|
|
34806
34826
|
|
|
34807
34827
|
function getDrawData(params) {
|
|
34808
|
-
const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
|
|
34828
|
+
const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, contextProfile, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
|
|
34809
34829
|
if (!drawDefinition)
|
|
34810
34830
|
return { error: MISSING_DRAW_DEFINITION };
|
|
34811
34831
|
const drawInfo = (({ matchUpFormat, updatedAt, drawType, drawName, drawId }) => ({
|
|
@@ -34859,11 +34879,14 @@ function getDrawData(params) {
|
|
|
34859
34879
|
const { matchUps, roundMatchUps, roundProfile } = getAllStructureMatchUps({
|
|
34860
34880
|
seedAssignments: !structure?.seedAssignments?.length ? seedAssignments : undefined,
|
|
34861
34881
|
context: { drawId: drawInfo.drawId, ...context },
|
|
34882
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
34883
|
+
participantsProfile: params.participantsProfile,
|
|
34862
34884
|
tournamentParticipants,
|
|
34863
34885
|
policyDefinitions,
|
|
34864
34886
|
tournamentRecord,
|
|
34865
34887
|
usePublishState,
|
|
34866
34888
|
publishStatus,
|
|
34889
|
+
contextProfile,
|
|
34867
34890
|
drawDefinition,
|
|
34868
34891
|
inContext,
|
|
34869
34892
|
structure,
|
|
@@ -34975,7 +34998,7 @@ function getDrawData(params) {
|
|
|
34975
34998
|
}
|
|
34976
34999
|
|
|
34977
35000
|
function getEventData(params) {
|
|
34978
|
-
const { includePositionAssignments, participantsProfile, policyDefinitions, usePublishState, status = PUBLIC, sortConfig, } = params;
|
|
35001
|
+
const { includePositionAssignments, participantsProfile, policyDefinitions, usePublishState, status = PUBLIC, contextProfile, sortConfig, } = params;
|
|
34979
35002
|
const paramsCheck = checkRequiredParameters(params, [
|
|
34980
35003
|
{ tournamentRecord: true },
|
|
34981
35004
|
{ [ANY_OF]: { event: false, eventId: false } },
|
|
@@ -35047,6 +35070,7 @@ function getEventData(params) {
|
|
|
35047
35070
|
structures,
|
|
35048
35071
|
}))(getDrawData({
|
|
35049
35072
|
allParticipantResults: params.allParticipantResults,
|
|
35073
|
+
hydrateParticipants: params.hydrateParticipants,
|
|
35050
35074
|
context: { eventId, tournamentId, endDate },
|
|
35051
35075
|
pressureRating: params.pressureRating,
|
|
35052
35076
|
refreshResults: params.refreshResults,
|
|
@@ -35056,6 +35080,7 @@ function getEventData(params) {
|
|
|
35056
35080
|
policyDefinitions,
|
|
35057
35081
|
tournamentRecord,
|
|
35058
35082
|
usePublishState,
|
|
35083
|
+
contextProfile,
|
|
35059
35084
|
drawDefinition,
|
|
35060
35085
|
publishStatus,
|
|
35061
35086
|
sortConfig,
|
|
@@ -36483,13 +36508,12 @@ function tournamentMatchUps(params) {
|
|
|
36483
36508
|
if (!params?.tournamentRecord)
|
|
36484
36509
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36485
36510
|
let contextContent = params.contextContent;
|
|
36486
|
-
const { scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions,
|
|
36511
|
+
const { scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions, tournamentRecord, inContext = true, usePublishState, contextFilters, matchUpFilters, contextProfile, nextMatchUps, context, } = params;
|
|
36487
36512
|
const tournamentId = params.tournamentId ?? tournamentRecord.tournamentId;
|
|
36488
36513
|
const events = tournamentRecord?.events ?? [];
|
|
36489
36514
|
const { participants, participantMap, groupInfo } = hydrateParticipants({
|
|
36490
36515
|
participantsProfile,
|
|
36491
36516
|
policyDefinitions,
|
|
36492
|
-
useParticipantMap,
|
|
36493
36517
|
tournamentRecord,
|
|
36494
36518
|
contextProfile,
|
|
36495
36519
|
inContext,
|
|
@@ -36546,10 +36570,10 @@ function tournamentMatchUps(params) {
|
|
|
36546
36570
|
});
|
|
36547
36571
|
return matchUps;
|
|
36548
36572
|
}, { matchUpsCount: 0 });
|
|
36549
|
-
return { ...eventsDrawMatchUpsResult, groupInfo };
|
|
36573
|
+
return { ...eventsDrawMatchUpsResult, groupInfo, participants };
|
|
36550
36574
|
}
|
|
36551
36575
|
|
|
36552
|
-
function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
36576
|
+
function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants, participantsProfile, tournamentRecords, useParticipantMap, policyDefinitions, usePublishState, matchUpFilters, contextFilters, nextMatchUps, inContext, }) {
|
|
36553
36577
|
if (typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length)
|
|
36554
36578
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
36555
36579
|
const tournamentIds = Object.keys(tournamentRecords);
|
|
@@ -36559,6 +36583,7 @@ function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants
|
|
|
36559
36583
|
scheduleVisibilityFilters,
|
|
36560
36584
|
hydrateParticipants,
|
|
36561
36585
|
participantsProfile,
|
|
36586
|
+
useParticipantMap,
|
|
36562
36587
|
policyDefinitions,
|
|
36563
36588
|
tournamentRecord,
|
|
36564
36589
|
usePublishState,
|
|
@@ -36568,22 +36593,28 @@ function getCompetitionMatchUps({ scheduleVisibilityFilters, hydrateParticipants
|
|
|
36568
36593
|
inContext,
|
|
36569
36594
|
});
|
|
36570
36595
|
});
|
|
36596
|
+
const mappedParticipants = {};
|
|
36571
36597
|
const groupInfo = {};
|
|
36572
36598
|
const competitionMatchUpsResult = tournamentsMatchUps.reduce((groupings, matchUpGroupings) => {
|
|
36573
36599
|
const keys = Object.keys(matchUpGroupings);
|
|
36574
36600
|
keys.forEach((key) => {
|
|
36575
|
-
if (
|
|
36601
|
+
if (key === 'groupInfo') {
|
|
36602
|
+
Object.assign(groupInfo, matchUpGroupings[key]);
|
|
36603
|
+
}
|
|
36604
|
+
else if (key === 'participants') {
|
|
36605
|
+
for (const participant of matchUpGroupings[key] ?? []) {
|
|
36606
|
+
mappedParticipants[participant.participantId] = participant;
|
|
36607
|
+
}
|
|
36608
|
+
}
|
|
36609
|
+
else if (Array.isArray(matchUpGroupings[key])) {
|
|
36576
36610
|
if (!groupings[key])
|
|
36577
36611
|
groupings[key] = [];
|
|
36578
36612
|
groupings[key] = groupings[key].concat(matchUpGroupings[key]);
|
|
36579
36613
|
}
|
|
36580
|
-
if (key === 'groupInfo') {
|
|
36581
|
-
Object.assign(groupInfo, matchUpGroupings[key]);
|
|
36582
|
-
}
|
|
36583
36614
|
});
|
|
36584
36615
|
return groupings;
|
|
36585
36616
|
}, {});
|
|
36586
|
-
return { ...competitionMatchUpsResult, groupInfo };
|
|
36617
|
+
return { ...competitionMatchUpsResult, groupInfo, mappedParticipants };
|
|
36587
36618
|
}
|
|
36588
36619
|
|
|
36589
36620
|
function competitionScheduleMatchUps(params) {
|
|
@@ -36671,7 +36702,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
36671
36702
|
params.matchUpFilters.excludeMatchUpStatuses = [COMPLETED$1];
|
|
36672
36703
|
}
|
|
36673
36704
|
}
|
|
36674
|
-
const { completedMatchUps, upcomingMatchUps, pendingMatchUps, groupInfo } = getCompetitionMatchUps({
|
|
36705
|
+
const { completedMatchUps, upcomingMatchUps, pendingMatchUps, groupInfo, mappedParticipants } = getCompetitionMatchUps({
|
|
36675
36706
|
...params,
|
|
36676
36707
|
matchUpFilters: params.matchUpFilters,
|
|
36677
36708
|
contextFilters: params.contextFilters,
|
|
@@ -36720,6 +36751,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
36720
36751
|
});
|
|
36721
36752
|
const result = {
|
|
36722
36753
|
completedMatchUps: alwaysReturnCompleted ? allCompletedMatchUps : completedMatchUps,
|
|
36754
|
+
mappedParticipants: params.hydrateParticipants ? undefined : mappedParticipants,
|
|
36723
36755
|
dateMatchUps,
|
|
36724
36756
|
courtsData,
|
|
36725
36757
|
groupInfo,
|
|
@@ -53556,7 +53588,7 @@ function getAvgWTN({ eventType, matchUps, eventId, drawId }) {
|
|
|
53556
53588
|
matchUpFormatCounts[matchUpFormat] = 0;
|
|
53557
53589
|
matchUpFormatCounts[matchUpFormat] += 1;
|
|
53558
53590
|
};
|
|
53559
|
-
const
|
|
53591
|
+
const mappedParticipants = matchUps
|
|
53560
53592
|
.filter((matchUp) => (eventId ? matchUp.eventId === eventId : matchUp.drawId === drawId))
|
|
53561
53593
|
.reduce((participants, matchUp) => {
|
|
53562
53594
|
countMatchUpFormat(matchUp);
|
|
@@ -53565,7 +53597,7 @@ function getAvgWTN({ eventType, matchUps, eventId, drawId }) {
|
|
|
53565
53597
|
.forEach((participant) => (participants[participant.participantId] = participant));
|
|
53566
53598
|
return participants;
|
|
53567
53599
|
}, {});
|
|
53568
|
-
const eventParticipants = Object.values(
|
|
53600
|
+
const eventParticipants = Object.values(mappedParticipants);
|
|
53569
53601
|
const wtnRatings = eventParticipants
|
|
53570
53602
|
.map((participant) => getDetailsWTN({ participant, eventType }))
|
|
53571
53603
|
.filter(({ wtnRating }) => wtnRating);
|