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.
@@ -1531,7 +1531,9 @@ type MappedParticipant = {
1531
1531
  eventId: string;
1532
1532
  drawId: string;
1533
1533
  }[];
1534
- scheduleConflicts: ScheduleConflict[];
1534
+ scheduleConflicts: {
1535
+ [key: string]: ScheduleConflict;
1536
+ };
1535
1537
  scheduleItems: any[];
1536
1538
  participant: HydratedParticipant & {
1537
1539
  groupParticipantIds: string[];
@@ -3544,15 +3544,16 @@ function addNationalityCode({
3544
3544
  persons.forEach(annotatePerson);
3545
3545
  }
3546
3546
 
3547
- function addIndividualParticipants({ participantMap }) {
3547
+ function addIndividualParticipants({ participantMap, template }) {
3548
3548
  const participantObjects = Object.values(participantMap);
3549
3549
  for (const participantObject of participantObjects) {
3550
3550
  const participant = participantObject.participant;
3551
3551
  if (participant.individualParticipantIds?.length) {
3552
3552
  participant.individualParticipants = [];
3553
3553
  for (const participantId of participant.individualParticipantIds) {
3554
+ const source = participantMap[participantId].participant;
3554
3555
  participant.individualParticipants.push(
3555
- participantMap[participantId].participant
3556
+ template ? attributeFilter({ template, source }) : source
3556
3557
  );
3557
3558
  }
3558
3559
  }
@@ -3693,8 +3694,10 @@ function getParticipantMap({
3693
3694
  withIOC
3694
3695
  });
3695
3696
  }
3696
- if (withIndividualParticipants)
3697
- addIndividualParticipants({ participantMap });
3697
+ if (withIndividualParticipants) {
3698
+ const template = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
3699
+ addIndividualParticipants({ participantMap, template });
3700
+ }
3698
3701
  return { participantMap };
3699
3702
  }
3700
3703
  function signedIn(participant) {
@@ -3754,7 +3757,7 @@ function initializeParticipantId({ participantMap, participantId }) {
3754
3757
  participantMap[participantId] = {
3755
3758
  structureParticipation: {},
3756
3759
  potentialMatchUps: {},
3757
- scheduleConflicts: [],
3760
+ scheduleConflicts: {},
3758
3761
  scheduleItems: [],
3759
3762
  participant: {
3760
3763
  groupParticipantIds: [],
@@ -11961,7 +11964,7 @@ function getEventSeedAssignments({
11961
11964
  }
11962
11965
 
11963
11966
  function processEventEntry({
11964
- extensionConversions,
11967
+ convertExtensions,
11965
11968
  seedAssignments,
11966
11969
  participant,
11967
11970
  withSeeding,
@@ -11971,10 +11974,8 @@ function processEventEntry({
11971
11974
  entry
11972
11975
  }) {
11973
11976
  const { entryStatus, entryStage, entryPosition, extensions } = entry;
11974
- const entryExtensions = extensions?.length ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
11977
+ const entryExtensions = extensions?.length && convertExtensions ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
11975
11978
  const attributes = Object.assign(entryExtensions, {
11976
- ...extensionConversions,
11977
- // this should be deprecated and clients should use derivedEventInfo
11978
11979
  entryPosition,
11979
11980
  entryStatus,
11980
11981
  entryStage,
@@ -12391,7 +12392,6 @@ function getParticipantEntries(params) {
12391
12392
  continue;
12392
12393
  const {
12393
12394
  drawDefinitions = [],
12394
- extensions = [],
12395
12395
  eventType,
12396
12396
  eventName,
12397
12397
  category,
@@ -12406,9 +12406,7 @@ function getParticipantEntries(params) {
12406
12406
  if (publishStatuses)
12407
12407
  eventsPublishStatuses[eventId] = publishStatuses;
12408
12408
  if (withEvents || withSeeding || withRankingProfile) {
12409
- const extensionConversions = convertExtensions ? Object.assign({}, ...extensionsToAttributes(extensions)) : {};
12410
12409
  derivedEventInfo[eventId] = {
12411
- ...extensionConversions,
12412
12410
  eventName,
12413
12411
  eventType,
12414
12412
  category,
@@ -12440,7 +12438,7 @@ function getParticipantEntries(params) {
12440
12438
  return;
12441
12439
  const participant = participantMap[id];
12442
12440
  processEventEntry({
12443
- extensionConversions,
12441
+ convertExtensions,
12444
12442
  seedAssignments,
12445
12443
  participant,
12446
12444
  withSeeding,
@@ -12822,15 +12820,16 @@ function getParticipantEntries(params) {
12822
12820
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
12823
12821
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
12824
12822
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
12825
- participantAggregator.scheduleConflicts.push({
12823
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
12824
+ participantAggregator.scheduleConflicts[key] = {
12826
12825
  priorScheduledMatchUpId: scheduleItem.matchUpId,
12827
12826
  matchUpIdWithConflict: consideredItem.matchUpId
12828
- });
12827
+ };
12829
12828
  }
12830
12829
  }
12831
12830
  }
12832
12831
  const pid = participantAggregator.participant.participantId;
12833
- if (participantAggregator.scheduleConflicts.length) {
12832
+ if (Object.keys(participantAggregator.scheduleConflicts).length) {
12834
12833
  participantIdsWithConflicts.push(pid);
12835
12834
  }
12836
12835
  participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
@@ -12941,7 +12940,7 @@ function getParticipants(params) {
12941
12940
  return definedAttributes(
12942
12941
  {
12943
12942
  ...participant,
12944
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
12943
+ scheduleConflicts: scheduleAnalysis ? Object.values(scheduleConflicts) : void 0,
12945
12944
  draws: withDraws || withRankingProfile ? participantDraws : void 0,
12946
12945
  events: withEvents || withRankingProfile ? Object.values(events) : void 0,
12947
12946
  matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
@@ -12968,12 +12967,14 @@ function getParticipants(params) {
12968
12967
  tournamentRecord
12969
12968
  });
12970
12969
  if (withIndividualParticipants) {
12970
+ const template2 = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
12971
12971
  for (const participant of filteredParticipants) {
12972
12972
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
12973
12973
  if (!participant.individualParticipants)
12974
12974
  participant.individualParticipants = [];
12975
+ const source = ppMap.get(individualParticipantId);
12975
12976
  participant.individualParticipants.push(
12976
- ppMap.get(individualParticipantId)
12977
+ template2 ? attributeFilter({ template: template2, source }) : source
12977
12978
  );
12978
12979
  }
12979
12980
  }