tods-competition-factory 1.8.30 → 1.8.31

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.
@@ -6849,13 +6849,12 @@ function getProjectedDualWinningSide({
6849
6849
 
6850
6850
  function addParticipantGroupings({
6851
6851
  participantsProfile,
6852
- participants = []
6852
+ participants = [],
6853
+ deepCopy
6854
+ // will skip deepCopy only if false
6853
6855
  }) {
6854
- const participantsWithGroupings = makeDeepCopy(
6855
- participants,
6856
- participantsProfile?.convertExtensions,
6857
- true
6858
- );
6856
+ const groupMap = /* @__PURE__ */ new Map();
6857
+ const participantsWithGroupings = deepCopy !== false ? makeDeepCopy(participants, participantsProfile?.convertExtensions, true) : participants;
6859
6858
  const teamParticipants = participantsWithGroupings.filter(
6860
6859
  (participant) => participant.participantType === TEAM
6861
6860
  );
@@ -6878,6 +6877,11 @@ function addParticipantGroupings({
6878
6877
  (individualParticipantId) => {
6879
6878
  if (individualParticipantId === participantId && !participant.teamParticipantIds?.includes(team.participantId)) {
6880
6879
  participant.teamParticipantIds.push(team.participantId);
6880
+ if (!groupMap.get(team.participantId))
6881
+ groupMap.set(team.participantId, {
6882
+ participantName: team.participantName,
6883
+ participantId: team.participantId
6884
+ });
6881
6885
  participant.teams.push({
6882
6886
  participantRoleResponsibilities: team.participantRoleResponsibilities,
6883
6887
  participantOtherName: team.participantOtherName,
@@ -6915,7 +6919,7 @@ function addParticipantGroupings({
6915
6919
  });
6916
6920
  }
6917
6921
  });
6918
- return participantsWithGroupings;
6922
+ return { participantsWithGroupings, groupInfo: Object.fromEntries(groupMap) };
6919
6923
  }
6920
6924
 
6921
6925
  const extractor = (object) => (attr) => object[attr];
@@ -7610,13 +7614,14 @@ function getDrawMatchUps(params) {
7610
7614
  event
7611
7615
  });
7612
7616
  }
7617
+ let groupInfo;
7613
7618
  if (!tournamentParticipants?.length && tournamentRecord) {
7614
7619
  tournamentParticipants = tournamentRecord?.participants;
7615
7620
  if ((inContext || participantsProfile?.withGroupings) && tournamentParticipants?.length) {
7616
- tournamentParticipants = addParticipantGroupings({
7621
+ ({ participantsWithGroupings: tournamentParticipants, groupInfo } = addParticipantGroupings({
7617
7622
  participants: tournamentParticipants,
7618
7623
  participantsProfile
7619
- });
7624
+ }));
7620
7625
  }
7621
7626
  }
7622
7627
  const { structures } = getDrawStructures({ drawDefinition });
@@ -7677,14 +7682,15 @@ function getDrawMatchUps(params) {
7677
7682
  }
7678
7683
  return matchUps;
7679
7684
  };
7680
- const matchUpGroups = {
7685
+ const drawMatchUpsResult = {
7681
7686
  abandonedMatchUps: applyFilter(allAbandonedMatchUps),
7682
7687
  completedMatchUps: applyFilter(allCompletedMatchUps),
7683
7688
  upcomingMatchUps: applyFilter(allUpcomingMatchUps),
7684
7689
  pendingMatchUps: applyFilter(allPendingMatchUps),
7685
7690
  byeMatchUps: applyFilter(allByeMatchUps),
7686
7691
  matchUpsMap,
7687
- ...SUCCESS
7692
+ ...SUCCESS,
7693
+ groupInfo
7688
7694
  };
7689
7695
  if (nextMatchUps) {
7690
7696
  const nextFilter = typeof nextMatchUps === "object" || {
@@ -7707,7 +7713,7 @@ function getDrawMatchUps(params) {
7707
7713
  drawDefinition
7708
7714
  });
7709
7715
  }
7710
- return matchUpGroups;
7716
+ return drawMatchUpsResult;
7711
7717
  }
7712
7718
 
7713
7719
  function analyzeScore({
@@ -10196,11 +10202,13 @@ function hydrateParticipants({
10196
10202
  participants.forEach(
10197
10203
  (participant) => addNationalityCode({ participant, ...participantsProfile })
10198
10204
  );
10205
+ let groupInfo;
10199
10206
  if ((inContext || participantsProfile?.withGroupings) && participants?.length) {
10200
- participants = addParticipantGroupings({
10207
+ ({ participantsWithGroupings: participants, groupInfo } = addParticipantGroupings({
10201
10208
  participantsProfile,
10209
+ deepCopy: false,
10202
10210
  participants
10203
- });
10211
+ }));
10204
10212
  }
10205
10213
  if (participantsProfile?.withScaleValues && participants?.length) {
10206
10214
  for (const participant of participants) {
@@ -10209,7 +10217,7 @@ function hydrateParticipants({
10209
10217
  participant.ratings = ratings;
10210
10218
  }
10211
10219
  }
10212
- return { participants };
10220
+ return { participants, groupInfo };
10213
10221
  }
10214
10222
 
10215
10223
  function allTournamentMatchUps(params) {
@@ -10317,8 +10325,13 @@ function allDrawMatchUps(params) {
10317
10325
  surfaceCategory: event?.surfaceCategory ?? tournamentRecord?.surfaceCategory,
10318
10326
  endDate: event?.endDate
10319
10327
  };
10328
+ let groupInfo;
10320
10329
  if (!tournamentParticipants?.length && !participantMap && tournamentRecord) {
10321
- ({ participants: tournamentParticipants = [], participantMap } = hydrateParticipants({
10330
+ ({
10331
+ participants: tournamentParticipants = [],
10332
+ participantMap,
10333
+ groupInfo
10334
+ } = hydrateParticipants({
10322
10335
  participantsProfile,
10323
10336
  useParticipantMap,
10324
10337
  policyDefinitions,
@@ -10336,7 +10349,7 @@ function allDrawMatchUps(params) {
10336
10349
  event
10337
10350
  });
10338
10351
  }
10339
- return getAllDrawMatchUps({
10352
+ const allDrawMatchUpsResult = getAllDrawMatchUps({
10340
10353
  context: additionalContext,
10341
10354
  tournamentAppliedPolicies,
10342
10355
  scheduleVisibilityFilters,
@@ -10355,6 +10368,7 @@ function allDrawMatchUps(params) {
10355
10368
  inContext,
10356
10369
  event
10357
10370
  });
10371
+ return { ...allDrawMatchUpsResult, groupInfo };
10358
10372
  }
10359
10373
  function allEventMatchUps(params) {
10360
10374
  let { participants = [], contextContent, participantMap } = params;
@@ -10401,6 +10415,7 @@ function allEventMatchUps(params) {
10401
10415
  event
10402
10416
  });
10403
10417
  }
10418
+ let groupInfo;
10404
10419
  if (!participants?.length && !participantMap && tournamentRecord) {
10405
10420
  const hydratedParticipantResult = hydrateParticipants({
10406
10421
  participantsProfile,
@@ -10412,6 +10427,7 @@ function allEventMatchUps(params) {
10412
10427
  });
10413
10428
  participantMap = hydratedParticipantResult.participantMap;
10414
10429
  participants = hydratedParticipantResult.participants ?? [];
10430
+ groupInfo = hydratedParticipantResult.groupInfo;
10415
10431
  }
10416
10432
  const drawDefinitions = event.drawDefinitions ?? [];
10417
10433
  const scheduleTiming = getScheduleTiming({
@@ -10443,7 +10459,7 @@ function allEventMatchUps(params) {
10443
10459
  return matchUps2 ?? [];
10444
10460
  }
10445
10461
  );
10446
- return { matchUps };
10462
+ return { matchUps, groupInfo };
10447
10463
  }
10448
10464
 
10449
10465
  function addFinishingRounds({