tods-competition-factory 1.8.35 → 1.8.37

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.
@@ -7707,15 +7707,16 @@ function addNationalityCode({
7707
7707
  persons.forEach(annotatePerson);
7708
7708
  }
7709
7709
 
7710
- function addIndividualParticipants({ participantMap }) {
7710
+ function addIndividualParticipants({ participantMap, template }) {
7711
7711
  const participantObjects = Object.values(participantMap);
7712
7712
  for (const participantObject of participantObjects) {
7713
7713
  const participant = participantObject.participant;
7714
7714
  if (participant.individualParticipantIds?.length) {
7715
7715
  participant.individualParticipants = [];
7716
7716
  for (const participantId of participant.individualParticipantIds) {
7717
+ const source = participantMap[participantId].participant;
7717
7718
  participant.individualParticipants.push(
7718
- participantMap[participantId].participant
7719
+ template ? attributeFilter({ template, source }) : source
7719
7720
  );
7720
7721
  }
7721
7722
  }
@@ -7813,8 +7814,10 @@ function getParticipantMap({
7813
7814
  withIOC
7814
7815
  });
7815
7816
  }
7816
- if (withIndividualParticipants)
7817
- addIndividualParticipants({ participantMap });
7817
+ if (withIndividualParticipants) {
7818
+ const template = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
7819
+ addIndividualParticipants({ participantMap, template });
7820
+ }
7818
7821
  return { participantMap };
7819
7822
  }
7820
7823
  function signedIn(participant) {
@@ -7874,7 +7877,7 @@ function initializeParticipantId({ participantMap, participantId }) {
7874
7877
  participantMap[participantId] = {
7875
7878
  structureParticipation: {},
7876
7879
  potentialMatchUps: {},
7877
- scheduleConflicts: [],
7880
+ scheduleConflicts: {},
7878
7881
  scheduleItems: [],
7879
7882
  participant: {
7880
7883
  groupParticipantIds: [],
@@ -10748,11 +10751,11 @@ function swapAssignedPositions({
10748
10751
  );
10749
10752
  const secondAssignment = candidatePositionAssignments.find(
10750
10753
  (assignment) => assignment.drawPosition === secondPosition
10751
- );
10754
+ ) ?? {};
10752
10755
  const updatedFirstAssignmentAttributes = {
10753
- participantId: secondAssignment.participantId,
10754
- qualifier: secondAssignment.qualifier,
10755
- bye: secondAssignment.bye
10756
+ participantId: secondAssignment?.participantId,
10757
+ qualifier: secondAssignment?.qualifier,
10758
+ bye: secondAssignment?.bye
10756
10759
  };
10757
10760
  const updatedSecondAssignmentAttributes = {
10758
10761
  participantId: firstAssignment.participantId,
@@ -12233,7 +12236,7 @@ function randomUnseededSeparation({
12233
12236
  });
12234
12237
  if (result.error)
12235
12238
  return decorateResult({ result, stack });
12236
- } else {
12239
+ } else if (assignment.participantId) {
12237
12240
  const result = assignDrawPosition({
12238
12241
  automaticPlacement: true,
12239
12242
  inContextDrawMatchUps,
@@ -18752,12 +18755,11 @@ function getParticipantEntries(params) {
18752
18755
  const targetParticipantIds = participantFilters?.participantIds;
18753
18756
  const getRelevantParticipantIds = (participantId) => {
18754
18757
  const relevantParticipantIds = [participantId];
18755
- relevantParticipantIds.push(participantId);
18756
18758
  participantMap[participantId]?.participant.individualParticipantIds?.forEach(
18757
18759
  (individualParticiapntId) => relevantParticipantIds.push(individualParticiapntId)
18758
18760
  );
18759
18761
  return relevantParticipantIds.some(
18760
- (obj) => !targetParticipantIds?.length || targetParticipantIds.includes(obj.relevantParticipantId)
18762
+ (id) => !targetParticipantIds?.length || targetParticipantIds.includes(id)
18761
18763
  ) ? relevantParticipantIds : [];
18762
18764
  };
18763
18765
  const withOpts = {
@@ -19219,15 +19221,16 @@ function getParticipantEntries(params) {
19219
19221
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
19220
19222
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
19221
19223
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
19222
- participantAggregator.scheduleConflicts.push({
19224
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
19225
+ participantAggregator.scheduleConflicts[key] = {
19223
19226
  priorScheduledMatchUpId: scheduleItem.matchUpId,
19224
19227
  matchUpIdWithConflict: consideredItem.matchUpId
19225
- });
19228
+ };
19226
19229
  }
19227
19230
  }
19228
19231
  }
19229
19232
  const pid = participantAggregator.participant.participantId;
19230
- if (participantAggregator.scheduleConflicts.length) {
19233
+ if (Object.keys(participantAggregator.scheduleConflicts).length) {
19231
19234
  participantIdsWithConflicts.push(pid);
19232
19235
  }
19233
19236
  participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
@@ -19455,7 +19458,7 @@ function getParticipants(params) {
19455
19458
  return definedAttributes(
19456
19459
  {
19457
19460
  ...participant,
19458
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
19461
+ scheduleConflicts: scheduleAnalysis ? Object.values(scheduleConflicts) : void 0,
19459
19462
  draws: withDraws || withRankingProfile ? participantDraws : void 0,
19460
19463
  events: withEvents || withRankingProfile ? Object.values(events) : void 0,
19461
19464
  matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
@@ -19482,12 +19485,14 @@ function getParticipants(params) {
19482
19485
  tournamentRecord
19483
19486
  });
19484
19487
  if (withIndividualParticipants) {
19488
+ const template2 = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
19485
19489
  for (const participant of filteredParticipants) {
19486
19490
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
19487
19491
  if (!participant.individualParticipants)
19488
19492
  participant.individualParticipants = [];
19493
+ const source = ppMap.get(individualParticipantId);
19489
19494
  participant.individualParticipants.push(
19490
- ppMap.get(individualParticipantId)
19495
+ template2 ? attributeFilter({ template: template2, source }) : source
19491
19496
  );
19492
19497
  }
19493
19498
  }