tods-competition-factory 1.7.9 → 1.7.11
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/forge/generate.mjs +29 -21
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +5 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +14 -10
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +68 -65
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +82 -71
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
package/dist/forge/generate.mjs
CHANGED
|
@@ -16595,20 +16595,20 @@ function evaluateCollectionResult({
|
|
|
16595
16595
|
if (matchUp.winningSide)
|
|
16596
16596
|
sideWins[matchUp.winningSide - 1] += 1;
|
|
16597
16597
|
});
|
|
16598
|
-
if (matchUpValue) {
|
|
16598
|
+
if (isConvertableInteger(matchUpValue)) {
|
|
16599
16599
|
collectionMatchUps.forEach((matchUp) => {
|
|
16600
16600
|
if (matchUp.winningSide) {
|
|
16601
16601
|
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
|
|
16602
16602
|
}
|
|
16603
16603
|
});
|
|
16604
|
-
} else if (setValue) {
|
|
16604
|
+
} else if (isConvertableInteger(setValue)) {
|
|
16605
16605
|
collectionMatchUps.forEach((matchUp) => {
|
|
16606
16606
|
matchUp.score?.sets?.forEach((set) => {
|
|
16607
16607
|
if (set.winningSide)
|
|
16608
16608
|
sideMatchUpValues[set.winningSide - 1] += setValue;
|
|
16609
16609
|
});
|
|
16610
16610
|
});
|
|
16611
|
-
} else if (scoreValue) {
|
|
16611
|
+
} else if (isConvertableInteger(scoreValue)) {
|
|
16612
16612
|
collectionMatchUps.forEach((matchUp) => {
|
|
16613
16613
|
matchUp.score?.sets?.forEach((set) => {
|
|
16614
16614
|
const {
|
|
@@ -16635,15 +16635,17 @@ function evaluateCollectionResult({
|
|
|
16635
16635
|
collectionDefinition,
|
|
16636
16636
|
collectionPosition
|
|
16637
16637
|
});
|
|
16638
|
-
|
|
16638
|
+
if (isConvertableInteger(matchUpValue2)) {
|
|
16639
|
+
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
|
|
16640
|
+
}
|
|
16639
16641
|
}
|
|
16640
16642
|
});
|
|
16641
16643
|
}
|
|
16642
|
-
if (collectionValue) {
|
|
16644
|
+
if (isConvertableInteger(collectionValue)) {
|
|
16643
16645
|
let collectionWinningSide;
|
|
16644
16646
|
if (winCriteria?.aggregateValue) {
|
|
16645
16647
|
if (allCollectionMatchUpsCompleted) {
|
|
16646
|
-
if ((matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
16648
|
+
if (isConvertableInteger(matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
16647
16649
|
collectionWinningSide = sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
|
|
16648
16650
|
} else if (sideWins[0] !== sideWins[1]) {
|
|
16649
16651
|
collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
|
|
@@ -16679,7 +16681,7 @@ function evaluateCollectionResult({
|
|
|
16679
16681
|
}
|
|
16680
16682
|
if (!belongsToValueGroup) {
|
|
16681
16683
|
sideCollectionValues.forEach(
|
|
16682
|
-
(sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue
|
|
16684
|
+
(sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue || 0
|
|
16683
16685
|
);
|
|
16684
16686
|
} else {
|
|
16685
16687
|
groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
|
|
@@ -16704,7 +16706,9 @@ function getGroupValueGroups({
|
|
|
16704
16706
|
}) {
|
|
16705
16707
|
const groupValueGroups = Object.assign(
|
|
16706
16708
|
{},
|
|
16707
|
-
...collectionGroups.filter(
|
|
16709
|
+
...collectionGroups.filter(
|
|
16710
|
+
(group) => isConvertableInteger(group?.groupValue) && group?.groupNumber
|
|
16711
|
+
).map((group) => ({
|
|
16708
16712
|
[group.groupNumber]: {
|
|
16709
16713
|
...group,
|
|
16710
16714
|
allGroupMatchUpsCompleted: true,
|
|
@@ -16781,11 +16785,11 @@ function generateTieMatchUpScore(params) {
|
|
|
16781
16785
|
}, void 0);
|
|
16782
16786
|
}
|
|
16783
16787
|
if (groupWinningSide) {
|
|
16784
|
-
sideTieValues[groupWinningSide - 1] += groupValue;
|
|
16788
|
+
sideTieValues[groupWinningSide - 1] += groupValue || 0;
|
|
16785
16789
|
}
|
|
16786
16790
|
}
|
|
16787
16791
|
const sideScores = sideTieValues.map(
|
|
16788
|
-
(sideTieValue, i) => sideTieValue + sideAdjustments[i]
|
|
16792
|
+
(sideTieValue, i) => (sideTieValue || 0) + sideAdjustments[i]
|
|
16789
16793
|
);
|
|
16790
16794
|
const set = {
|
|
16791
16795
|
side1Score: sideScores[0],
|
|
@@ -19691,6 +19695,16 @@ function generateAdHocMatchUps({
|
|
|
19691
19695
|
);
|
|
19692
19696
|
if (!structure)
|
|
19693
19697
|
return { error: STRUCTURE_NOT_FOUND };
|
|
19698
|
+
let structureHasRoundPositions;
|
|
19699
|
+
const existingMatchUps = structure.matchUps ?? [];
|
|
19700
|
+
const lastRoundNumber = existingMatchUps?.reduce(
|
|
19701
|
+
(roundNumber2, matchUp) => {
|
|
19702
|
+
if (matchUp.roundPosition)
|
|
19703
|
+
structureHasRoundPositions = true;
|
|
19704
|
+
return (matchUp?.roundNumber || 0) > roundNumber2 ? matchUp.roundNumber : roundNumber2;
|
|
19705
|
+
},
|
|
19706
|
+
0
|
|
19707
|
+
);
|
|
19694
19708
|
if (!matchUpsCount) {
|
|
19695
19709
|
const selectedEntries = drawDefinition?.entries?.filter((entry) => {
|
|
19696
19710
|
const entryStatus = entry.entryStatus;
|
|
@@ -19700,7 +19714,11 @@ function generateAdHocMatchUps({
|
|
|
19700
19714
|
if (newRound) {
|
|
19701
19715
|
matchUpsCount = roundMatchUpsCount;
|
|
19702
19716
|
} else {
|
|
19703
|
-
const
|
|
19717
|
+
const targetRoundNumber = roundNumber || lastRoundNumber || 1;
|
|
19718
|
+
const existingRoundMatchUps = structure.matchUps?.filter(
|
|
19719
|
+
(matchUp) => matchUp.roundNumber === targetRoundNumber
|
|
19720
|
+
)?.length || 0;
|
|
19721
|
+
const maxRemaining = roundMatchUpsCount - existingRoundMatchUps;
|
|
19704
19722
|
if (maxRemaining > 0)
|
|
19705
19723
|
matchUpsCount = maxRemaining;
|
|
19706
19724
|
}
|
|
@@ -19708,16 +19726,6 @@ function generateAdHocMatchUps({
|
|
|
19708
19726
|
if (participantIdPairings && !Array.isArray(participantIdPairings) || matchUpsCount && !isConvertableInteger(matchUpsCount) || matchUpIds && !Array.isArray(matchUpIds) || !participantIdPairings && !matchUpsCount) {
|
|
19709
19727
|
return { error: INVALID_VALUES, info: "matchUpsCount or pairings error" };
|
|
19710
19728
|
}
|
|
19711
|
-
let structureHasRoundPositions;
|
|
19712
|
-
const existingMatchUps = structure.matchUps ?? [];
|
|
19713
|
-
const lastRoundNumber = existingMatchUps?.reduce(
|
|
19714
|
-
(roundNumber2, matchUp) => {
|
|
19715
|
-
if (matchUp.roundPosition)
|
|
19716
|
-
structureHasRoundPositions = true;
|
|
19717
|
-
return (matchUp?.roundNumber || 0) > roundNumber2 ? matchUp.roundNumber : roundNumber2;
|
|
19718
|
-
},
|
|
19719
|
-
0
|
|
19720
|
-
);
|
|
19721
19729
|
if (structure.structures || structureHasRoundPositions || structure.finishingPosition === ROUND_OUTCOME) {
|
|
19722
19730
|
return { error: INVALID_STRUCTURE };
|
|
19723
19731
|
}
|