tods-competition-factory 1.7.9 → 1.7.10

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.
package/dist/index.mjs CHANGED
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
333
333
  };
334
334
 
335
335
  function factoryVersion() {
336
- return "1.7.9";
336
+ return "1.7.10";
337
337
  }
338
338
 
339
339
  function getObjectTieFormat(obj) {
@@ -3972,20 +3972,20 @@ function evaluateCollectionResult({
3972
3972
  if (matchUp.winningSide)
3973
3973
  sideWins[matchUp.winningSide - 1] += 1;
3974
3974
  });
3975
- if (matchUpValue) {
3975
+ if (isConvertableInteger(matchUpValue)) {
3976
3976
  collectionMatchUps.forEach((matchUp) => {
3977
3977
  if (matchUp.winningSide) {
3978
3978
  sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
3979
3979
  }
3980
3980
  });
3981
- } else if (setValue) {
3981
+ } else if (isConvertableInteger(setValue)) {
3982
3982
  collectionMatchUps.forEach((matchUp) => {
3983
3983
  matchUp.score?.sets?.forEach((set) => {
3984
3984
  if (set.winningSide)
3985
3985
  sideMatchUpValues[set.winningSide - 1] += setValue;
3986
3986
  });
3987
3987
  });
3988
- } else if (scoreValue) {
3988
+ } else if (isConvertableInteger(scoreValue)) {
3989
3989
  collectionMatchUps.forEach((matchUp) => {
3990
3990
  matchUp.score?.sets?.forEach((set) => {
3991
3991
  const {
@@ -4012,15 +4012,17 @@ function evaluateCollectionResult({
4012
4012
  collectionDefinition,
4013
4013
  collectionPosition
4014
4014
  });
4015
- sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
4015
+ if (isConvertableInteger(matchUpValue2)) {
4016
+ sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
4017
+ }
4016
4018
  }
4017
4019
  });
4018
4020
  }
4019
- if (collectionValue) {
4021
+ if (isConvertableInteger(collectionValue)) {
4020
4022
  let collectionWinningSide;
4021
4023
  if (winCriteria?.aggregateValue) {
4022
4024
  if (allCollectionMatchUpsCompleted) {
4023
- if ((matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
4025
+ if (isConvertableInteger(matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
4024
4026
  collectionWinningSide = sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
4025
4027
  } else if (sideWins[0] !== sideWins[1]) {
4026
4028
  collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
@@ -4056,7 +4058,7 @@ function evaluateCollectionResult({
4056
4058
  }
4057
4059
  if (!belongsToValueGroup) {
4058
4060
  sideCollectionValues.forEach(
4059
- (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue
4061
+ (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue || 0
4060
4062
  );
4061
4063
  } else {
4062
4064
  groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
@@ -8372,7 +8374,9 @@ function getGroupValueGroups({
8372
8374
  }) {
8373
8375
  const groupValueGroups = Object.assign(
8374
8376
  {},
8375
- ...collectionGroups.filter((group) => group?.groupValue && group?.groupNumber).map((group) => ({
8377
+ ...collectionGroups.filter(
8378
+ (group) => isConvertableInteger(group?.groupValue) && group?.groupNumber
8379
+ ).map((group) => ({
8376
8380
  [group.groupNumber]: {
8377
8381
  ...group,
8378
8382
  allGroupMatchUpsCompleted: true,
@@ -8449,11 +8453,11 @@ function generateTieMatchUpScore(params) {
8449
8453
  }, void 0);
8450
8454
  }
8451
8455
  if (groupWinningSide) {
8452
- sideTieValues[groupWinningSide - 1] += groupValue;
8456
+ sideTieValues[groupWinningSide - 1] += groupValue || 0;
8453
8457
  }
8454
8458
  }
8455
8459
  const sideScores = sideTieValues.map(
8456
- (sideTieValue, i) => sideTieValue + sideAdjustments[i]
8460
+ (sideTieValue, i) => (sideTieValue || 0) + sideAdjustments[i]
8457
8461
  );
8458
8462
  const set = {
8459
8463
  side1Score: sideScores[0],
@@ -15120,20 +15124,18 @@ function calculateWinCriteria({
15120
15124
  setValue
15121
15125
  } = collectionDefinition;
15122
15126
  const belongsToValueGroup = collectionGroupNumber && groupValueNumbers.includes(collectionGroupNumber);
15123
- if (setValue || scoreValue) {
15127
+ if (isConvertableInteger(setValue || scoreValue)) {
15124
15128
  aggregateValueImperative = true;
15125
15129
  } else if (belongsToValueGroup) {
15126
15130
  continue;
15127
- } else if (collectionValue) {
15131
+ } else if (typeof collectionValue === "number" && isConvertableInteger(collectionValue)) {
15128
15132
  valueTotal += collectionValue;
15129
15133
  } else if (collectionValueProfiles?.length) {
15130
15134
  for (const collectionValueProfile of collectionValueProfiles) {
15131
15135
  valueTotal += collectionValueProfile.matchUpValue;
15132
15136
  }
15133
- } else if (matchUpValue) {
15137
+ } else if (typeof matchUpValue === "number" && isConvertableInteger(matchUpValue)) {
15134
15138
  valueTotal += (matchUpCount || 0) * matchUpValue;
15135
- } else {
15136
- valueTotal += matchUpCount || 0;
15137
15139
  }
15138
15140
  }
15139
15141
  for (const collectionGroup of collectionGroups) {