tods-competition-factory 1.8.14 → 1.8.15

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.
@@ -7554,6 +7554,21 @@ function addNationalityCode({
7554
7554
  persons.forEach(annotatePerson);
7555
7555
  }
7556
7556
 
7557
+ function addIndividualParticipants({ participantMap }) {
7558
+ const participantObjects = Object.values(participantMap);
7559
+ for (const participantObject of participantObjects) {
7560
+ const participant = participantObject.participant;
7561
+ if (participant.individualParticipantIds?.length) {
7562
+ participant.individualParticipants = [];
7563
+ for (const participantId of participant.individualParticipantIds) {
7564
+ participant.individualParticipants.push(
7565
+ participantMap[participantId].participant
7566
+ );
7567
+ }
7568
+ }
7569
+ }
7570
+ }
7571
+
7557
7572
  function getTimeItem({
7558
7573
  returnPreviousValues,
7559
7574
  itemSubTypes,
@@ -7656,20 +7671,6 @@ function signedIn(participant) {
7656
7671
  });
7657
7672
  return timeItem?.itemValue === SIGNED_IN;
7658
7673
  }
7659
- function addIndividualParticipants({ participantMap }) {
7660
- const participantObjects = Object.values(participantMap);
7661
- for (const participantObject of participantObjects) {
7662
- const participant = participantObject.participant;
7663
- if (participant.individualParticipantIds?.length) {
7664
- participant.individualParticipants = [];
7665
- for (const participantId of participant.individualParticipantIds) {
7666
- participant.individualParticipants.push(
7667
- participantMap[participantId].participant
7668
- );
7669
- }
7670
- }
7671
- }
7672
- }
7673
7674
  function processIndividualParticipantIds({
7674
7675
  individualParticipantIds,
7675
7676
  participantCopy,
@@ -8739,7 +8740,6 @@ function allEventMatchUps(params) {
8739
8740
  if (!event)
8740
8741
  return { error: MISSING_EVENT };
8741
8742
  const { eventId, eventName, endDate, category, gender, matchUpFormat } = event;
8742
- const eventMatchUps2 = [];
8743
8743
  const additionalContext = {
8744
8744
  ...context,
8745
8745
  ...definedAttributes({
@@ -8783,7 +8783,7 @@ function allEventMatchUps(params) {
8783
8783
  }).scheduleTiming;
8784
8784
  const matchUps = drawDefinitions.flatMap(
8785
8785
  (drawDefinition) => {
8786
- const { matchUps: matchUps2, matchUpsMap } = getAllDrawMatchUps({
8786
+ const { matchUps: matchUps2 } = getAllDrawMatchUps({
8787
8787
  tournamentParticipants: participants,
8788
8788
  tournamentAppliedPolicies,
8789
8789
  scheduleVisibilityFilters,
@@ -8803,12 +8803,10 @@ function allEventMatchUps(params) {
8803
8803
  inContext,
8804
8804
  event
8805
8805
  });
8806
- if (matchUpsMap?.drawMatchUps)
8807
- eventMatchUps2.push(...matchUpsMap.drawMatchUps);
8808
8806
  return matchUps2 ?? [];
8809
8807
  }
8810
8808
  );
8811
- return { matchUps, eventMatchUps: eventMatchUps2 };
8809
+ return { matchUps };
8812
8810
  }
8813
8811
 
8814
8812
  function addFinishingRounds({
@@ -19073,7 +19071,6 @@ function getParticipants(params) {
19073
19071
  getMatchUpDependencies({ tournamentRecord });
19074
19072
  }
19075
19073
  let { participantMap } = getParticipantMap({
19076
- withIndividualParticipants,
19077
19074
  convertExtensions,
19078
19075
  tournamentRecord,
19079
19076
  withSignInStatus,
@@ -19112,45 +19109,48 @@ function getParticipants(params) {
19112
19109
  const matchUps = entriesResult.matchUps;
19113
19110
  participantMap = entriesResult.participantMap;
19114
19111
  const nextMatchUps = scheduleAnalysis ?? withPotentialMatchUps;
19115
- const processedParticipants = Object.values(participantMap).map(
19116
- ({
19117
- potentialMatchUps,
19118
- scheduleConflicts,
19119
- scheduleItems,
19120
- participant,
19121
- statistics,
19122
- opponents,
19123
- matchUps: matchUps2,
19124
- events,
19125
- draws
19126
- }) => {
19127
- const participantDraws = Object.values(draws);
19128
- const participantOpponents = Object.values(opponents);
19129
- if (withOpponents) {
19130
- participantDraws?.forEach((draw) => {
19131
- draw.opponents = participantOpponents.filter(
19132
- (opponent) => opponent.drawId === draw.drawId
19133
- );
19134
- });
19135
- }
19136
- return definedAttributes(
19137
- {
19138
- ...participant,
19139
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
19140
- draws: withDraws || withRankingProfile ? participantDraws : void 0,
19141
- events: withEvents || withRankingProfile ? Object.values(events) : void 0,
19142
- matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
19143
- opponents: withOpponents ? participantOpponents : void 0,
19144
- potentialMatchUps: nextMatchUps ? Object.values(potentialMatchUps) : void 0,
19145
- statistics: withStatistics ? Object.values(statistics) : void 0,
19146
- scheduleItems: withScheduleItems ? scheduleItems : void 0
19147
- },
19148
- false,
19149
- false,
19150
- true
19151
- );
19112
+ const processParticipant = ({
19113
+ potentialMatchUps,
19114
+ scheduleConflicts,
19115
+ scheduleItems,
19116
+ participant,
19117
+ statistics,
19118
+ opponents,
19119
+ matchUps: matchUps2,
19120
+ events,
19121
+ draws
19122
+ }) => {
19123
+ const participantDraws = Object.values(draws);
19124
+ const participantOpponents = Object.values(opponents);
19125
+ if (withOpponents) {
19126
+ participantDraws?.forEach((draw) => {
19127
+ draw.opponents = participantOpponents.filter(
19128
+ (opponent) => opponent.drawId === draw.drawId
19129
+ );
19130
+ });
19152
19131
  }
19153
- );
19132
+ return definedAttributes(
19133
+ {
19134
+ ...participant,
19135
+ scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
19136
+ draws: withDraws || withRankingProfile ? participantDraws : void 0,
19137
+ events: withEvents || withRankingProfile ? Object.values(events) : void 0,
19138
+ matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
19139
+ opponents: withOpponents ? participantOpponents : void 0,
19140
+ potentialMatchUps: nextMatchUps ? Object.values(potentialMatchUps) : void 0,
19141
+ statistics: withStatistics ? Object.values(statistics) : void 0,
19142
+ scheduleItems: withScheduleItems ? scheduleItems : void 0
19143
+ },
19144
+ false,
19145
+ false,
19146
+ true
19147
+ );
19148
+ };
19149
+ const ppMap = /* @__PURE__ */ new Map();
19150
+ for (const participantId of Object.keys(participantMap)) {
19151
+ ppMap.set(participantId, processParticipant(participantMap[participantId]));
19152
+ }
19153
+ const processedParticipants = [...ppMap.values()];
19154
19154
  const participantAttributes = policyDefinitions?.[POLICY_TYPE_PARTICIPANT];
19155
19155
  const template = participantAttributes?.participant;
19156
19156
  const filteredParticipants = filterParticipants({
@@ -19158,6 +19158,17 @@ function getParticipants(params) {
19158
19158
  participantFilters,
19159
19159
  tournamentRecord
19160
19160
  });
19161
+ if (withIndividualParticipants) {
19162
+ for (const participant of filteredParticipants) {
19163
+ for (const individualParticipantId of participant.individualParticipantIds ?? []) {
19164
+ if (!participant.individualParticipants)
19165
+ participant.individualParticipants = [];
19166
+ participant.individualParticipants.push(
19167
+ ppMap.get(individualParticipantId)
19168
+ );
19169
+ }
19170
+ }
19171
+ }
19161
19172
  const participants = template ? filteredParticipants.map(
19162
19173
  (source) => attributeFilter({ source, template })
19163
19174
  ) : filteredParticipants;