tods-competition-factory 0.96.0 → 0.97.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.96.0';
252
+ return '0.97.0';
253
253
  }
254
254
 
255
255
  const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
@@ -3920,8 +3920,9 @@ function generateTieMatchUpScore({
3920
3920
  sideWins: [0, 0],
3921
3921
  values: [0, 0]
3922
3922
  }
3923
- })));
3924
- const groupValueNumbers = Object.keys(groupValueGroups);
3923
+ }))); // must be coerced to numbers
3924
+
3925
+ const groupValueNumbers = Object.keys(groupValueGroups).map(num => parseInt(num));
3925
3926
 
3926
3927
  for (const collectionDefinition of collectionDefinitions) {
3927
3928
  const collectionMatchUps = tieMatchUps.filter(matchUp => matchUp.collectionId === collectionDefinition.collectionId); // keep track of the values derived from matchUps
@@ -53179,33 +53180,45 @@ function genParticipantId({
53179
53180
  }
53180
53181
 
53181
53182
  function processTieFormat({
53182
- tieFormat,
53183
+ alternatesCount = 0,
53183
53184
  tieFormatName,
53184
- drawSize,
53185
- alternatesCount = 0
53185
+ tieFormat,
53186
+ drawSize
53186
53187
  }) {
53187
53188
  var _tieFormat, _tieFormat$collection;
53188
53189
 
53189
53190
  let maxDoublesCount = 0,
53190
53191
  maxSinglesCount = 0;
53192
+ let singlesMatchUpTotal = 0,
53193
+ doublesMatchUpTotal = 0;
53194
+ let categories = 0;
53191
53195
  tieFormat = typeof tieFormat === 'object' ? tieFormat : tieFormatDefaults({
53192
53196
  namedFormat: tieFormatName
53193
53197
  });
53194
- (_tieFormat = tieFormat) === null || _tieFormat === void 0 ? void 0 : (_tieFormat$collection = _tieFormat.collectionDefinitions) === null || _tieFormat$collection === void 0 ? void 0 : _tieFormat$collection.forEach(collectionDefinition => {
53195
- // ensure every collectionDefinition has a collectionId
53196
- if (!collectionDefinition.collectionId) collectionDefinition.collectionId = UUID();
53198
+ (_tieFormat = tieFormat) === null || _tieFormat === void 0 ? void 0 : (_tieFormat$collection = _tieFormat.collectionDefinitions) === null || _tieFormat$collection === void 0 ? void 0 : _tieFormat$collection.filter(Boolean).forEach(collectionDefinition => {
53199
+ const {
53200
+ category,
53201
+ collectionId,
53202
+ matchUpType,
53203
+ matchUpCount
53204
+ } = collectionDefinition;
53205
+ if (category) categories += 1; // ensure every collectionDefinition has a collectionId
53206
+
53207
+ if (!collectionId) collectionDefinition.collectionId = UUID();
53197
53208
 
53198
- if ((collectionDefinition === null || collectionDefinition === void 0 ? void 0 : collectionDefinition.matchUpType) === DOUBLES$1) {
53199
- const doublesCount = collectionDefinition.matchUpCount;
53209
+ if (matchUpType === DOUBLES$1) {
53210
+ const doublesCount = matchUpCount;
53211
+ doublesMatchUpTotal += matchUpCount;
53200
53212
  maxDoublesCount = Math.max(maxDoublesCount, doublesCount);
53201
53213
  }
53202
53214
 
53203
- if ((collectionDefinition === null || collectionDefinition === void 0 ? void 0 : collectionDefinition.matchUpType) === SINGLES$1) {
53204
- const singlescount = collectionDefinition.matchUpCount;
53215
+ if (matchUpType === SINGLES$1) {
53216
+ const singlescount = matchUpCount;
53217
+ singlesMatchUpTotal += matchUpCount;
53205
53218
  maxSinglesCount = Math.max(maxSinglesCount, singlescount);
53206
53219
  }
53207
53220
  });
53208
- const teamSize = Math.max(maxSinglesCount, maxDoublesCount * 2);
53221
+ const teamSize = categories ? Math.max(singlesMatchUpTotal, doublesMatchUpTotal * 2) : Math.max(maxSinglesCount, maxDoublesCount * 2);
53209
53222
  const maxDoublesDraw = maxDoublesCount * (drawSize + alternatesCount);
53210
53223
  const maxSinglesDraw = maxSinglesCount * (drawSize + alternatesCount);
53211
53224
  return {