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.
package/dist/index.mjs CHANGED
@@ -2404,7 +2404,7 @@ const matchUpFormatCode = {
2404
2404
  };
2405
2405
 
2406
2406
  function factoryVersion() {
2407
- return "1.8.35";
2407
+ return "1.8.37";
2408
2408
  }
2409
2409
 
2410
2410
  function getObjectTieFormat(obj) {
@@ -15787,15 +15787,16 @@ function addNationalityCode({
15787
15787
  persons.forEach(annotatePerson);
15788
15788
  }
15789
15789
 
15790
- function addIndividualParticipants({ participantMap }) {
15790
+ function addIndividualParticipants({ participantMap, template }) {
15791
15791
  const participantObjects = Object.values(participantMap);
15792
15792
  for (const participantObject of participantObjects) {
15793
15793
  const participant = participantObject.participant;
15794
15794
  if (participant.individualParticipantIds?.length) {
15795
15795
  participant.individualParticipants = [];
15796
15796
  for (const participantId of participant.individualParticipantIds) {
15797
+ const source = participantMap[participantId].participant;
15797
15798
  participant.individualParticipants.push(
15798
- participantMap[participantId].participant
15799
+ template ? attributeFilter({ template, source }) : source
15799
15800
  );
15800
15801
  }
15801
15802
  }
@@ -15972,8 +15973,10 @@ function getParticipantMap({
15972
15973
  withIOC
15973
15974
  });
15974
15975
  }
15975
- if (withIndividualParticipants)
15976
- addIndividualParticipants({ participantMap });
15976
+ if (withIndividualParticipants) {
15977
+ const template = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
15978
+ addIndividualParticipants({ participantMap, template });
15979
+ }
15977
15980
  return { participantMap };
15978
15981
  }
15979
15982
  function signedIn(participant) {
@@ -16033,7 +16036,7 @@ function initializeParticipantId({ participantMap, participantId }) {
16033
16036
  participantMap[participantId] = {
16034
16037
  structureParticipation: {},
16035
16038
  potentialMatchUps: {},
16036
- scheduleConflicts: [],
16039
+ scheduleConflicts: {},
16037
16040
  scheduleItems: [],
16038
16041
  participant: {
16039
16042
  groupParticipantIds: [],
@@ -27548,12 +27551,11 @@ function getParticipantEntries(params) {
27548
27551
  const targetParticipantIds = participantFilters?.participantIds;
27549
27552
  const getRelevantParticipantIds = (participantId) => {
27550
27553
  const relevantParticipantIds = [participantId];
27551
- relevantParticipantIds.push(participantId);
27552
27554
  participantMap[participantId]?.participant.individualParticipantIds?.forEach(
27553
27555
  (individualParticiapntId) => relevantParticipantIds.push(individualParticiapntId)
27554
27556
  );
27555
27557
  return relevantParticipantIds.some(
27556
- (obj) => !targetParticipantIds?.length || targetParticipantIds.includes(obj.relevantParticipantId)
27558
+ (id) => !targetParticipantIds?.length || targetParticipantIds.includes(id)
27557
27559
  ) ? relevantParticipantIds : [];
27558
27560
  };
27559
27561
  const withOpts = {
@@ -28015,15 +28017,16 @@ function getParticipantEntries(params) {
28015
28017
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
28016
28018
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
28017
28019
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
28018
- participantAggregator.scheduleConflicts.push({
28020
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
28021
+ participantAggregator.scheduleConflicts[key] = {
28019
28022
  priorScheduledMatchUpId: scheduleItem.matchUpId,
28020
28023
  matchUpIdWithConflict: consideredItem.matchUpId
28021
- });
28024
+ };
28022
28025
  }
28023
28026
  }
28024
28027
  }
28025
28028
  const pid = participantAggregator.participant.participantId;
28026
- if (participantAggregator.scheduleConflicts.length) {
28029
+ if (Object.keys(participantAggregator.scheduleConflicts).length) {
28027
28030
  participantIdsWithConflicts.push(pid);
28028
28031
  }
28029
28032
  participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
@@ -28251,7 +28254,7 @@ function getParticipants$1(params) {
28251
28254
  return definedAttributes(
28252
28255
  {
28253
28256
  ...participant,
28254
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
28257
+ scheduleConflicts: scheduleAnalysis ? Object.values(scheduleConflicts) : void 0,
28255
28258
  draws: withDraws || withRankingProfile ? participantDraws : void 0,
28256
28259
  events: withEvents || withRankingProfile ? Object.values(events) : void 0,
28257
28260
  matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
@@ -28278,12 +28281,14 @@ function getParticipants$1(params) {
28278
28281
  tournamentRecord
28279
28282
  });
28280
28283
  if (withIndividualParticipants) {
28284
+ const template2 = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
28281
28285
  for (const participant of filteredParticipants) {
28282
28286
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
28283
28287
  if (!participant.individualParticipants)
28284
28288
  participant.individualParticipants = [];
28289
+ const source = ppMap.get(individualParticipantId);
28285
28290
  participant.individualParticipants.push(
28286
- ppMap.get(individualParticipantId)
28291
+ template2 ? attributeFilter({ template: template2, source }) : source
28287
28292
  );
28288
28293
  }
28289
28294
  }
@@ -41813,11 +41818,11 @@ function swapAssignedPositions({
41813
41818
  );
41814
41819
  const secondAssignment = candidatePositionAssignments.find(
41815
41820
  (assignment) => assignment.drawPosition === secondPosition
41816
- );
41821
+ ) ?? {};
41817
41822
  const updatedFirstAssignmentAttributes = {
41818
- participantId: secondAssignment.participantId,
41819
- qualifier: secondAssignment.qualifier,
41820
- bye: secondAssignment.bye
41823
+ participantId: secondAssignment?.participantId,
41824
+ qualifier: secondAssignment?.qualifier,
41825
+ bye: secondAssignment?.bye
41821
41826
  };
41822
41827
  const updatedSecondAssignmentAttributes = {
41823
41828
  participantId: firstAssignment.participantId,
@@ -41975,7 +41980,7 @@ function randomUnseededSeparation({
41975
41980
  });
41976
41981
  if (result.error)
41977
41982
  return decorateResult({ result, stack });
41978
- } else {
41983
+ } else if (assignment.participantId) {
41979
41984
  const result = assignDrawPosition$1({
41980
41985
  automaticPlacement: true,
41981
41986
  inContextDrawMatchUps,
@@ -44561,7 +44566,7 @@ function removeStructure({
44561
44566
  drawDefinition.links = drawDefinition.links?.filter(
44562
44567
  (link) => link.source.structureId !== idBeingRemoved && link.target.structureId !== idBeingRemoved
44563
44568
  ) || [];
44564
- if (!isMainStageSequence1 || idBeingRemoved !== structureId) {
44569
+ if (!isMainStageSequence1 || isMainStageSequence1 && qualifyingStructureIds.length || idBeingRemoved !== structureId) {
44565
44570
  drawDefinition.structures = (drawDefinition.structures ?? []).filter(
44566
44571
  (structure3) => {
44567
44572
  if (idBeingRemoved && idBeingRemoved === structure3.structureId)
@@ -62172,6 +62177,7 @@ var lastNames = [
62172
62177
  "Ampleforth",
62173
62178
  "Atreides",
62174
62179
  "Austen",
62180
+ "Bach",
62175
62181
  "Banks",
62176
62182
  "Barrington",
62177
62183
  "Batty",
@@ -62202,6 +62208,7 @@ var lastNames = [
62202
62208
  "Eisenstein",
62203
62209
  "Eldritch",
62204
62210
  "Elliot",
62211
+ "Escher",
62205
62212
  "Eyre",
62206
62213
  "Faulkner",
62207
62214
  "Fukuoka",
@@ -62371,6 +62378,7 @@ var firstMale = [
62371
62378
  "James",
62372
62379
  "Jared",
62373
62380
  "Joe",
62381
+ "Johann",
62374
62382
  "Julian",
62375
62383
  "John Michael",
62376
62384
  "Jonathan",
@@ -62381,6 +62389,7 @@ var firstMale = [
62381
62389
  "Malachi",
62382
62390
  "Mark",
62383
62391
  "Masanobu",
62392
+ "Maurits",
62384
62393
  "Michael",
62385
62394
  "Mustapha",
62386
62395
  "Neil",