tods-competition-factory 0.67.1 → 0.67.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.
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
249
249
  };
250
250
 
251
251
  function factoryVersion() {
252
- return '0.67.1';
252
+ return '0.67.2';
253
253
  }
254
254
 
255
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
@@ -36416,6 +36416,7 @@ const MAX_ITERATIONS = 5000;
36416
36416
  function generateDrawMaticRound({
36417
36417
  maxIterations = MAX_ITERATIONS,
36418
36418
  tournamentParticipants,
36419
+ generateMatchUps,
36419
36420
  drawDefinition,
36420
36421
  participantIds,
36421
36422
  adHocRatings,
@@ -36498,15 +36499,20 @@ function generateDrawMaticRound({
36498
36499
  if (!candidatesCount) return {
36499
36500
  error: 'No Candidates'
36500
36501
  };
36501
- const result = generateAdHocMatchUps$1({
36502
- participantIdPairings,
36503
- drawDefinition,
36504
- newRound: true,
36505
- structureId,
36506
- matchUpIds
36507
- });
36508
- if (result.error) return result;
36502
+
36503
+ if (generateMatchUps) {
36504
+ const result = generateAdHocMatchUps$1({
36505
+ participantIdPairings,
36506
+ drawDefinition,
36507
+ newRound: true,
36508
+ structureId,
36509
+ matchUpIds
36510
+ });
36511
+ if (result.error) return result;
36512
+ }
36513
+
36509
36514
  return { ...SUCCESS,
36515
+ participantIdPairings,
36510
36516
  candidatesCount,
36511
36517
  iterations
36512
36518
  };
@@ -36664,43 +36670,11 @@ function getParticipantPairingValues({
36664
36670
  pairingValues
36665
36671
  };
36666
36672
  }
36667
- /*
36668
- function uniqueDoublesPairings({ pairs, team_ids }) {
36669
- if (!pairs && team_ids && Array.isArray(team_ids))
36670
- pairs = team_ids.map((t) => ({ id: t }));
36671
- if (!Array.isArray(pairs)) return [];
36672
-
36673
- let pairPairings = {};
36674
-
36675
- let uniquePairPairings = [];
36676
- pairs.map(getPairPairings).forEach(attemptPush);
36677
-
36678
- function attemptPush(pm) {
36679
- pm.forEach((m) => {
36680
- if (uniquePairPairings.indexOf(m) < 0) uniquePairPairings.push(m);
36681
- });
36682
- }
36683
-
36684
- let team_value_objects = Object.assign(
36685
- {},
36686
- ...uniquePairPairings.map((mu) => ({ [mu]: 0 }))
36687
- );
36688
-
36689
- return { uniquePairPairings, pairPairings, team_value_objects };
36690
-
36691
- function getPairPairings(pair) {
36692
- let opponents = pairs.filter((p) => p.id !== pair.id);
36693
- pairPairings[pair.id] = opponents.map((o) => o.id);
36694
- let matchups = opponents.map((o) => pairingHash(o.id, pair.id));
36695
- return matchups;
36696
- }
36697
- }
36698
- */
36699
36673
 
36700
36674
  /**
36701
36675
  *
36702
- * @param {object} drawDefinition
36703
- * @param {string} structureId
36676
+ * @param {object} drawDefinition - provided automatically by drawEngine
36677
+ * @param {string} structureId - optional - defaults to the first structure of latest stage
36704
36678
  * @param {string[]} participantIds - optional - allows a subset of drawDefinition.entries to be specified
36705
36679
  *
36706
36680
  */
@@ -36708,6 +36682,7 @@ function uniqueDoublesPairings({ pairs, team_ids }) {
36708
36682
  function drawMatic$1({
36709
36683
  tournamentParticipants,
36710
36684
  restrictEntryStatus,
36685
+ generateMatchUps,
36711
36686
  drawDefinition,
36712
36687
  participantIds,
36713
36688
  maxIterations,
@@ -36793,9 +36768,11 @@ function drawMatic$1({
36793
36768
 
36794
36769
  const {
36795
36770
  candidatesCount,
36796
- iterations
36771
+ iterations,
36772
+ participantIdPairings
36797
36773
  } = generateDrawMaticRound({
36798
36774
  tournamentParticipants,
36775
+ generateMatchUps,
36799
36776
  drawDefinition,
36800
36777
  participantIds,
36801
36778
  maxIterations,
@@ -36807,7 +36784,8 @@ function drawMatic$1({
36807
36784
  });
36808
36785
  return { ...SUCCESS,
36809
36786
  candidatesCount,
36810
- iterations
36787
+ iterations,
36788
+ participantIdPairings
36811
36789
  };
36812
36790
  }
36813
36791
 
@@ -50231,6 +50209,7 @@ function generateFlightDrawDefinitions({
50231
50209
 
50232
50210
  for (const roundNumber of generateRange(1, roundsCount + 1)) {
50233
50211
  const result = drawMatic({
50212
+ generateMatchUps: true,
50234
50213
  tournamentRecord,
50235
50214
  drawDefinition,
50236
50215
  roundNumber // this is not a real parameter
@@ -51444,6 +51423,7 @@ function generateEventWithDraw({
51444
51423
 
51445
51424
  for (const roundNumber of generateRange(1, roundsCount + 1)) {
51446
51425
  const result = drawMatic({
51426
+ generateMatchUps: true,
51447
51427
  tournamentRecord,
51448
51428
  drawDefinition,
51449
51429
  roundNumber // this is not a real parameter