tods-competition-factory 0.59.2 → 0.59.3

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.
@@ -3443,7 +3443,7 @@ function validateTieFormat({
3443
3443
  checkCollectionIds = true,
3444
3444
  tieFormat
3445
3445
  } = {}) {
3446
- var _tieFormat$winCriteri, _tieFormat$winCriteri2;
3446
+ var _tieFormat$winCriteri, _tieFormat$winCriteri2, _tieFormat$winCriteri3, _tieFormat$winCriteri4;
3447
3447
 
3448
3448
  const errors = [];
3449
3449
 
@@ -3471,9 +3471,9 @@ function validateTieFormat({
3471
3471
  };
3472
3472
  }
3473
3473
 
3474
- const validWinCriteria = typeof ((_tieFormat$winCriteri = tieFormat.winCriteria) === null || _tieFormat$winCriteri === void 0 ? void 0 : _tieFormat$winCriteri.valueGoal) === 'number' && ((_tieFormat$winCriteri2 = tieFormat.winCriteria) === null || _tieFormat$winCriteri2 === void 0 ? void 0 : _tieFormat$winCriteri2.valueGoal) > 0;
3474
+ const validWinCriteria = typeof ((_tieFormat$winCriteri = tieFormat.winCriteria) === null || _tieFormat$winCriteri === void 0 ? void 0 : _tieFormat$winCriteri.valueGoal) === 'number' && ((_tieFormat$winCriteri2 = tieFormat.winCriteria) === null || _tieFormat$winCriteri2 === void 0 ? void 0 : _tieFormat$winCriteri2.valueGoal) > 0 || ((_tieFormat$winCriteri3 = tieFormat.winCriteria) === null || _tieFormat$winCriteri3 === void 0 ? void 0 : _tieFormat$winCriteri3.aggregateValue);
3475
3475
 
3476
- if (!(validWinCriteria || tieFormat.winCriteria.aggregateValue)) {
3476
+ if (!(validWinCriteria || (_tieFormat$winCriteri4 = tieFormat.winCriteria) !== null && _tieFormat$winCriteri4 !== void 0 && _tieFormat$winCriteri4.aggregateValue)) {
3477
3477
  errors.push('Either non-zero valueGoal, or { aggregateValue: true } must be specified in winCriteria');
3478
3478
  return {
3479
3479
  error: INVALID_TIE_FORMAT,
@@ -3672,38 +3672,39 @@ function generateTieMatchUpScore({
3672
3672
  collectionMatchUps.forEach(matchUp => {
3673
3673
  if (matchUp.winningSide) sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
3674
3674
  });
3675
- } else if (Array.isArray(collectionValueProfile)) {
3676
- collectionMatchUps.forEach(matchUp => {
3677
- if (matchUp.winningSide) {
3678
- const collectionPosition = matchUp.collectionPosition;
3679
- const matchUpValue = getCollectionPositionValue({
3680
- collectionDefinition,
3681
- collectionPosition
3682
- });
3683
- sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
3684
- }
3685
- });
3686
3675
  } else if (setValue) {
3687
3676
  collectionMatchUps.forEach(matchUp => {
3688
- var _matchUp$score$sets;
3677
+ var _matchUp$score, _matchUp$score$sets;
3689
3678
 
3690
- (_matchUp$score$sets = matchUp.score.sets) === null || _matchUp$score$sets === void 0 ? void 0 : _matchUp$score$sets.forEach(set => {
3679
+ (_matchUp$score = matchUp.score) === null || _matchUp$score === void 0 ? void 0 : (_matchUp$score$sets = _matchUp$score.sets) === null || _matchUp$score$sets === void 0 ? void 0 : _matchUp$score$sets.forEach(set => {
3691
3680
  if (set.winningSide) sideMatchUpValues[set.winningSide - 1] += setValue;
3692
3681
  });
3693
3682
  });
3694
3683
  } else if (scoreValue) {
3695
3684
  collectionMatchUps.forEach(matchUp => {
3696
- var _matchUp$score$sets2;
3685
+ var _matchUp$score2, _matchUp$score2$sets;
3697
3686
 
3698
- (_matchUp$score$sets2 = matchUp.score.sets) === null || _matchUp$score$sets2 === void 0 ? void 0 : _matchUp$score$sets2.forEach(set => {
3687
+ (_matchUp$score2 = matchUp.score) === null || _matchUp$score2 === void 0 ? void 0 : (_matchUp$score2$sets = _matchUp$score2.sets) === null || _matchUp$score2$sets === void 0 ? void 0 : _matchUp$score2$sets.forEach(set => {
3699
3688
  const {
3700
- scoreSide1 = 0,
3701
- scoreSide2 = 0
3689
+ side1Score = 0,
3690
+ side2Score = 0
3702
3691
  } = set;
3703
- sideMatchUpValues[0] = scoreSide1;
3704
- sideMatchUpValues[2] = scoreSide2;
3692
+ sideMatchUpValues[0] += side1Score;
3693
+ sideMatchUpValues[1] += side2Score;
3705
3694
  });
3706
3695
  });
3696
+ } else if (Array.isArray(collectionValueProfile)) {
3697
+ // this must come last because it will be true for []
3698
+ collectionMatchUps.forEach(matchUp => {
3699
+ if (matchUp.winningSide) {
3700
+ const collectionPosition = matchUp.collectionPosition;
3701
+ const matchUpValue = getCollectionPositionValue({
3702
+ collectionDefinition,
3703
+ collectionPosition
3704
+ });
3705
+ sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
3706
+ }
3707
+ });
3707
3708
  }
3708
3709
 
3709
3710
  if (collectionValue) {
@@ -3935,7 +3936,7 @@ function checkSetIsComplete$1({
3935
3936
  error: MISSING_VALUE
3936
3937
  };
3937
3938
  matchUpScoringFormat = matchUpScoringFormat || matchUpFormat;
3938
- const setFormat = isDecidingSet && matchUpScoringFormat.finalSetFormat || ((_matchUpScoringFormat = matchUpScoringFormat) === null || _matchUpScoringFormat === void 0 ? void 0 : _matchUpScoringFormat.setFormat);
3939
+ const setFormat = isDecidingSet && matchUpScoringFormat.finalSetFormat || ((_matchUpScoringFormat = matchUpScoringFormat) === null || _matchUpScoringFormat === void 0 ? void 0 : _matchUpScoringFormat.setFormat) || {};
3939
3940
  const {
3940
3941
  side1Score,
3941
3942
  side2Score
@@ -4038,7 +4039,7 @@ function keyValueSetScore({
4038
4039
  setTo,
4039
4040
  tiebreakAt,
4040
4041
  NoAD
4041
- } = analysis.setFormat;
4042
+ } = analysis === null || analysis === void 0 ? void 0 : analysis.setFormat;
4042
4043
  const needsTiebreak = value === parseInt(tiebreakAt || setTo);
4043
4044
  if (tiebreakAt && tiebreakAt < setTo && value > tiebreakAt) return {
4044
4045
  scoreString
@@ -7113,7 +7114,7 @@ const countries = [{
7113
7114
  phone: '263'
7114
7115
  }];
7115
7116
 
7116
- var collectionDefinitions$4 = [
7117
+ var collectionDefinitions$5 = [
7117
7118
  {
7118
7119
  collectionName: "Doubles",
7119
7120
  matchUpCount: 3,
@@ -7129,17 +7130,17 @@ var collectionDefinitions$4 = [
7129
7130
  matchUpValue: 1
7130
7131
  }
7131
7132
  ];
7132
- var tieFormatName$3 = "COLLEGE_D3";
7133
- var winCriteria$4 = {
7133
+ var tieFormatName$4 = "COLLEGE_D3";
7134
+ var winCriteria$5 = {
7134
7135
  valueGoal: 5
7135
7136
  };
7136
7137
  var COLLEGE_D3$1 = {
7137
- collectionDefinitions: collectionDefinitions$4,
7138
- tieFormatName: tieFormatName$3,
7139
- winCriteria: winCriteria$4
7138
+ collectionDefinitions: collectionDefinitions$5,
7139
+ tieFormatName: tieFormatName$4,
7140
+ winCriteria: winCriteria$5
7140
7141
  };
7141
7142
 
7142
- var collectionDefinitions$3 = [
7143
+ var collectionDefinitions$4 = [
7143
7144
  {
7144
7145
  collectionName: "Doubles",
7145
7146
  collectionValue: 1,
@@ -7155,17 +7156,17 @@ var collectionDefinitions$3 = [
7155
7156
  matchUpValue: 1
7156
7157
  }
7157
7158
  ];
7158
- var tieFormatName$2 = "COLLEGE_DEFAULT";
7159
- var winCriteria$3 = {
7159
+ var tieFormatName$3 = "COLLEGE_DEFAULT";
7160
+ var winCriteria$4 = {
7160
7161
  valueGoal: 5
7161
7162
  };
7162
7163
  var COLLEGE_DEFAULT$1 = {
7163
- collectionDefinitions: collectionDefinitions$3,
7164
- tieFormatName: tieFormatName$2,
7165
- winCriteria: winCriteria$3
7164
+ collectionDefinitions: collectionDefinitions$4,
7165
+ tieFormatName: tieFormatName$3,
7166
+ winCriteria: winCriteria$4
7166
7167
  };
7167
7168
 
7168
- var collectionDefinitions$2 = [
7169
+ var collectionDefinitions$3 = [
7169
7170
  {
7170
7171
  collectionName: "Doubles",
7171
7172
  matchUpCount: 3,
@@ -7181,17 +7182,17 @@ var collectionDefinitions$2 = [
7181
7182
  matchUpValue: 1
7182
7183
  }
7183
7184
  ];
7184
- var tieFormatName$1 = "COLLEGE_JUCO";
7185
- var winCriteria$2 = {
7185
+ var tieFormatName$2 = "COLLEGE_JUCO";
7186
+ var winCriteria$3 = {
7186
7187
  valueGoal: 5
7187
7188
  };
7188
7189
  var COLLEGE_JUCO$1 = {
7189
- collectionDefinitions: collectionDefinitions$2,
7190
- tieFormatName: tieFormatName$1,
7191
- winCriteria: winCriteria$2
7190
+ collectionDefinitions: collectionDefinitions$3,
7191
+ tieFormatName: tieFormatName$2,
7192
+ winCriteria: winCriteria$3
7192
7193
  };
7193
7194
 
7194
- var collectionDefinitions$1 = [
7195
+ var collectionDefinitions$2 = [
7195
7196
  {
7196
7197
  collectionName: "Doubles",
7197
7198
  matchUpCount: 1,
@@ -7207,20 +7208,20 @@ var collectionDefinitions$1 = [
7207
7208
  matchUpValue: 1
7208
7209
  }
7209
7210
  ];
7210
- var tieFormatName = "DOMINANT_DUO";
7211
- var winCriteria$1 = {
7211
+ var tieFormatName$1 = "DOMINANT_DUO";
7212
+ var winCriteria$2 = {
7212
7213
  valueGoal: 2
7213
7214
  };
7214
7215
  var DOMINANT_DUO_TIE_FORMAT = {
7215
- collectionDefinitions: collectionDefinitions$1,
7216
- tieFormatName: tieFormatName,
7217
- winCriteria: winCriteria$1
7216
+ collectionDefinitions: collectionDefinitions$2,
7217
+ tieFormatName: tieFormatName$1,
7218
+ winCriteria: winCriteria$2
7218
7219
  };
7219
7220
 
7220
- var winCriteria = {
7221
+ var winCriteria$1 = {
7221
7222
  valueGoal: 13
7222
7223
  };
7223
- var collectionDefinitions = [
7224
+ var collectionDefinitions$1 = [
7224
7225
  {
7225
7226
  collectionGroupNumber: 1,
7226
7227
  matchUpType: "DOUBLES",
@@ -7279,17 +7280,51 @@ var collectionGroups = [
7279
7280
  }
7280
7281
  ];
7281
7282
  var LAVER_CUP_TIE_FORMAT = {
7282
- winCriteria: winCriteria,
7283
- collectionDefinitions: collectionDefinitions,
7283
+ winCriteria: winCriteria$1,
7284
+ collectionDefinitions: collectionDefinitions$1,
7284
7285
  collectionGroups: collectionGroups
7285
7286
  };
7286
7287
 
7288
+ var collectionDefinitions = [
7289
+ {
7290
+ collectionName: "Round 1",
7291
+ matchUpCount: 3,
7292
+ matchUpFormat: "SET1-S:T20",
7293
+ matchUpType: "DOUBLES",
7294
+ scoreValue: 1
7295
+ },
7296
+ {
7297
+ collectionName: "Round 2",
7298
+ matchUpCount: 3,
7299
+ matchUpFormat: "SET1-S:T20",
7300
+ matchUpType: "DOUBLES",
7301
+ scoreValue: 1
7302
+ },
7303
+ {
7304
+ collectionName: "Round 3",
7305
+ matchUpCount: 3,
7306
+ matchUpFormat: "SET1-S:T20",
7307
+ matchUpType: "DOUBLES",
7308
+ scoreValue: 1
7309
+ }
7310
+ ];
7311
+ var tieFormatName = "Doubles Shuffle";
7312
+ var winCriteria = {
7313
+ aggregateValue: true
7314
+ };
7315
+ var TEAM_AGGREGATION_TIE_FORMAT = {
7316
+ collectionDefinitions: collectionDefinitions,
7317
+ tieFormatName: tieFormatName,
7318
+ winCriteria: winCriteria
7319
+ };
7320
+
7287
7321
  const tieFormats = {
7288
7322
  COLLEGE_D3: COLLEGE_D3$1,
7289
7323
  COLLEGE_DEFAULT: COLLEGE_DEFAULT$1,
7290
7324
  COLLEGE_JUCO: COLLEGE_JUCO$1,
7291
7325
  DOMINANT_DUO: DOMINANT_DUO_TIE_FORMAT,
7292
- LAVER_CUP: LAVER_CUP_TIE_FORMAT
7326
+ LAVER_CUP: LAVER_CUP_TIE_FORMAT,
7327
+ TEAM_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT
7293
7328
  };
7294
7329
 
7295
7330
  const POLICY_AVOIDANCE_COUNTRY = {
@@ -27867,7 +27902,7 @@ const scheduleGovernor$1 = {
27867
27902
  };
27868
27903
 
27869
27904
  function factoryVersion() {
27870
- return '0.59.2';
27905
+ return '0.59.3';
27871
27906
  }
27872
27907
 
27873
27908
  function attachPolicies$2({
@@ -41570,12 +41605,14 @@ const COLLEGE_JUCO = 'COLLEGE_JUCO';
41570
41605
  const COLLEGE_D3 = 'COLLEGE_D3';
41571
41606
  const DOMINANT_DUO = 'DOMINANT_DUO';
41572
41607
  const LAVER_CUP = 'LAVER_CUP';
41608
+ const TEAM_AGGREGATION = 'TEAM_AGGREGATION';
41573
41609
  const tieFormatConstants = {
41574
41610
  COLLEGE_D3,
41575
41611
  COLLEGE_DEFAULT,
41576
41612
  COLLEGE_JUCO,
41577
41613
  DOMINANT_DUO,
41578
- LAVER_CUP
41614
+ LAVER_CUP,
41615
+ TEAM_AGGREGATION
41579
41616
  };
41580
41617
 
41581
41618
  const namedFormats = {
@@ -41637,7 +41674,8 @@ const namedFormats = {
41637
41674
  valueGoal: 5
41638
41675
  },
41639
41676
  [LAVER_CUP]: LAVER_CUP_TIE_FORMAT,
41640
- [DOMINANT_DUO]: DOMINANT_DUO_TIE_FORMAT
41677
+ [DOMINANT_DUO]: DOMINANT_DUO_TIE_FORMAT,
41678
+ [TEAM_AGGREGATION]: TEAM_AGGREGATION_TIE_FORMAT
41641
41679
  };
41642
41680
  const tieFormatDefaults = ({
41643
41681
  namedFormat,
@@ -49800,7 +49838,7 @@ function generateSet({
49800
49838
  const {
49801
49839
  NoAD: tiebreakNoAd,
49802
49840
  tiebreakTo
49803
- } = tiebreakFormat || tiebreakSet;
49841
+ } = tiebreakFormat || tiebreakSet || {};
49804
49842
  const range = generateRange(1, tiebreakTo + 1).map(value => generateRange(0, tiebreakTo + 2 - value).map(() => value)).flat();
49805
49843
  const lowValue = range[randomInt(0, range.length - 1)];
49806
49844
  let scores = getTiebreakComplement({