tods-competition-factory 1.6.11 → 1.6.13
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 +83 -71
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +5 -4
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +82 -70
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +91 -79
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +120 -107
- 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 +2 -2
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ const matchUpFormatCode = {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
function factoryVersion() {
|
|
332
|
-
return "1.6.
|
|
332
|
+
return "1.6.13";
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
function getObjectTieFormat(obj) {
|
|
@@ -2784,7 +2784,7 @@ function validMatchUp(matchUp) {
|
|
|
2784
2784
|
const { matchUpId, drawPositions } = matchUp;
|
|
2785
2785
|
const validMatchUpId = typeof matchUpId === "string";
|
|
2786
2786
|
const validDrawPositions = !drawPositions || Array.isArray(drawPositions) && drawPositions.length <= 2 && drawPositions.every(
|
|
2787
|
-
(dp) => isConvertableInteger(dp) || dp === void 0
|
|
2787
|
+
(dp) => isConvertableInteger(dp) || dp === void 0 || dp === null
|
|
2788
2788
|
);
|
|
2789
2789
|
return validMatchUpId && validDrawPositions;
|
|
2790
2790
|
}
|
|
@@ -3054,7 +3054,7 @@ function getParticipantResults({
|
|
|
3054
3054
|
const manualGamesOverride = tieFormat && matchUp._disableAutoCalc && tieFormat.collectionDefinitions.every(({ scoreValue }) => scoreValue);
|
|
3055
3055
|
const winningParticipantId = winningSide && getWinningSideId(matchUp);
|
|
3056
3056
|
const losingParticipantId = winningSide && getLosingSideId(matchUp);
|
|
3057
|
-
if (!winningParticipantId
|
|
3057
|
+
if (!winningParticipantId && !losingParticipantId) {
|
|
3058
3058
|
if (completedMatchUpStatuses.includes(matchUpStatus)) {
|
|
3059
3059
|
const participantIdSide1 = getSideId(matchUp, 0);
|
|
3060
3060
|
const participantIdSide2 = getSideId(matchUp, 1);
|
|
@@ -3066,53 +3066,51 @@ function getParticipantResults({
|
|
|
3066
3066
|
checkInitializeParticipant(participantResults, participantIdSide2);
|
|
3067
3067
|
participantResults[participantIdSide2].matchUpsCancelled += 1;
|
|
3068
3068
|
}
|
|
3069
|
-
} else {
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
3097
|
-
}
|
|
3069
|
+
} else if (tieMatchUps?.length) {
|
|
3070
|
+
perPlayer = 0;
|
|
3071
|
+
for (const tieMatchUp of tieMatchUps) {
|
|
3072
|
+
if (tieMatchUp.winningSide) {
|
|
3073
|
+
const tieWinningParticipantId = sides.find(
|
|
3074
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
3075
|
+
)?.participantId;
|
|
3076
|
+
const tieLosingParticipantId = sides.find(
|
|
3077
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
3078
|
+
)?.participantId;
|
|
3079
|
+
if (tieWinningParticipantId && tieLosingParticipantId) {
|
|
3080
|
+
checkInitializeParticipant(
|
|
3081
|
+
participantResults,
|
|
3082
|
+
tieWinningParticipantId
|
|
3083
|
+
);
|
|
3084
|
+
checkInitializeParticipant(
|
|
3085
|
+
participantResults,
|
|
3086
|
+
tieLosingParticipantId
|
|
3087
|
+
);
|
|
3088
|
+
participantResults[tieWinningParticipantId].tieMatchUpsWon += 1;
|
|
3089
|
+
participantResults[tieLosingParticipantId].tieMatchUpsLost += 1;
|
|
3090
|
+
if (tieMatchUp.matchUpType === SINGLES$1) {
|
|
3091
|
+
participantResults[tieWinningParticipantId].tieSinglesWon += 1;
|
|
3092
|
+
participantResults[tieLosingParticipantId].tieSinglesLost += 1;
|
|
3093
|
+
} else if (tieMatchUp.matchUpType === DOUBLES$1) {
|
|
3094
|
+
participantResults[tieWinningParticipantId].tieDoublesWon += 1;
|
|
3095
|
+
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
3098
3096
|
}
|
|
3099
3097
|
}
|
|
3100
|
-
processScore({
|
|
3101
|
-
score: tieMatchUp.score,
|
|
3102
|
-
manualGamesOverride,
|
|
3103
|
-
participantResults,
|
|
3104
|
-
sides
|
|
3105
|
-
// use sides from the TEAM matchUp
|
|
3106
|
-
});
|
|
3107
3098
|
}
|
|
3108
|
-
} else {
|
|
3109
3099
|
processScore({
|
|
3100
|
+
score: tieMatchUp.score,
|
|
3110
3101
|
manualGamesOverride,
|
|
3111
3102
|
participantResults,
|
|
3112
|
-
score,
|
|
3113
3103
|
sides
|
|
3104
|
+
// use sides from the TEAM matchUp
|
|
3114
3105
|
});
|
|
3115
3106
|
}
|
|
3107
|
+
} else {
|
|
3108
|
+
processScore({
|
|
3109
|
+
manualGamesOverride,
|
|
3110
|
+
participantResults,
|
|
3111
|
+
score,
|
|
3112
|
+
sides
|
|
3113
|
+
});
|
|
3116
3114
|
}
|
|
3117
3115
|
} else {
|
|
3118
3116
|
checkInitializeParticipant(participantResults, winningParticipantId);
|
|
@@ -7010,9 +7008,10 @@ function getSourceDrawPositionRanges({
|
|
|
7010
7008
|
structureId: sourceStructureId,
|
|
7011
7009
|
matchUpsMap
|
|
7012
7010
|
});
|
|
7013
|
-
const
|
|
7011
|
+
const roundMatchUpsResult = getRoundMatchUps$1({
|
|
7014
7012
|
matchUps: structureMatchUps2
|
|
7015
7013
|
});
|
|
7014
|
+
const roundProfile = roundMatchUpsResult.roundProfile;
|
|
7016
7015
|
return { [sourceStructureId]: roundProfile };
|
|
7017
7016
|
})
|
|
7018
7017
|
);
|
|
@@ -9652,9 +9651,8 @@ function modifyMatchUpScore({
|
|
|
9652
9651
|
return { error: MATCHUP_NOT_FOUND };
|
|
9653
9652
|
({ matchUp, structure } = findResult);
|
|
9654
9653
|
}
|
|
9655
|
-
} else {
|
|
9656
|
-
|
|
9657
|
-
console.log("!!!!!");
|
|
9654
|
+
} else if (matchUp.matchUpId !== matchUpId) {
|
|
9655
|
+
console.log("!!!!!");
|
|
9658
9656
|
}
|
|
9659
9657
|
if (matchUpStatus && [WALKOVER$2, DOUBLE_WALKOVER].includes(matchUpStatus) || removeScore) {
|
|
9660
9658
|
Object.assign(matchUp, { ...toBePlayed });
|
|
@@ -9692,31 +9690,45 @@ function modifyMatchUpScore({
|
|
|
9692
9690
|
})?.appliedPolicies;
|
|
9693
9691
|
defaultedProcessCodes = appliedPolicies?.[POLICY_TYPE_SCORING]?.processCodes?.incompleteAssignmentsOnDefault;
|
|
9694
9692
|
}
|
|
9695
|
-
if (
|
|
9696
|
-
|
|
9697
|
-
const
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
|
|
9715
|
-
|
|
9716
|
-
|
|
9717
|
-
|
|
9718
|
-
|
|
9719
|
-
|
|
9693
|
+
if (!matchUp.collectionId) {
|
|
9694
|
+
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
9695
|
+
const isAdHocStructure = isAdHoc({ drawDefinition, structure });
|
|
9696
|
+
if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
|
|
9697
|
+
const updateTally = (structure2) => {
|
|
9698
|
+
matchUpFormat = isDualMatchUp ? "SET1-S:T100" : matchUpFormat ?? matchUp.matchUpFormat ?? structure2?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
9699
|
+
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : void 0;
|
|
9700
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
9701
|
+
afterRecoveryTimes: false,
|
|
9702
|
+
inContext: true,
|
|
9703
|
+
matchUpFilters,
|
|
9704
|
+
structure: structure2,
|
|
9705
|
+
event
|
|
9706
|
+
});
|
|
9707
|
+
if (isAdHocStructure) {
|
|
9708
|
+
structure2.positionAssignments = unique(
|
|
9709
|
+
matchUps.flatMap(
|
|
9710
|
+
(matchUp2) => (matchUp2.sides ?? []).map((side) => side.participantId)
|
|
9711
|
+
).filter(Boolean)
|
|
9712
|
+
).map((participantId) => ({ participantId }));
|
|
9713
|
+
}
|
|
9714
|
+
return updateAssignmentParticipantResults({
|
|
9715
|
+
positionAssignments: structure2.positionAssignments,
|
|
9716
|
+
tournamentRecord,
|
|
9717
|
+
drawDefinition,
|
|
9718
|
+
matchUpFormat,
|
|
9719
|
+
matchUps,
|
|
9720
|
+
event
|
|
9721
|
+
});
|
|
9722
|
+
};
|
|
9723
|
+
const itemStructure = isRoundRobin && structure.structures.find((itemStructure2) => {
|
|
9724
|
+
return itemStructure2?.matchUps.find(
|
|
9725
|
+
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
9726
|
+
);
|
|
9727
|
+
});
|
|
9728
|
+
const result = updateTally(itemStructure || structure);
|
|
9729
|
+
if (result.error)
|
|
9730
|
+
return decorateResult({ result, stack });
|
|
9731
|
+
}
|
|
9720
9732
|
}
|
|
9721
9733
|
if (notes) {
|
|
9722
9734
|
const result = addNotes({ element: matchUp, notes });
|
|
@@ -23020,7 +23032,7 @@ function getValidSeedBlocks({
|
|
|
23020
23032
|
});
|
|
23021
23033
|
const { positionAssignments } = structureAssignedDrawPositions({ structure });
|
|
23022
23034
|
const positionsCount = positionAssignments?.length;
|
|
23023
|
-
const seedsCount = seedAssignments?.length
|
|
23035
|
+
const seedsCount = seedAssignments?.length ?? 0;
|
|
23024
23036
|
let allDrawPositions = [];
|
|
23025
23037
|
const roundNumbers = Object.keys(roundMatchUps).map((n) => parseInt(n)).sort((a, b) => a - b);
|
|
23026
23038
|
const uniqueDrawPositionsByRound = roundNumbers.map((roundNumber) => {
|
|
@@ -23282,7 +23294,7 @@ function getNextSeedBlock(params) {
|
|
|
23282
23294
|
const seedsWithoutDrawPositions = seedAssignments?.filter(
|
|
23283
23295
|
(assignment) => !assignment.participantId
|
|
23284
23296
|
);
|
|
23285
|
-
const seedsLeftToAssign = unplacedSeedAssignments?.length
|
|
23297
|
+
const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0 ? unplacedSeedAssignments.length : seedsWithoutDrawPositions?.length ?? 0;
|
|
23286
23298
|
const unfilled = seedsLeftToAssign && nextSeedBlock?.drawPositions.filter(
|
|
23287
23299
|
(drawPosition) => !assignedDrawPositions?.includes(drawPosition)
|
|
23288
23300
|
) || [];
|
|
@@ -28483,7 +28495,7 @@ function getParticipantEntries(params) {
|
|
|
28483
28495
|
}));
|
|
28484
28496
|
}
|
|
28485
28497
|
const addEventEntry = (id) => {
|
|
28486
|
-
if (participantMap[id]?.events[eventId])
|
|
28498
|
+
if (participantMap[id]?.events?.[eventId])
|
|
28487
28499
|
return;
|
|
28488
28500
|
const participant = participantMap[id];
|
|
28489
28501
|
processEventEntry({
|
|
@@ -28552,7 +28564,7 @@ function getParticipantEntries(params) {
|
|
|
28552
28564
|
const relevantEntries = entries2.filter(
|
|
28553
28565
|
({ participantId }) => assignedParticipantIds.includes(participantId)
|
|
28554
28566
|
);
|
|
28555
|
-
const publishedSeeding2 = eventsPublishStatuses[eventId]?.publishedSeeding;
|
|
28567
|
+
const publishedSeeding2 = eventsPublishStatuses?.[eventId]?.publishedSeeding;
|
|
28556
28568
|
const seedingPublished = !usePublishState || publishedSeeding2?.published && (publishedSeeding2?.drawIds?.length === 0 || publishedSeeding2?.drawIds?.includes(drawId));
|
|
28557
28569
|
for (const entry of relevantEntries) {
|
|
28558
28570
|
const { entryStatus, entryStage, entryPosition, participantId } = entry;
|
|
@@ -28562,7 +28574,7 @@ function getParticipantEntries(params) {
|
|
|
28562
28574
|
eventType
|
|
28563
28575
|
});
|
|
28564
28576
|
const addDrawEntry = (id) => {
|
|
28565
|
-
if (participantMap[id].draws[drawId])
|
|
28577
|
+
if (participantMap[id].draws?.[drawId])
|
|
28566
28578
|
return;
|
|
28567
28579
|
const includeSeeding = withSeeding && seedingPublished;
|
|
28568
28580
|
const seedAssignments = includeSeeding ? {} : void 0;
|
|
@@ -28894,9 +28906,9 @@ function getParticipants$1(params) {
|
|
|
28894
28906
|
withIOC
|
|
28895
28907
|
});
|
|
28896
28908
|
const entriesResult = getParticipantEntries({
|
|
28897
|
-
withMatchUps: withMatchUps
|
|
28898
|
-
withEvents: withEvents
|
|
28899
|
-
withDraws: withDraws
|
|
28909
|
+
withMatchUps: withMatchUps ?? withRankingProfile,
|
|
28910
|
+
withEvents: withEvents ?? withRankingProfile,
|
|
28911
|
+
withDraws: withDraws ?? withRankingProfile,
|
|
28900
28912
|
withPotentialMatchUps,
|
|
28901
28913
|
participantFilters,
|
|
28902
28914
|
withRankingProfile,
|
|
@@ -28922,7 +28934,7 @@ function getParticipants$1(params) {
|
|
|
28922
28934
|
} = entriesResult;
|
|
28923
28935
|
const matchUps = entriesResult.matchUps;
|
|
28924
28936
|
participantMap = entriesResult.participantMap;
|
|
28925
|
-
const nextMatchUps = scheduleAnalysis
|
|
28937
|
+
const nextMatchUps = scheduleAnalysis ?? withPotentialMatchUps;
|
|
28926
28938
|
const processedParticipants = Object.values(participantMap).map(
|
|
28927
28939
|
({
|
|
28928
28940
|
potentialMatchUps,
|