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.
@@ -2215,10 +2215,8 @@ declare function allEventMatchUps(params: GetMatchUpsArgs): {
2215
2215
  code: string;
2216
2216
  };
2217
2217
  matchUps?: undefined;
2218
- eventMatchUps?: undefined;
2219
2218
  } | {
2220
2219
  matchUps: HydratedMatchUp[];
2221
- eventMatchUps: MatchUp[];
2222
2220
  error?: undefined;
2223
2221
  };
2224
2222
  declare function tournamentMatchUps(params: GetMatchUpsArgs): GroupsMatchUpsResult;
@@ -3536,6 +3536,21 @@ function addNationalityCode({
3536
3536
  persons.forEach(annotatePerson);
3537
3537
  }
3538
3538
 
3539
+ function addIndividualParticipants({ participantMap }) {
3540
+ const participantObjects = Object.values(participantMap);
3541
+ for (const participantObject of participantObjects) {
3542
+ const participant = participantObject.participant;
3543
+ if (participant.individualParticipantIds?.length) {
3544
+ participant.individualParticipants = [];
3545
+ for (const participantId of participant.individualParticipantIds) {
3546
+ participant.individualParticipants.push(
3547
+ participantMap[participantId].participant
3548
+ );
3549
+ }
3550
+ }
3551
+ }
3552
+ }
3553
+
3539
3554
  function getTimeItem({
3540
3555
  returnPreviousValues,
3541
3556
  itemSubTypes,
@@ -3681,20 +3696,6 @@ function signedIn(participant) {
3681
3696
  });
3682
3697
  return timeItem?.itemValue === SIGNED_IN;
3683
3698
  }
3684
- function addIndividualParticipants({ participantMap }) {
3685
- const participantObjects = Object.values(participantMap);
3686
- for (const participantObject of participantObjects) {
3687
- const participant = participantObject.participant;
3688
- if (participant.individualParticipantIds?.length) {
3689
- participant.individualParticipants = [];
3690
- for (const participantId of participant.individualParticipantIds) {
3691
- participant.individualParticipants.push(
3692
- participantMap[participantId].participant
3693
- );
3694
- }
3695
- }
3696
- }
3697
- }
3698
3699
  function processIndividualParticipantIds({
3699
3700
  individualParticipantIds,
3700
3701
  participantCopy,
@@ -7821,7 +7822,6 @@ function allEventMatchUps(params) {
7821
7822
  if (!event)
7822
7823
  return { error: MISSING_EVENT };
7823
7824
  const { eventId, eventName, endDate, category, gender, matchUpFormat } = event;
7824
- const eventMatchUps2 = [];
7825
7825
  const additionalContext = {
7826
7826
  ...context,
7827
7827
  ...definedAttributes({
@@ -7865,7 +7865,7 @@ function allEventMatchUps(params) {
7865
7865
  }).scheduleTiming;
7866
7866
  const matchUps = drawDefinitions.flatMap(
7867
7867
  (drawDefinition) => {
7868
- const { matchUps: matchUps2, matchUpsMap } = getAllDrawMatchUps({
7868
+ const { matchUps: matchUps2 } = getAllDrawMatchUps({
7869
7869
  tournamentParticipants: participants,
7870
7870
  tournamentAppliedPolicies,
7871
7871
  scheduleVisibilityFilters,
@@ -7885,12 +7885,10 @@ function allEventMatchUps(params) {
7885
7885
  inContext,
7886
7886
  event
7887
7887
  });
7888
- if (matchUpsMap?.drawMatchUps)
7889
- eventMatchUps2.push(...matchUpsMap.drawMatchUps);
7890
7888
  return matchUps2 ?? [];
7891
7889
  }
7892
7890
  );
7893
- return { matchUps, eventMatchUps: eventMatchUps2 };
7891
+ return { matchUps };
7894
7892
  }
7895
7893
  function tournamentMatchUps(params) {
7896
7894
  if (!params?.tournamentRecord)
@@ -12767,7 +12765,6 @@ function getParticipants(params) {
12767
12765
  getMatchUpDependencies({ tournamentRecord });
12768
12766
  }
12769
12767
  let { participantMap } = getParticipantMap({
12770
- withIndividualParticipants,
12771
12768
  convertExtensions,
12772
12769
  tournamentRecord,
12773
12770
  withSignInStatus,
@@ -12806,45 +12803,48 @@ function getParticipants(params) {
12806
12803
  const matchUps = entriesResult.matchUps;
12807
12804
  participantMap = entriesResult.participantMap;
12808
12805
  const nextMatchUps = scheduleAnalysis ?? withPotentialMatchUps;
12809
- const processedParticipants = Object.values(participantMap).map(
12810
- ({
12811
- potentialMatchUps,
12812
- scheduleConflicts,
12813
- scheduleItems,
12814
- participant,
12815
- statistics,
12816
- opponents,
12817
- matchUps: matchUps2,
12818
- events,
12819
- draws
12820
- }) => {
12821
- const participantDraws = Object.values(draws);
12822
- const participantOpponents = Object.values(opponents);
12823
- if (withOpponents) {
12824
- participantDraws?.forEach((draw) => {
12825
- draw.opponents = participantOpponents.filter(
12826
- (opponent) => opponent.drawId === draw.drawId
12827
- );
12828
- });
12829
- }
12830
- return definedAttributes(
12831
- {
12832
- ...participant,
12833
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
12834
- draws: withDraws || withRankingProfile ? participantDraws : void 0,
12835
- events: withEvents || withRankingProfile ? Object.values(events) : void 0,
12836
- matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
12837
- opponents: withOpponents ? participantOpponents : void 0,
12838
- potentialMatchUps: nextMatchUps ? Object.values(potentialMatchUps) : void 0,
12839
- statistics: withStatistics ? Object.values(statistics) : void 0,
12840
- scheduleItems: withScheduleItems ? scheduleItems : void 0
12841
- },
12842
- false,
12843
- false,
12844
- true
12845
- );
12806
+ const processParticipant = ({
12807
+ potentialMatchUps,
12808
+ scheduleConflicts,
12809
+ scheduleItems,
12810
+ participant,
12811
+ statistics,
12812
+ opponents,
12813
+ matchUps: matchUps2,
12814
+ events,
12815
+ draws
12816
+ }) => {
12817
+ const participantDraws = Object.values(draws);
12818
+ const participantOpponents = Object.values(opponents);
12819
+ if (withOpponents) {
12820
+ participantDraws?.forEach((draw) => {
12821
+ draw.opponents = participantOpponents.filter(
12822
+ (opponent) => opponent.drawId === draw.drawId
12823
+ );
12824
+ });
12846
12825
  }
12847
- );
12826
+ return definedAttributes(
12827
+ {
12828
+ ...participant,
12829
+ scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
12830
+ draws: withDraws || withRankingProfile ? participantDraws : void 0,
12831
+ events: withEvents || withRankingProfile ? Object.values(events) : void 0,
12832
+ matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
12833
+ opponents: withOpponents ? participantOpponents : void 0,
12834
+ potentialMatchUps: nextMatchUps ? Object.values(potentialMatchUps) : void 0,
12835
+ statistics: withStatistics ? Object.values(statistics) : void 0,
12836
+ scheduleItems: withScheduleItems ? scheduleItems : void 0
12837
+ },
12838
+ false,
12839
+ false,
12840
+ true
12841
+ );
12842
+ };
12843
+ const ppMap = /* @__PURE__ */ new Map();
12844
+ for (const participantId of Object.keys(participantMap)) {
12845
+ ppMap.set(participantId, processParticipant(participantMap[participantId]));
12846
+ }
12847
+ const processedParticipants = [...ppMap.values()];
12848
12848
  const participantAttributes = policyDefinitions?.[POLICY_TYPE_PARTICIPANT];
12849
12849
  const template = participantAttributes?.participant;
12850
12850
  const filteredParticipants = filterParticipants({
@@ -12852,6 +12852,17 @@ function getParticipants(params) {
12852
12852
  participantFilters,
12853
12853
  tournamentRecord
12854
12854
  });
12855
+ if (withIndividualParticipants) {
12856
+ for (const participant of filteredParticipants) {
12857
+ for (const individualParticipantId of participant.individualParticipantIds ?? []) {
12858
+ if (!participant.individualParticipants)
12859
+ participant.individualParticipants = [];
12860
+ participant.individualParticipants.push(
12861
+ ppMap.get(individualParticipantId)
12862
+ );
12863
+ }
12864
+ }
12865
+ }
12855
12866
  const participants = template ? filteredParticipants.map(
12856
12867
  (source) => attributeFilter({ source, template })
12857
12868
  ) : filteredParticipants;