tods-competition-factory 2.2.5 → 2.2.6

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.
@@ -5377,6 +5377,7 @@ type SetMatchUpStatusArgs = {
5377
5377
  enableAutoCalc?: boolean;
5378
5378
  matchUpFormat?: string;
5379
5379
  tournamentId?: string;
5380
+ setTBlast?: boolean;
5380
5381
  matchUpId: string;
5381
5382
  eventId?: string;
5382
5383
  drawId?: string;
@@ -8731,6 +8732,7 @@ type GenerateScoreString = {
8731
8732
  matchUpFormat?: string;
8732
8733
  winnerFirst?: boolean;
8733
8734
  winningSide?: number;
8735
+ setTBlast?: boolean;
8734
8736
  reversed?: boolean;
8735
8737
  sets: any;
8736
8738
  };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.5';
6
+ return '2.2.6';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -28726,7 +28726,7 @@ function generateVoluntaryConsolation(params) {
28726
28726
  }
28727
28727
 
28728
28728
  function generateScoreString(params) {
28729
- const { winnerFirst = true, addOutcomeString, reversed = false, matchUpStatus, matchUpFormat, autoComplete, winningSide, sets, } = params;
28729
+ const { winnerFirst = true, setTBlast = true, addOutcomeString, reversed = false, matchUpStatus, matchUpFormat, autoComplete, winningSide, sets, } = params;
28730
28730
  if (!sets)
28731
28731
  return { error: MISSING_VALUE, info: 'missing sets' };
28732
28732
  const parsedFormat = matchUpFormat && parse(matchUpFormat);
@@ -28749,23 +28749,25 @@ function generateScoreString(params) {
28749
28749
  const format = isFinalSet && finalSetFormat ? finalSetFormat : setFormat;
28750
28750
  const hasGameScores = (set) => isNumeric(set?.side1Score) || isNumeric(set?.side2Score);
28751
28751
  const hasTiebreakScores = (set) => isNumeric(set?.side1TiebreakScore) || isNumeric(set?.side2TiebreakScore);
28752
- const isTiebreakSet = format?.tiebreakSet || (!hasGameScores(currentSet) && hasTiebreakScores(currentSet));
28752
+ const tbscores = hasTiebreakScores(currentSet);
28753
+ const isTiebreakSet = format?.tiebreakSet || (!hasGameScores(currentSet) && tbscores);
28753
28754
  const { side1Score, side2Score, side1TiebreakScore, side2TiebreakScore } = currentSet;
28754
- const t1 = side1TiebreakScore || (isNumeric(side1TiebreakScore) || autoComplete ? 0 : '');
28755
- const t2 = side2TiebreakScore || (isNumeric(side2TiebreakScore) || autoComplete ? 0 : '');
28755
+ const t1 = side1TiebreakScore || (isNumeric(side1TiebreakScore) || (tbscores && autoComplete) ? 0 : '');
28756
+ const t2 = side2TiebreakScore || (isNumeric(side2TiebreakScore) || (tbscores && autoComplete) ? 0 : '');
28756
28757
  if (isTiebreakSet) {
28757
28758
  const tiebreakScore = reverseScores ? [t2, t1] : [t1, t2];
28758
28759
  return `[${tiebreakScore.join('-')}]`;
28759
28760
  }
28760
- const lowTiebreakScore = Math.min(t1, t2);
28761
+ const lowTiebreakScore = tbscores ? Math.min(t1, t2) : '';
28761
28762
  const lowTiebreakSide = lowTiebreakScore === t1 ? 1 : 2;
28762
- const tiebreak = lowTiebreakScore ? `(${lowTiebreakScore})` : '';
28763
+ const tiebreak = isNumeric(lowTiebreakScore) ? `(${lowTiebreakScore})` : '';
28763
28764
  const s1 = side1Score || (isNumeric(side1Score) || autoComplete ? 0 : '');
28764
28765
  const s2 = side2Score || (isNumeric(side2Score) || autoComplete ? 0 : '');
28765
- const includeTiebreak = (sideNumber) => (lowTiebreakSide === sideNumber ? tiebreak : '');
28766
+ const includeTiebreak = (sideNumber) => (!setTBlast && lowTiebreakSide === sideNumber ? tiebreak : '');
28766
28767
  const ss1 = `${s1}${includeTiebreak(1)}`;
28767
28768
  const ss2 = `${s2}${includeTiebreak(2)}`;
28768
- let scoreString = reverseScores ? `${[ss2, ss1].join('-')}` : `${[ss1, ss2].join('-')}`;
28769
+ const tbLast = setTBlast && tbscores ? `(${lowTiebreakScore})` : '';
28770
+ let scoreString = reverseScores ? `${[ss2, ss1].join('-')}${tbLast}` : `${[ss1, ss2].join('-')}${tbLast}`;
28769
28771
  if (['-', ' '].includes(scoreString))
28770
28772
  scoreString = '';
28771
28773
  return scoreString;
@@ -28803,10 +28805,12 @@ function reverseScore(params) {
28803
28805
  setNumber,
28804
28806
  });
28805
28807
  });
28806
- const scoreStringSide1 = generateScoreString({ sets: reversedSets });
28808
+ const setTBlast = params?.setTBlast;
28809
+ const scoreStringSide1 = generateScoreString({ setTBlast, sets: reversedSets });
28807
28810
  const scoreStringSide2 = generateScoreString({
28808
28811
  sets: reversedSets,
28809
28812
  reversed: true,
28813
+ setTBlast,
28810
28814
  });
28811
28815
  return {
28812
28816
  reversedScore: { sets: reversedSets, scoreStringSide1, scoreStringSide2 },
@@ -28899,8 +28903,8 @@ function calculateHistoryScore(params) {
28899
28903
  tiebreakServingSide = undefined;
28900
28904
  sidePoints = [0, 0];
28901
28905
  servingSide = 3 - servingSide;
28902
- set.side1TiebreakScore = 0;
28903
- set.side2TiebreakScore = 0;
28906
+ set.side1TiebreakScore = '';
28907
+ set.side2TiebreakScore = '';
28904
28908
  set.side1PointScore = '';
28905
28909
  set.side2PointScore = '';
28906
28910
  faults = 0;
@@ -45526,7 +45530,7 @@ function resetMatchUpLineUps({ inheritance = true, tournamentRecord, drawDefinit
45526
45530
  }
45527
45531
 
45528
45532
  function matchUpScore(params) {
45529
- const { matchUpFormat, matchUpStatus, winningSide, score } = params;
45533
+ const { matchUpFormat, matchUpStatus, winningSide, score, setTBlast } = params;
45530
45534
  if (!score)
45531
45535
  return { sets: [] };
45532
45536
  const sets = score.sets || [];
@@ -45534,6 +45538,7 @@ function matchUpScore(params) {
45534
45538
  winnerFirst: false,
45535
45539
  matchUpFormat,
45536
45540
  matchUpStatus,
45541
+ setTBlast,
45537
45542
  sets,
45538
45543
  });
45539
45544
  let scoreStringSide2 = generateScoreString({
@@ -45541,12 +45546,14 @@ function matchUpScore(params) {
45541
45546
  reversed: true,
45542
45547
  matchUpFormat,
45543
45548
  matchUpStatus,
45549
+ setTBlast,
45544
45550
  sets,
45545
45551
  });
45546
45552
  const winnerPerspective = generateScoreString({
45547
45553
  matchUpFormat,
45548
45554
  matchUpStatus,
45549
45555
  winningSide,
45556
+ setTBlast,
45550
45557
  sets,
45551
45558
  });
45552
45559
  const loserPerspective = scoreStringSide1 === winnerPerspective ? scoreStringSide2 : scoreStringSide1;
@@ -45554,13 +45561,7 @@ function matchUpScore(params) {
45554
45561
  scoreStringSide1 = winningSide === 1 ? winnerPerspective : loserPerspective;
45555
45562
  scoreStringSide2 = winningSide === 2 ? winnerPerspective : loserPerspective;
45556
45563
  }
45557
- return {
45558
- score: {
45559
- sets,
45560
- scoreStringSide1,
45561
- scoreStringSide2,
45562
- },
45563
- };
45564
+ return { score: { sets, scoreStringSide1, scoreStringSide2 } };
45564
45565
  }
45565
45566
 
45566
45567
  function setMatchUpStatus(params) {
@@ -45593,7 +45594,7 @@ function setMatchUpStatus(params) {
45593
45594
  const allowChangePropagation = (params.allowChangePropagation !== undefined && params.allowChangePropagation) ||
45594
45595
  (policy?.allowChangePropagation !== undefined && policy.allowChangePropagation) ||
45595
45596
  undefined;
45596
- const { outcome } = params;
45597
+ const { outcome, setTBlast } = params;
45597
45598
  if (outcome?.winningSide && ![1, 2].includes(outcome.winningSide)) {
45598
45599
  return { error: INVALID_WINNING_SIDE };
45599
45600
  }
@@ -45609,7 +45610,7 @@ function setMatchUpStatus(params) {
45609
45610
  return result;
45610
45611
  }
45611
45612
  if (outcome?.score?.sets && !outcome.score.scoreStringSide1) {
45612
- const { score: scoreObject } = matchUpScore(outcome);
45613
+ const { score: scoreObject } = matchUpScore({ ...outcome, setTBlast });
45613
45614
  outcome.score = scoreObject;
45614
45615
  outcome.score.sets = outcome.score.sets.filter((set) => set.side1Score || set.side2Score || set.side1TiebreakScore || set.side2TiebreakScore);
45615
45616
  }
@@ -46340,7 +46341,7 @@ var index$9 = {
46340
46341
  };
46341
46342
 
46342
46343
  function generateOutcomeFromScoreString(params) {
46343
- const { matchUpFormat, matchUpStatus, winningSide, scoreString } = params;
46344
+ const { matchUpFormat, matchUpStatus, winningSide, scoreString, setTBlast } = params;
46344
46345
  if (!scoreString)
46345
46346
  return {
46346
46347
  outcome: {
@@ -46356,11 +46357,13 @@ function generateOutcomeFromScoreString(params) {
46356
46357
  const winningScoreString = generateScoreString({
46357
46358
  sets: neutralParsedSets,
46358
46359
  matchUpFormat,
46360
+ setTBlast,
46359
46361
  });
46360
46362
  const losingScoreString = generateScoreString({
46361
46363
  sets: neutralParsedSets,
46362
46364
  reversed: true,
46363
46365
  matchUpFormat,
46366
+ setTBlast,
46364
46367
  });
46365
46368
  if (winningSide === 2) {
46366
46369
  score.scoreStringSide1 = losingScoreString;