tods-competition-factory 0.71.0 → 0.72.0

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.71.0';
252
+ return '0.72.0';
253
253
  }
254
254
 
255
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
@@ -16880,14 +16880,6 @@ function getPairedPreviousMatchUpIsWOWO(params) {
16880
16880
  roundNumber,
16881
16881
  roundPosition
16882
16882
  }) => roundNumber === previousRoundNumber && roundPosition === pairedRoundPosition);
16883
- /*
16884
- const { pairedPreviousMatchUp } = getPairedPreviousMatchUp({
16885
- matchUp: sourceMatchUp,
16886
- structureId: structure.structureId,
16887
- matchUpsMap,
16888
- });
16889
- */
16890
-
16891
16883
  const pairedPreviousMatchUpStatus = pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus;
16892
16884
  const pairedPreviousMatchUpisWOWO = [DOUBLE_WALKOVER].includes(pairedPreviousMatchUpStatus);
16893
16885
  return {
@@ -17441,12 +17433,12 @@ function getWalkoverWinningSide({
17441
17433
  }
17442
17434
 
17443
17435
  function assignMatchUpDrawPosition({
17436
+ inContextDrawMatchUps,
17444
17437
  drawDefinition,
17445
- matchUpId,
17446
17438
  matchUpStatus,
17447
17439
  drawPosition,
17448
17440
  matchUpsMap,
17449
- inContextDrawMatchUps
17441
+ matchUpId
17450
17442
  }) {
17451
17443
  var _drawDefinition$struc, _matchUpsMap, _matchUpsMap$drawMatc;
17452
17444
 
@@ -17521,10 +17513,10 @@ function assignMatchUpDrawPosition({
17521
17513
  }
17522
17514
 
17523
17515
  const targetData = positionTargets({
17524
- matchUpId,
17525
- drawDefinition,
17526
17516
  inContextDrawMatchUps,
17527
- inContextMatchUp
17517
+ inContextMatchUp,
17518
+ drawDefinition,
17519
+ matchUpId
17528
17520
  });
17529
17521
  const {
17530
17522
  targetMatchUps: {
@@ -17545,12 +17537,12 @@ function assignMatchUpDrawPosition({
17545
17537
  if (winnerMatchUp) {
17546
17538
  if ([BYE, DOUBLE_WALKOVER].includes(matchUpStatus)) {
17547
17539
  const result = assignMatchUpDrawPosition({
17548
- drawDefinition,
17549
- drawPosition,
17550
17540
  matchUpId: winnerMatchUp.matchUpId,
17551
17541
  iterative: 'brightmagenta',
17552
- matchUpsMap,
17553
- inContextDrawMatchUps
17542
+ inContextDrawMatchUps,
17543
+ drawDefinition,
17544
+ drawPosition,
17545
+ matchUpsMap
17554
17546
  });
17555
17547
  if (result.error) return result;
17556
17548
  } else {
@@ -17563,24 +17555,24 @@ function assignMatchUpDrawPosition({
17563
17555
  }
17564
17556
  }
17565
17557
  }
17566
- } else {
17558
+ } else if (winnerMatchUp && !inContextMatchUp.feedRound) {
17567
17559
  const {
17568
17560
  pairedPreviousMatchUpisWOWO
17569
17561
  } = getPairedPreviousMatchUpIsWOWO({
17570
17562
  winnerMatchUp: matchUp,
17571
17563
  drawPosition,
17572
- structure,
17573
- matchUpsMap
17564
+ matchUpsMap,
17565
+ structure
17574
17566
  });
17575
17567
 
17576
- if (pairedPreviousMatchUpisWOWO && winnerMatchUp) {
17568
+ if (pairedPreviousMatchUpisWOWO) {
17577
17569
  const result = assignMatchUpDrawPosition({
17578
- drawDefinition,
17579
- drawPosition,
17580
17570
  matchUpId: winnerMatchUp.matchUpId,
17581
17571
  iterative: 'brightred',
17582
- matchUpsMap,
17583
- inContextDrawMatchUps
17572
+ inContextDrawMatchUps,
17573
+ drawDefinition,
17574
+ drawPosition,
17575
+ matchUpsMap
17584
17576
  });
17585
17577
  if (result.error) return result;
17586
17578
  }
@@ -19583,9 +19575,9 @@ function attemptToSetWinningSide(params) {
19583
19575
  }
19584
19576
 
19585
19577
  function getPairedPreviousMatchUp({
19586
- matchUp,
19587
19578
  structureId,
19588
- matchUpsMap
19579
+ matchUpsMap,
19580
+ matchUp
19589
19581
  }) {
19590
19582
  const sourceRoundPosition = matchUp === null || matchUp === void 0 ? void 0 : matchUp.roundPosition;
19591
19583
  const offset = sourceRoundPosition % 2 ? 1 : -1;
@@ -19605,12 +19597,12 @@ function getPairedPreviousMatchUp({
19605
19597
 
19606
19598
  function removeDoubleWalkover(params) {
19607
19599
  const {
19600
+ inContextDrawMatchUps,
19608
19601
  drawDefinition,
19602
+ matchUpsMap,
19609
19603
  targetData,
19610
19604
  structure,
19611
- matchUp,
19612
- matchUpsMap,
19613
- inContextDrawMatchUps
19605
+ matchUp
19614
19606
  } = params;
19615
19607
  const {
19616
19608
  targetLinks: {
@@ -19636,29 +19628,40 @@ function removeDoubleWalkover(params) {
19636
19628
 
19637
19629
 
19638
19630
  if (winnerMatchUp) {
19639
- var _pairedPreviousMatchU;
19640
-
19641
- const noContextWinnerMatchUp = matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === winnerMatchUp.matchUpId);
19642
- const {
19643
- pairedPreviousMatchUp
19644
- } = getPairedPreviousMatchUp({
19645
- matchUp,
19646
- structureId: structure.structureId,
19647
- matchUpsMap
19648
- });
19649
- const pairedPreviousWOWO = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) === DOUBLE_WALKOVER;
19650
- const pairedPreviousDrawPositions = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : (_pairedPreviousMatchU = pairedPreviousMatchUp.drawPositions) === null || _pairedPreviousMatchU === void 0 ? void 0 : _pairedPreviousMatchU.filter(Boolean)) || [];
19651
- const pairedPreviousMatchUpComplete = [...completedMatchUpStatuses, BYE].includes(pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) || (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.winningSide);
19652
19631
  const nextTargetData = positionTargets({
19653
19632
  matchUpId: winnerMatchUp.matchUpId,
19654
- drawDefinition,
19655
- inContextDrawMatchUps
19633
+ inContextDrawMatchUps,
19634
+ drawDefinition
19656
19635
  });
19657
19636
  const {
19658
19637
  targetMatchUps: {
19659
19638
  winnerMatchUp: nextWinnerMatchUp
19660
19639
  }
19661
19640
  } = nextTargetData;
19641
+ const noContextWinnerMatchUp = matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === winnerMatchUp.matchUpId);
19642
+ let pairedPreviousDrawPositions = [];
19643
+ let pairedPreviousMatchUpComplete;
19644
+ let pairedPreviousWOWO; // winnerMatchUp has context
19645
+
19646
+ if (winnerMatchUp.feedRound) {
19647
+ var _nextWinnerMatchUp$dr;
19648
+
19649
+ pairedPreviousDrawPositions = nextWinnerMatchUp === null || nextWinnerMatchUp === void 0 ? void 0 : (_nextWinnerMatchUp$dr = nextWinnerMatchUp.drawPositions) === null || _nextWinnerMatchUp$dr === void 0 ? void 0 : _nextWinnerMatchUp$dr.filter(Boolean);
19650
+ pairedPreviousMatchUpComplete = true;
19651
+ } else {
19652
+ var _pairedPreviousMatchU;
19653
+
19654
+ const {
19655
+ pairedPreviousMatchUp
19656
+ } = getPairedPreviousMatchUp({
19657
+ structureId: structure.structureId,
19658
+ matchUpsMap,
19659
+ matchUp
19660
+ });
19661
+ pairedPreviousWOWO = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) === DOUBLE_WALKOVER;
19662
+ pairedPreviousDrawPositions = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : (_pairedPreviousMatchU = pairedPreviousMatchUp.drawPositions) === null || _pairedPreviousMatchU === void 0 ? void 0 : _pairedPreviousMatchU.filter(Boolean)) || [];
19663
+ pairedPreviousMatchUpComplete = [...completedMatchUpStatuses, BYE].includes(pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) || (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.winningSide);
19664
+ }
19662
19665
 
19663
19666
  if (pairedPreviousMatchUpComplete) {
19664
19667
  const sourceDrawPositions = matchUp.drawPositions || [];
@@ -19673,23 +19676,23 @@ function removeDoubleWalkover(params) {
19673
19676
 
19674
19677
  if (nextWinnerMatchUp && drawPositionToRemove) {
19675
19678
  const result = removeDirectedWinner({
19679
+ winningDrawPosition: drawPositionToRemove,
19676
19680
  winnerMatchUp: nextWinnerMatchUp,
19681
+ inContextDrawMatchUps,
19677
19682
  drawDefinition,
19678
- winningDrawPosition: drawPositionToRemove,
19679
- matchUpsMap,
19680
- inContextDrawMatchUps
19683
+ matchUpsMap
19681
19684
  });
19682
19685
  if (result.error) return result;
19683
19686
  }
19684
19687
  }
19685
19688
 
19686
19689
  removeDoubleWalkover({
19687
- drawDefinition,
19688
19690
  targetData: nextTargetData,
19689
- structure,
19690
19691
  matchUp: winnerMatchUp,
19692
+ inContextDrawMatchUps,
19693
+ drawDefinition,
19691
19694
  matchUpsMap,
19692
- inContextDrawMatchUps
19695
+ structure
19693
19696
  });
19694
19697
  let matchUpStatus = [WALKOVER$1, DOUBLE_WALKOVER].includes(noContextWinnerMatchUp === null || noContextWinnerMatchUp === void 0 ? void 0 : noContextWinnerMatchUp.matchUpStatus) && pairedPreviousWOWO ? WALKOVER$1 : TO_BE_PLAYED;
19695
19698
  const removeScore = !pairedPreviousWOWO;
@@ -20454,17 +20457,17 @@ function setMatchUpStatus$1(params) {
20454
20457
  }
20455
20458
 
20456
20459
  return setMatchUpStatus$2({
20457
- tournamentRecord,
20458
- drawDefinition,
20459
- event,
20460
20460
  matchUpStatusCodes: outcome === null || outcome === void 0 ? void 0 : outcome.matchUpStatusCodes,
20461
20461
  matchUpStatus: outcome === null || outcome === void 0 ? void 0 : outcome.matchUpStatus,
20462
- matchUpFormat,
20463
- matchUpId,
20464
20462
  winningSide: outcome === null || outcome === void 0 ? void 0 : outcome.winningSide,
20465
20463
  allowChangePropagation,
20466
20464
  score: outcome === null || outcome === void 0 ? void 0 : outcome.score,
20465
+ tournamentRecord,
20466
+ drawDefinition,
20467
+ matchUpFormat,
20468
+ matchUpId,
20467
20469
  schedule,
20470
+ event,
20468
20471
  notes
20469
20472
  });
20470
20473
  }
@@ -36090,7 +36093,7 @@ function addEventEntries(params) {
36090
36093
  });
36091
36094
  let message;
36092
36095
 
36093
- if (drawId && ![UNGROUPED, UNPAIRED].includes(entryStatus)) {
36096
+ if (drawId && !isUngrouped(entryStage)) {
36094
36097
  const result = addDrawEntries({
36095
36098
  participantIds: validParticipantIds,
36096
36099
  autoEntryPositions,
@@ -50750,6 +50753,7 @@ function completeDrawMatchUps({
50750
50753
  };
50751
50754
  }
50752
50755
  function completeDrawMatchUp({
50756
+ matchUpStatusCodes,
50753
50757
  drawDefinition,
50754
50758
  targetMatchUp,
50755
50759
  matchUpStatus,
@@ -50771,6 +50775,7 @@ function completeDrawMatchUp({
50771
50775
  scoreString,
50772
50776
  winningSide
50773
50777
  });
50778
+ if (matchUpStatusCodes) outcome.matchUpStatusCodes = matchUpStatusCodes;
50774
50779
  return setMatchUpStatus$1({
50775
50780
  drawDefinition,
50776
50781
  matchUpFormat,
@@ -52189,6 +52194,7 @@ function generateEventWithDraw({
52189
52194
  matchUpFormat,
52190
52195
  stageSequence = 1,
52191
52196
  matchUpStatus = COMPLETED,
52197
+ matchUpStatusCodes,
52192
52198
  matchUpIndex = 0,
52193
52199
  structureOrder // like a group number; for RR = the order of the structureType: ITEM within structureType: CONTAINER
52194
52200
 
@@ -52216,6 +52222,7 @@ function generateEventWithDraw({
52216
52222
 
52217
52223
  const targetMatchUp = targetMatchUps[matchUpIndex];
52218
52224
  const result = completeDrawMatchUp({
52225
+ matchUpStatusCodes,
52219
52226
  drawDefinition,
52220
52227
  targetMatchUp,
52221
52228
  matchUpFormat,