tods-competition-factory 1.8.36 → 1.8.38

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: [],
@@ -18357,7 +18360,7 @@ function getEventSeedAssignments({
18357
18360
  }
18358
18361
 
18359
18362
  function processEventEntry({
18360
- extensionConversions,
18363
+ convertExtensions,
18361
18364
  seedAssignments,
18362
18365
  participant,
18363
18366
  withSeeding,
@@ -18367,10 +18370,8 @@ function processEventEntry({
18367
18370
  entry
18368
18371
  }) {
18369
18372
  const { entryStatus, entryStage, entryPosition, extensions } = entry;
18370
- const entryExtensions = extensions?.length ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
18373
+ const entryExtensions = extensions?.length && convertExtensions ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
18371
18374
  const attributes = Object.assign(entryExtensions, {
18372
- ...extensionConversions,
18373
- // this should be deprecated and clients should use derivedEventInfo
18374
18375
  entryPosition,
18375
18376
  entryStatus,
18376
18377
  entryStage,
@@ -18787,7 +18788,6 @@ function getParticipantEntries(params) {
18787
18788
  continue;
18788
18789
  const {
18789
18790
  drawDefinitions = [],
18790
- extensions = [],
18791
18791
  eventType,
18792
18792
  eventName,
18793
18793
  category,
@@ -18802,9 +18802,7 @@ function getParticipantEntries(params) {
18802
18802
  if (publishStatuses)
18803
18803
  eventsPublishStatuses[eventId] = publishStatuses;
18804
18804
  if (withEvents || withSeeding || withRankingProfile) {
18805
- const extensionConversions = convertExtensions ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
18806
18805
  derivedEventInfo[eventId] = {
18807
- ...extensionConversions,
18808
18806
  eventName,
18809
18807
  eventType,
18810
18808
  category,
@@ -18836,7 +18834,7 @@ function getParticipantEntries(params) {
18836
18834
  return;
18837
18835
  const participant = participantMap[id];
18838
18836
  processEventEntry({
18839
- extensionConversions,
18837
+ convertExtensions,
18840
18838
  seedAssignments,
18841
18839
  participant,
18842
18840
  withSeeding,
@@ -19218,15 +19216,16 @@ function getParticipantEntries(params) {
19218
19216
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
19219
19217
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
19220
19218
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
19221
- participantAggregator.scheduleConflicts.push({
19219
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
19220
+ participantAggregator.scheduleConflicts[key] = {
19222
19221
  priorScheduledMatchUpId: scheduleItem.matchUpId,
19223
19222
  matchUpIdWithConflict: consideredItem.matchUpId
19224
- });
19223
+ };
19225
19224
  }
19226
19225
  }
19227
19226
  }
19228
19227
  const pid = participantAggregator.participant.participantId;
19229
- if (participantAggregator.scheduleConflicts.length) {
19228
+ if (Object.keys(participantAggregator.scheduleConflicts).length) {
19230
19229
  participantIdsWithConflicts.push(pid);
19231
19230
  }
19232
19231
  participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
@@ -19454,7 +19453,7 @@ function getParticipants(params) {
19454
19453
  return definedAttributes(
19455
19454
  {
19456
19455
  ...participant,
19457
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
19456
+ scheduleConflicts: scheduleAnalysis ? Object.values(scheduleConflicts) : void 0,
19458
19457
  draws: withDraws || withRankingProfile ? participantDraws : void 0,
19459
19458
  events: withEvents || withRankingProfile ? Object.values(events) : void 0,
19460
19459
  matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
@@ -19481,12 +19480,14 @@ function getParticipants(params) {
19481
19480
  tournamentRecord
19482
19481
  });
19483
19482
  if (withIndividualParticipants) {
19483
+ const template2 = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
19484
19484
  for (const participant of filteredParticipants) {
19485
19485
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
19486
19486
  if (!participant.individualParticipants)
19487
19487
  participant.individualParticipants = [];
19488
+ const source = ppMap.get(individualParticipantId);
19488
19489
  participant.individualParticipants.push(
19489
- ppMap.get(individualParticipantId)
19490
+ template2 ? attributeFilter({ template: template2, source }) : source
19490
19491
  );
19491
19492
  }
19492
19493
  }