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.
@@ -3041,20 +3041,20 @@ function evaluateCollectionResult({
3041
3041
  if (matchUp.winningSide)
3042
3042
  sideWins[matchUp.winningSide - 1] += 1;
3043
3043
  });
3044
- if (matchUpValue) {
3044
+ if (isConvertableInteger(matchUpValue)) {
3045
3045
  collectionMatchUps.forEach((matchUp) => {
3046
3046
  if (matchUp.winningSide) {
3047
3047
  sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
3048
3048
  }
3049
3049
  });
3050
- } else if (setValue) {
3050
+ } else if (isConvertableInteger(setValue)) {
3051
3051
  collectionMatchUps.forEach((matchUp) => {
3052
3052
  matchUp.score?.sets?.forEach((set) => {
3053
3053
  if (set.winningSide)
3054
3054
  sideMatchUpValues[set.winningSide - 1] += setValue;
3055
3055
  });
3056
3056
  });
3057
- } else if (scoreValue) {
3057
+ } else if (isConvertableInteger(scoreValue)) {
3058
3058
  collectionMatchUps.forEach((matchUp) => {
3059
3059
  matchUp.score?.sets?.forEach((set) => {
3060
3060
  const {
@@ -3081,15 +3081,17 @@ function evaluateCollectionResult({
3081
3081
  collectionDefinition,
3082
3082
  collectionPosition
3083
3083
  });
3084
- sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
3084
+ if (isConvertableInteger(matchUpValue2)) {
3085
+ sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
3086
+ }
3085
3087
  }
3086
3088
  });
3087
3089
  }
3088
- if (collectionValue) {
3090
+ if (isConvertableInteger(collectionValue)) {
3089
3091
  let collectionWinningSide;
3090
3092
  if (winCriteria?.aggregateValue) {
3091
3093
  if (allCollectionMatchUpsCompleted) {
3092
- if ((matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
3094
+ if (isConvertableInteger(matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
3093
3095
  collectionWinningSide = sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
3094
3096
  } else if (sideWins[0] !== sideWins[1]) {
3095
3097
  collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
@@ -3125,7 +3127,7 @@ function evaluateCollectionResult({
3125
3127
  }
3126
3128
  if (!belongsToValueGroup) {
3127
3129
  sideCollectionValues.forEach(
3128
- (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue
3130
+ (sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue || 0
3129
3131
  );
3130
3132
  } else {
3131
3133
  groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
@@ -6306,7 +6308,9 @@ function getGroupValueGroups({
6306
6308
  }) {
6307
6309
  const groupValueGroups = Object.assign(
6308
6310
  {},
6309
- ...collectionGroups.filter((group) => group?.groupValue && group?.groupNumber).map((group) => ({
6311
+ ...collectionGroups.filter(
6312
+ (group) => isConvertableInteger(group?.groupValue) && group?.groupNumber
6313
+ ).map((group) => ({
6310
6314
  [group.groupNumber]: {
6311
6315
  ...group,
6312
6316
  allGroupMatchUpsCompleted: true,
@@ -6383,11 +6387,11 @@ function generateTieMatchUpScore(params) {
6383
6387
  }, void 0);
6384
6388
  }
6385
6389
  if (groupWinningSide) {
6386
- sideTieValues[groupWinningSide - 1] += groupValue;
6390
+ sideTieValues[groupWinningSide - 1] += groupValue || 0;
6387
6391
  }
6388
6392
  }
6389
6393
  const sideScores = sideTieValues.map(
6390
- (sideTieValue, i) => sideTieValue + sideAdjustments[i]
6394
+ (sideTieValue, i) => (sideTieValue || 0) + sideAdjustments[i]
6391
6395
  );
6392
6396
  const set = {
6393
6397
  side1Score: sideScores[0],