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.
@@ -5762,13 +5762,12 @@ function getSeedPattern(seedingProfile) {
5762
5762
 
5763
5763
  function addParticipantGroupings({
5764
5764
  participantsProfile,
5765
- participants = []
5765
+ participants = [],
5766
+ deepCopy
5767
+ // will skip deepCopy only if false
5766
5768
  }) {
5767
- const participantsWithGroupings = makeDeepCopy(
5768
- participants,
5769
- participantsProfile?.convertExtensions,
5770
- true
5771
- );
5769
+ const groupMap = /* @__PURE__ */ new Map();
5770
+ const participantsWithGroupings = deepCopy !== false ? makeDeepCopy(participants, participantsProfile?.convertExtensions, true) : participants;
5772
5771
  const teamParticipants = participantsWithGroupings.filter(
5773
5772
  (participant) => participant.participantType === TEAM
5774
5773
  );
@@ -5791,6 +5790,11 @@ function addParticipantGroupings({
5791
5790
  (individualParticipantId) => {
5792
5791
  if (individualParticipantId === participantId && !participant.teamParticipantIds?.includes(team.participantId)) {
5793
5792
  participant.teamParticipantIds.push(team.participantId);
5793
+ if (!groupMap.get(team.participantId))
5794
+ groupMap.set(team.participantId, {
5795
+ participantName: team.participantName,
5796
+ participantId: team.participantId
5797
+ });
5794
5798
  participant.teams.push({
5795
5799
  participantRoleResponsibilities: team.participantRoleResponsibilities,
5796
5800
  participantOtherName: team.participantOtherName,
@@ -5828,7 +5832,7 @@ function addParticipantGroupings({
5828
5832
  });
5829
5833
  }
5830
5834
  });
5831
- return participantsWithGroupings;
5835
+ return { participantsWithGroupings, groupInfo: Object.fromEntries(groupMap) };
5832
5836
  }
5833
5837
 
5834
5838
  const countries = [
@@ -7812,11 +7816,13 @@ function hydrateParticipants({
7812
7816
  participants.forEach(
7813
7817
  (participant) => addNationalityCode({ participant, ...participantsProfile })
7814
7818
  );
7819
+ let groupInfo;
7815
7820
  if ((inContext || participantsProfile?.withGroupings) && participants?.length) {
7816
- participants = addParticipantGroupings({
7821
+ ({ participantsWithGroupings: participants, groupInfo } = addParticipantGroupings({
7817
7822
  participantsProfile,
7823
+ deepCopy: false,
7818
7824
  participants
7819
- });
7825
+ }));
7820
7826
  }
7821
7827
  if (participantsProfile?.withScaleValues && participants?.length) {
7822
7828
  for (const participant of participants) {
@@ -7825,7 +7831,7 @@ function hydrateParticipants({
7825
7831
  participant.ratings = ratings;
7826
7832
  }
7827
7833
  }
7828
- return { participants };
7834
+ return { participants, groupInfo };
7829
7835
  }
7830
7836
 
7831
7837
  const extractor = (object) => (attr) => object[attr];
@@ -8519,13 +8525,14 @@ function getDrawMatchUps(params) {
8519
8525
  event
8520
8526
  });
8521
8527
  }
8528
+ let groupInfo;
8522
8529
  if (!tournamentParticipants?.length && tournamentRecord) {
8523
8530
  tournamentParticipants = tournamentRecord?.participants;
8524
8531
  if ((inContext || participantsProfile?.withGroupings) && tournamentParticipants?.length) {
8525
- tournamentParticipants = addParticipantGroupings({
8532
+ ({ participantsWithGroupings: tournamentParticipants, groupInfo } = addParticipantGroupings({
8526
8533
  participants: tournamentParticipants,
8527
8534
  participantsProfile
8528
- });
8535
+ }));
8529
8536
  }
8530
8537
  }
8531
8538
  const { structures } = getDrawStructures({ drawDefinition });
@@ -8586,14 +8593,15 @@ function getDrawMatchUps(params) {
8586
8593
  }
8587
8594
  return matchUps;
8588
8595
  };
8589
- const matchUpGroups = {
8596
+ const drawMatchUpsResult = {
8590
8597
  abandonedMatchUps: applyFilter(allAbandonedMatchUps),
8591
8598
  completedMatchUps: applyFilter(allCompletedMatchUps),
8592
8599
  upcomingMatchUps: applyFilter(allUpcomingMatchUps),
8593
8600
  pendingMatchUps: applyFilter(allPendingMatchUps),
8594
8601
  byeMatchUps: applyFilter(allByeMatchUps),
8595
8602
  matchUpsMap,
8596
- ...SUCCESS
8603
+ ...SUCCESS,
8604
+ groupInfo
8597
8605
  };
8598
8606
  if (nextMatchUps) {
8599
8607
  const nextFilter = typeof nextMatchUps === "object" || {
@@ -8616,7 +8624,7 @@ function getDrawMatchUps(params) {
8616
8624
  drawDefinition
8617
8625
  });
8618
8626
  }
8619
- return matchUpGroups;
8627
+ return drawMatchUpsResult;
8620
8628
  }
8621
8629
 
8622
8630
  function allTournamentMatchUps(params) {
@@ -8724,8 +8732,13 @@ function allDrawMatchUps(params) {
8724
8732
  surfaceCategory: event?.surfaceCategory ?? tournamentRecord?.surfaceCategory,
8725
8733
  endDate: event?.endDate
8726
8734
  };
8735
+ let groupInfo;
8727
8736
  if (!tournamentParticipants?.length && !participantMap && tournamentRecord) {
8728
- ({ participants: tournamentParticipants = [], participantMap } = hydrateParticipants({
8737
+ ({
8738
+ participants: tournamentParticipants = [],
8739
+ participantMap,
8740
+ groupInfo
8741
+ } = hydrateParticipants({
8729
8742
  participantsProfile,
8730
8743
  useParticipantMap,
8731
8744
  policyDefinitions,
@@ -8743,7 +8756,7 @@ function allDrawMatchUps(params) {
8743
8756
  event
8744
8757
  });
8745
8758
  }
8746
- return getAllDrawMatchUps({
8759
+ const allDrawMatchUpsResult = getAllDrawMatchUps({
8747
8760
  context: additionalContext,
8748
8761
  tournamentAppliedPolicies,
8749
8762
  scheduleVisibilityFilters,
@@ -8762,6 +8775,7 @@ function allDrawMatchUps(params) {
8762
8775
  inContext,
8763
8776
  event
8764
8777
  });
8778
+ return { ...allDrawMatchUpsResult, groupInfo };
8765
8779
  }
8766
8780
  function allEventMatchUps(params) {
8767
8781
  let { participants = [], contextContent, participantMap } = params;
@@ -8808,6 +8822,7 @@ function allEventMatchUps(params) {
8808
8822
  event
8809
8823
  });
8810
8824
  }
8825
+ let groupInfo;
8811
8826
  if (!participants?.length && !participantMap && tournamentRecord) {
8812
8827
  const hydratedParticipantResult = hydrateParticipants({
8813
8828
  participantsProfile,
@@ -8819,6 +8834,7 @@ function allEventMatchUps(params) {
8819
8834
  });
8820
8835
  participantMap = hydratedParticipantResult.participantMap;
8821
8836
  participants = hydratedParticipantResult.participants ?? [];
8837
+ groupInfo = hydratedParticipantResult.groupInfo;
8822
8838
  }
8823
8839
  const drawDefinitions = event.drawDefinitions ?? [];
8824
8840
  const scheduleTiming = getScheduleTiming({
@@ -8850,7 +8866,7 @@ function allEventMatchUps(params) {
8850
8866
  return matchUps2 ?? [];
8851
8867
  }
8852
8868
  );
8853
- return { matchUps };
8869
+ return { matchUps, groupInfo };
8854
8870
  }
8855
8871
 
8856
8872
  function addFinishingRounds({
@@ -12006,8 +12022,9 @@ function randomUnseededSeparation({
12006
12022
  const { positionAssignments } = structureAssignedDrawPositions({ structure });
12007
12023
  const participantsWithGroupings = addParticipantGroupings({
12008
12024
  participantsProfile: { convertExtensions: true },
12025
+ deepCopy: false,
12009
12026
  participants
12010
- });
12027
+ }).participantsWithGroupings;
12011
12028
  const unassignedPositions = positionAssignments?.filter(
12012
12029
  (assignment) => !assignment.participantId
12013
12030
  );