tods-competition-factory 0.65.1 → 0.65.2

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.
@@ -248,6 +248,10 @@ const matchUpFormatCode = {
248
248
  parse
249
249
  };
250
250
 
251
+ function factoryVersion() {
252
+ return '0.65.2';
253
+ }
254
+
251
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
252
256
 
253
257
  const FORMAT_STANDARD_NOAD = 'SET3-S:6NOAD'; // Best of 3 NOAD Sets to 6 with deciding game at 5-5
@@ -11375,7 +11379,7 @@ function getAllStructureMatchUps({
11375
11379
  matchUp,
11376
11380
  event
11377
11381
  }) {
11378
- var _roundNamingProfile$r, _roundNamingProfile$r2;
11382
+ var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2;
11379
11383
 
11380
11384
  const tieFormat = matchUp.tieFormat || structure.tieFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat);
11381
11385
  const collectionDefinitions = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions;
@@ -11415,7 +11419,8 @@ function getAllStructureMatchUps({
11415
11419
  });
11416
11420
  const roundName = roundNamingProfile && ((_roundNamingProfile$r = roundNamingProfile[roundNumber]) === null || _roundNamingProfile$r === void 0 ? void 0 : _roundNamingProfile$r.roundName) || additionalContext.roundName;
11417
11421
  const abbreviatedRoundName = roundNamingProfile && ((_roundNamingProfile$r2 = roundNamingProfile[roundNumber]) === null || _roundNamingProfile$r2 === void 0 ? void 0 : _roundNamingProfile$r2.abbreviatedRoundName) || additionalContext.abbreviatedRoundName;
11418
- const feedRound = roundProfile && roundProfile[roundNumber] && roundProfile[roundNumber].feedRound;
11422
+ const feedRound = roundProfile === null || roundProfile === void 0 ? void 0 : (_roundProfile$roundNu = roundProfile[roundNumber]) === null || _roundProfile$roundNu === void 0 ? void 0 : _roundProfile$roundNu.feedRound;
11423
+ const preFeedRound = roundProfile === null || roundProfile === void 0 ? void 0 : (_roundProfile$roundNu2 = roundProfile[roundNumber]) === null || _roundProfile$roundNu2 === void 0 ? void 0 : _roundProfile$roundNu2.preFeedRound;
11419
11424
  const drawPositionsRoundRanges = drawPositionsRanges && drawPositionsRanges[roundNumber];
11420
11425
  const drawPositionsRange = drawPositionsRoundRanges && drawPositionsRoundRanges[roundPosition];
11421
11426
  const sourceDrawPositionRoundRanges = sourceDrawPositionRanges && sourceDrawPositionRanges[roundNumber]; // order is important here as Round Robin matchUps already have inContext structureId
@@ -11433,6 +11438,7 @@ function getAllStructureMatchUps({
11433
11438
  drawPositions,
11434
11439
  matchUpStatus,
11435
11440
  matchUpTieId,
11441
+ preFeedRound,
11436
11442
  matchUpType,
11437
11443
  exitProfile,
11438
11444
  structureId,
@@ -28039,10 +28045,6 @@ const scheduleGovernor$1 = {
28039
28045
  removePersonRequests
28040
28046
  };
28041
28047
 
28042
- function factoryVersion() {
28043
- return '0.65.1';
28044
- }
28045
-
28046
28048
  function attachPolicies$2({
28047
28049
  tournamentRecord,
28048
28050
  policyDefinitions,
@@ -36441,6 +36443,7 @@ function generateDrawMaticRound({
36441
36443
  const {
36442
36444
  participantIdPairings
36443
36445
  } = eventType === DOUBLES ? getDoublesPairings(params) : getSinglesPairings(params);
36446
+ console.log(participantIdPairings);
36444
36447
 
36445
36448
  for (const [index, matchUp] of roundMatchUps.entries()) {
36446
36449
  const drawPositions = matchUp.drawPositions;
@@ -36601,13 +36604,16 @@ function drawMatic$1({
36601
36604
  matchUpIds,
36602
36605
  scaleName,
36603
36606
  // custom rating name to seed dynamic ratings
36604
- eventType
36607
+ event
36605
36608
  }) {
36606
36609
  var _drawDefinition$struc2;
36607
36610
 
36608
36611
  if (typeof drawDefinition !== 'object') return {
36609
36612
  error: INVALID_DRAW_DEFINITION
36610
36613
  };
36614
+ const {
36615
+ eventType
36616
+ } = event || {};
36611
36617
  const enteredParticipantIds = drawDefinition.entries.filter(({
36612
36618
  entryStatus
36613
36619
  }) => !restrictEntryStatus || [DIRECT_ACCEPTANCE, ORGANISER_ACCEPTANCE, WILDCARD].includes(entryStatus)).map(getParticipantId);
@@ -50145,6 +50151,7 @@ function generateParticipants({
50145
50151
  participantsCount = 32,
50146
50152
  participantType,
50147
50153
  personIds,
50154
+ idPrefix,
50148
50155
  uuids,
50149
50156
  personExtensions,
50150
50157
  addressProps,
@@ -50274,12 +50281,18 @@ function generateParticipants({
50274
50281
  });
50275
50282
  const individualParticipantIds = individualParticipants.map(participant => participant.participantId);
50276
50283
  const pairName = individualParticipants.map(i => i.person.standardFamilyName).join('/');
50284
+ const participantType = doubles ? PAIR$1 : TEAM$1;
50277
50285
  const groupParticipant = {
50278
- participantId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
50279
- participantType: doubles ? PAIR$1 : TEAM$1,
50286
+ participantId: genParticipantId({
50287
+ participantType,
50288
+ idPrefix,
50289
+ index: i,
50290
+ uuids
50291
+ }),
50280
50292
  participantRole: COMPETITOR,
50281
50293
  participantName: doubles ? pairName : teamNames[i],
50282
- individualParticipantIds
50294
+ individualParticipantIds,
50295
+ participantType
50283
50296
  };
50284
50297
  if (inContext) groupParticipant.individualParticipants = individualParticipants;
50285
50298
  return doubles || team ? [groupParticipant, ...individualParticipants] : individualParticipants;
@@ -50319,7 +50332,12 @@ function generateParticipants({
50319
50332
  nationalityCode
50320
50333
  });
50321
50334
  const participant = definedAttributes({
50322
- participantId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID(),
50335
+ participantId: genParticipantId({
50336
+ participantType: INDIVIDUAL$1,
50337
+ index: participantIndex,
50338
+ idPrefix,
50339
+ uuids
50340
+ }),
50323
50341
  extensions: participantExtensions,
50324
50342
  timeItems: participantTimeItems,
50325
50343
  participantRole: COMPETITOR,
@@ -50404,6 +50422,16 @@ function addScaleItem({
50404
50422
  }
50405
50423
  }
50406
50424
 
50425
+ function genParticipantId({
50426
+ idPrefix,
50427
+ participantType,
50428
+ index,
50429
+ uuids
50430
+ }) {
50431
+ const type = participantType === INDIVIDUAL$1 ? 'I' : 'P' ;
50432
+ return idPrefix ? `${idPrefix}-${type}-${index}` : (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID();
50433
+ }
50434
+
50407
50435
  function processTieFormat({
50408
50436
  tieFormat,
50409
50437
  tieFormatName,
@@ -50574,7 +50602,7 @@ function getParticipantsCount({
50574
50602
  }
50575
50603
 
50576
50604
  function addTournamentParticipants({
50577
- participantsProfile,
50605
+ participantsProfile = {},
50578
50606
  tournamentRecord,
50579
50607
  eventProfiles,
50580
50608
  drawProfiles,
@@ -50592,35 +50620,16 @@ function addTournamentParticipants({
50592
50620
  drawProfiles
50593
50621
  });
50594
50622
  const {
50595
- nationalityCodesCount,
50596
- nationalityCodeType,
50597
- valuesInstanceLimit,
50598
- nationalityCodes,
50599
- personExtensions,
50600
- addressProps,
50601
- personData,
50602
- personIds,
50603
- inContext,
50604
- teamKey,
50605
- sex
50623
+ teamKey
50606
50624
  } = participantsProfile || {};
50607
50625
  const {
50608
50626
  participants
50609
50627
  } = generateParticipants({
50628
+ uuids,
50629
+ ...participantsProfile,
50610
50630
  consideredDate: startDate,
50611
- valuesInstanceLimit,
50612
- nationalityCodesCount,
50613
- nationalityCodeType,
50614
- nationalityCodes,
50615
- personExtensions,
50616
- addressProps,
50617
- personData,
50618
- sex,
50619
50631
  participantsCount,
50620
- participantType,
50621
- personIds,
50622
- uuids,
50623
- inContext
50632
+ participantType
50624
50633
  });
50625
50634
  let result = addParticipants({
50626
50635
  tournamentRecord,
@@ -50657,11 +50666,12 @@ function addTournamentParticipants({
50657
50666
  }
50658
50667
 
50659
50668
  function generateEventParticipants({
50669
+ participantsProfile = {},
50660
50670
  uniqueParticipantsCount,
50661
- participantsProfile,
50662
50671
  ratingsParameters,
50663
50672
  tournamentRecord,
50664
50673
  eventProfile,
50674
+ eventIndex,
50665
50675
  event,
50666
50676
  uuids
50667
50677
  }) {
@@ -50670,38 +50680,25 @@ function generateEventParticipants({
50670
50680
  gender,
50671
50681
  eventType
50672
50682
  } = event;
50673
- const {
50674
- valuesInstanceLimit,
50675
- nationalityCodesCount,
50676
- nationalityCodeType,
50677
- nationalityCodes,
50678
- addressProps,
50679
- personIds,
50680
- inContext
50681
- } = participantsProfile || {};
50682
50683
  const eventParticipantType = eventType === SINGLES ? INDIVIDUAL$1 : eventType === DOUBLES ? PAIR$1 : eventType;
50683
50684
  const mainParticipantsCount = uniqueParticipantsCount[MAIN] || 0;
50684
50685
  const qualifyingParticipantsCount = uniqueParticipantsCount[QUALIFYING] || 0;
50685
50686
  const participantsCount = mainParticipantsCount + qualifyingParticipantsCount;
50686
50687
  const sex = [MALE, FEMALE].includes(gender) ? gender : undefined;
50688
+ const idPrefix = participantsProfile !== null && participantsProfile !== void 0 && participantsProfile.idPrefix ? `E-${eventIndex}-${participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.idPrefix}` : undefined;
50687
50689
  const {
50688
50690
  participants: uniqueFlightParticipants
50689
50691
  } = generateParticipants({
50692
+ uuids: eventProfile.uuids || uuids,
50693
+ ...participantsProfile,
50690
50694
  scaledParticipantsCount: eventProfile.scaledParticipantsCount,
50691
50695
  consideredDate: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.startDate,
50692
50696
  rankingRange: eventProfile.rankingRange,
50693
50697
  participantType: eventParticipantType,
50694
- nationalityCodesCount,
50695
- nationalityCodeType,
50696
- valuesInstanceLimit,
50697
50698
  participantsCount,
50698
50699
  ratingsParameters,
50699
- nationalityCodes,
50700
- addressProps,
50701
- personIds,
50702
- inContext,
50700
+ idPrefix,
50703
50701
  category,
50704
- uuids,
50705
50702
  sex
50706
50703
  });
50707
50704
  let result = addParticipants({
@@ -50880,6 +50877,7 @@ function generateEventWithFlights({
50880
50877
  ratingsParameters,
50881
50878
  tournamentRecord,
50882
50879
  eventProfile,
50880
+ eventIndex,
50883
50881
  uuids
50884
50882
  }) {
50885
50883
  let gender = eventProfile.gender;
@@ -50929,6 +50927,7 @@ function generateEventWithFlights({
50929
50927
  ratingsParameters,
50930
50928
  tournamentRecord,
50931
50929
  eventProfile,
50930
+ eventIndex,
50932
50931
  uuids
50933
50932
  }) : {}; // Create event object -------------------------------------------------------
50934
50933
 
@@ -51017,8 +51016,8 @@ function generateEventWithFlights({
51017
51016
 
51018
51017
  function generateEventWithDraw({
51019
51018
  allUniqueParticipantIds = [],
51019
+ participantsProfile = {},
51020
51020
  matchUpStatusProfile,
51021
- participantsProfile,
51022
51021
  completeAllMatchUps,
51023
51022
  autoEntryPositions,
51024
51023
  randomWinningSide,
@@ -51026,6 +51025,7 @@ function generateEventWithDraw({
51026
51025
  tournamentRecord,
51027
51026
  drawProfile,
51028
51027
  startDate,
51028
+ drawIndex,
51029
51029
  goesTo,
51030
51030
  uuids
51031
51031
  }) {
@@ -51094,34 +51094,20 @@ function generateEventWithDraw({
51094
51094
  individualParticipantsCount = teamSize * drawSize;
51095
51095
  }
51096
51096
 
51097
+ const idPrefix = participantsProfile !== null && participantsProfile !== void 0 && participantsProfile.idPrefix ? `D-${drawIndex}-${participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.idPrefix}` : undefined;
51097
51098
  const participantType = eventType === DOUBLES ? PAIR$1 : INDIVIDUAL$1;
51098
- const {
51099
- valuesInstanceLimit,
51100
- nationalityCodesCount,
51101
- nationalityCodeType,
51102
- nationalityCodes,
51103
- addressProps,
51104
- personIds,
51105
- inContext
51106
- } = participantsProfile || {};
51107
51099
  const {
51108
51100
  participants: unique
51109
- } = generateParticipants({
51101
+ } = generateParticipants({ ...participantsProfile,
51110
51102
  scaledParticipantsCount: drawProfile.scaledParticipantsCount,
51111
51103
  participantsCount: individualParticipantsCount,
51112
51104
  consideredDate: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.startDate,
51113
51105
  sex: gender || (participantsProfile === null || participantsProfile === void 0 ? void 0 : participantsProfile.sex),
51114
51106
  rankingRange: drawProfile.rankingRange,
51115
51107
  uuids: drawProfile.uuids || uuids,
51116
- nationalityCodesCount,
51117
- nationalityCodeType,
51118
- valuesInstanceLimit,
51119
51108
  ratingsParameters,
51120
- nationalityCodes,
51121
51109
  participantType,
51122
- addressProps,
51123
- personIds,
51124
- inContext,
51110
+ idPrefix,
51125
51111
  category
51126
51112
  });
51127
51113
 
@@ -51436,9 +51422,9 @@ function generateVenues({
51436
51422
 
51437
51423
  function modifyTournamentRecord({
51438
51424
  ratingsParameters: ratingsParameters$1 = ratingsParameters,
51425
+ participantsProfile = {},
51439
51426
  matchUpStatusProfile,
51440
51427
  completeAllMatchUps,
51441
- participantsProfile,
51442
51428
  autoEntryPositions,
51443
51429
  randomWinningSide,
51444
51430
  schedulingProfile,
@@ -51450,6 +51436,8 @@ function modifyTournamentRecord({
51450
51436
  goesTo,
51451
51437
  uuids
51452
51438
  }) {
51439
+ var _tournamentRecord$par;
51440
+
51453
51441
  if (!tournamentRecord) return {
51454
51442
  error: MISSING_TOURNAMENT_RECORD
51455
51443
  };
@@ -51463,6 +51451,8 @@ function modifyTournamentRecord({
51463
51451
  eventProfile.gender = event.gender;
51464
51452
  }
51465
51453
  });
51454
+ const participantsCount = ((_tournamentRecord$par = tournamentRecord.participants) === null || _tournamentRecord$par === void 0 ? void 0 : _tournamentRecord$par.length) || undefined;
51455
+ if (participantsCount && participantsProfile !== null && participantsProfile !== void 0 && participantsProfile.idPrefix) participantsProfile.idPrefix = `${participantsProfile.idPrefix}-${participantsCount}`;
51466
51456
  const result = addTournamentParticipants({
51467
51457
  startDate: tournamentRecord.startDate,
51468
51458
  participantsProfile,
@@ -51474,6 +51464,10 @@ function modifyTournamentRecord({
51474
51464
  if (!result.success) return result;
51475
51465
 
51476
51466
  if (eventProfiles) {
51467
+ var _tournamentRecord$eve;
51468
+
51469
+ let eventIndex = ((_tournamentRecord$eve = tournamentRecord.events) === null || _tournamentRecord$eve === void 0 ? void 0 : _tournamentRecord$eve.length) || 0;
51470
+
51477
51471
  for (const eventProfile of eventProfiles) {
51478
51472
  let {
51479
51473
  ratingsParameters
@@ -51497,6 +51491,7 @@ function modifyTournamentRecord({
51497
51491
  ratingsParameters,
51498
51492
  tournamentRecord,
51499
51493
  eventProfile,
51494
+ eventIndex,
51500
51495
  uuids
51501
51496
  });
51502
51497
  if (error) return {
@@ -51505,6 +51500,7 @@ function modifyTournamentRecord({
51505
51500
  if (generatedDrawIds) drawIds.push(...generatedDrawIds);
51506
51501
  eventIds.push(eventId);
51507
51502
  if (uniqueParticipantIds !== null && uniqueParticipantIds !== void 0 && uniqueParticipantIds.length) allUniqueParticipantIds.push(...uniqueParticipantIds);
51503
+ eventIndex += 1;
51508
51504
  } else {
51509
51505
  const {
51510
51506
  gender,
@@ -51578,6 +51574,12 @@ function modifyTournamentRecord({
51578
51574
  }
51579
51575
 
51580
51576
  if (drawProfiles) {
51577
+ let drawIndex = (tournamentRecord.events || []).map(event => {
51578
+ var _event$drawDefinition;
51579
+
51580
+ return ((_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(() => 1)) || [];
51581
+ }).flat().reduce((a, b) => a + b, 0);
51582
+
51581
51583
  for (const drawProfile of drawProfiles) {
51582
51584
  const {
51583
51585
  drawId,
@@ -51596,6 +51598,7 @@ function modifyTournamentRecord({
51596
51598
  ratingsParameters: ratingsParameters$1,
51597
51599
  tournamentRecord,
51598
51600
  drawProfile,
51601
+ drawIndex,
51599
51602
  goesTo,
51600
51603
  uuids
51601
51604
  });
@@ -51610,6 +51613,7 @@ function modifyTournamentRecord({
51610
51613
  if (drawId) drawIds.push(drawId);
51611
51614
  eventIds.push(eventId);
51612
51615
  if (uniqueParticipantIds !== null && uniqueParticipantIds !== void 0 && uniqueParticipantIds.length) allUniqueParticipantIds.push(...uniqueParticipantIds);
51616
+ drawIndex += 1;
51613
51617
  }
51614
51618
  }
51615
51619
 
@@ -51850,6 +51854,8 @@ function generateTournamentRecord({
51850
51854
  allUniqueParticipantIds = [];
51851
51855
 
51852
51856
  if (drawProfiles) {
51857
+ let drawIndex = 0;
51858
+
51853
51859
  for (const drawProfile of drawProfiles) {
51854
51860
  const {
51855
51861
  drawId,
@@ -51868,6 +51874,7 @@ function generateTournamentRecord({
51868
51874
  tournamentRecord,
51869
51875
  drawProfile,
51870
51876
  startDate,
51877
+ drawIndex,
51871
51878
  goesTo,
51872
51879
  uuids
51873
51880
  });
@@ -51882,10 +51889,13 @@ function generateTournamentRecord({
51882
51889
  if (drawId) drawIds.push(drawId);
51883
51890
  eventIds.push(eventId);
51884
51891
  if (uniqueParticipantIds !== null && uniqueParticipantIds !== void 0 && uniqueParticipantIds.length) allUniqueParticipantIds.push(...uniqueParticipantIds);
51892
+ drawIndex += 1;
51885
51893
  }
51886
51894
  }
51887
51895
 
51888
51896
  if (eventProfiles) {
51897
+ let eventIndex = 0;
51898
+
51889
51899
  for (const eventProfile of eventProfiles) {
51890
51900
  const {
51891
51901
  error,
@@ -51902,6 +51912,7 @@ function generateTournamentRecord({
51902
51912
  ratingsParameters: ratingsParameters$1,
51903
51913
  tournamentRecord,
51904
51914
  eventProfile,
51915
+ eventIndex,
51905
51916
  startDate,
51906
51917
  uuids
51907
51918
  });
@@ -51911,6 +51922,7 @@ function generateTournamentRecord({
51911
51922
  if (generatedDrawIds) drawIds.push(...generatedDrawIds);
51912
51923
  eventIds.push(eventId);
51913
51924
  if (uniqueParticipantIds !== null && uniqueParticipantIds !== void 0 && uniqueParticipantIds.length) allUniqueParticipantIds.push(...uniqueParticipantIds);
51925
+ eventIndex += 1;
51914
51926
  }
51915
51927
  }
51916
51928
 
@@ -52166,4 +52178,5 @@ exports.tournamentEngine = tournamentEngine;
52166
52178
  exports.tournamentEngineAsync = tournamentEngineAsync;
52167
52179
  exports.utilities = utilities;
52168
52180
  exports.venueConstants = venueConstants;
52181
+ exports.version = factoryVersion;
52169
52182
  //# sourceMappingURL=tods-competition-factory.development.cjs.js.map