tods-competition-factory 1.6.11 → 1.6.12
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 +80 -69
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +2 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +79 -68
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +88 -77
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +116 -104
- 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/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.12";
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
function getObjectTieFormat(obj) {
|
|
@@ -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);
|
|
@@ -9652,9 +9650,8 @@ function modifyMatchUpScore({
|
|
|
9652
9650
|
return { error: MATCHUP_NOT_FOUND };
|
|
9653
9651
|
({ matchUp, structure } = findResult);
|
|
9654
9652
|
}
|
|
9655
|
-
} else {
|
|
9656
|
-
|
|
9657
|
-
console.log("!!!!!");
|
|
9653
|
+
} else if (matchUp.matchUpId !== matchUpId) {
|
|
9654
|
+
console.log("!!!!!");
|
|
9658
9655
|
}
|
|
9659
9656
|
if (matchUpStatus && [WALKOVER$2, DOUBLE_WALKOVER].includes(matchUpStatus) || removeScore) {
|
|
9660
9657
|
Object.assign(matchUp, { ...toBePlayed });
|
|
@@ -9692,31 +9689,45 @@ function modifyMatchUpScore({
|
|
|
9692
9689
|
})?.appliedPolicies;
|
|
9693
9690
|
defaultedProcessCodes = appliedPolicies?.[POLICY_TYPE_SCORING]?.processCodes?.incompleteAssignmentsOnDefault;
|
|
9694
9691
|
}
|
|
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
|
-
|
|
9692
|
+
if (!matchUp.collectionId) {
|
|
9693
|
+
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
9694
|
+
const isAdHocStructure = isAdHoc({ drawDefinition, structure });
|
|
9695
|
+
if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
|
|
9696
|
+
const updateTally = (structure2) => {
|
|
9697
|
+
matchUpFormat = isDualMatchUp ? "SET1-S:T100" : matchUpFormat ?? matchUp.matchUpFormat ?? structure2?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
9698
|
+
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : void 0;
|
|
9699
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
9700
|
+
afterRecoveryTimes: false,
|
|
9701
|
+
inContext: true,
|
|
9702
|
+
matchUpFilters,
|
|
9703
|
+
structure: structure2,
|
|
9704
|
+
event
|
|
9705
|
+
});
|
|
9706
|
+
if (isAdHocStructure) {
|
|
9707
|
+
structure2.positionAssignments = unique(
|
|
9708
|
+
matchUps.flatMap(
|
|
9709
|
+
(matchUp2) => (matchUp2.sides ?? []).map((side) => side.participantId)
|
|
9710
|
+
).filter(Boolean)
|
|
9711
|
+
).map((participantId) => ({ participantId }));
|
|
9712
|
+
}
|
|
9713
|
+
return updateAssignmentParticipantResults({
|
|
9714
|
+
positionAssignments: structure2.positionAssignments,
|
|
9715
|
+
tournamentRecord,
|
|
9716
|
+
drawDefinition,
|
|
9717
|
+
matchUpFormat,
|
|
9718
|
+
matchUps,
|
|
9719
|
+
event
|
|
9720
|
+
});
|
|
9721
|
+
};
|
|
9722
|
+
const itemStructure = isRoundRobin && structure.structures.find((itemStructure2) => {
|
|
9723
|
+
return itemStructure2?.matchUps.find(
|
|
9724
|
+
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
9725
|
+
);
|
|
9726
|
+
});
|
|
9727
|
+
const result = updateTally(itemStructure || structure);
|
|
9728
|
+
if (result.error)
|
|
9729
|
+
return decorateResult({ result, stack });
|
|
9730
|
+
}
|
|
9720
9731
|
}
|
|
9721
9732
|
if (notes) {
|
|
9722
9733
|
const result = addNotes({ element: matchUp, notes });
|
|
@@ -23020,7 +23031,7 @@ function getValidSeedBlocks({
|
|
|
23020
23031
|
});
|
|
23021
23032
|
const { positionAssignments } = structureAssignedDrawPositions({ structure });
|
|
23022
23033
|
const positionsCount = positionAssignments?.length;
|
|
23023
|
-
const seedsCount = seedAssignments?.length
|
|
23034
|
+
const seedsCount = seedAssignments?.length ?? 0;
|
|
23024
23035
|
let allDrawPositions = [];
|
|
23025
23036
|
const roundNumbers = Object.keys(roundMatchUps).map((n) => parseInt(n)).sort((a, b) => a - b);
|
|
23026
23037
|
const uniqueDrawPositionsByRound = roundNumbers.map((roundNumber) => {
|
|
@@ -23282,7 +23293,7 @@ function getNextSeedBlock(params) {
|
|
|
23282
23293
|
const seedsWithoutDrawPositions = seedAssignments?.filter(
|
|
23283
23294
|
(assignment) => !assignment.participantId
|
|
23284
23295
|
);
|
|
23285
|
-
const seedsLeftToAssign = unplacedSeedAssignments?.length
|
|
23296
|
+
const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0 ? unplacedSeedAssignments.length : seedsWithoutDrawPositions?.length ?? 0;
|
|
23286
23297
|
const unfilled = seedsLeftToAssign && nextSeedBlock?.drawPositions.filter(
|
|
23287
23298
|
(drawPosition) => !assignedDrawPositions?.includes(drawPosition)
|
|
23288
23299
|
) || [];
|
|
@@ -28483,7 +28494,7 @@ function getParticipantEntries(params) {
|
|
|
28483
28494
|
}));
|
|
28484
28495
|
}
|
|
28485
28496
|
const addEventEntry = (id) => {
|
|
28486
|
-
if (participantMap[id]?.events[eventId])
|
|
28497
|
+
if (participantMap[id]?.events?.[eventId])
|
|
28487
28498
|
return;
|
|
28488
28499
|
const participant = participantMap[id];
|
|
28489
28500
|
processEventEntry({
|
|
@@ -28552,7 +28563,7 @@ function getParticipantEntries(params) {
|
|
|
28552
28563
|
const relevantEntries = entries2.filter(
|
|
28553
28564
|
({ participantId }) => assignedParticipantIds.includes(participantId)
|
|
28554
28565
|
);
|
|
28555
|
-
const publishedSeeding2 = eventsPublishStatuses[eventId]?.publishedSeeding;
|
|
28566
|
+
const publishedSeeding2 = eventsPublishStatuses?.[eventId]?.publishedSeeding;
|
|
28556
28567
|
const seedingPublished = !usePublishState || publishedSeeding2?.published && (publishedSeeding2?.drawIds?.length === 0 || publishedSeeding2?.drawIds?.includes(drawId));
|
|
28557
28568
|
for (const entry of relevantEntries) {
|
|
28558
28569
|
const { entryStatus, entryStage, entryPosition, participantId } = entry;
|
|
@@ -28562,7 +28573,7 @@ function getParticipantEntries(params) {
|
|
|
28562
28573
|
eventType
|
|
28563
28574
|
});
|
|
28564
28575
|
const addDrawEntry = (id) => {
|
|
28565
|
-
if (participantMap[id].draws[drawId])
|
|
28576
|
+
if (participantMap[id].draws?.[drawId])
|
|
28566
28577
|
return;
|
|
28567
28578
|
const includeSeeding = withSeeding && seedingPublished;
|
|
28568
28579
|
const seedAssignments = includeSeeding ? {} : void 0;
|
|
@@ -28894,9 +28905,9 @@ function getParticipants$1(params) {
|
|
|
28894
28905
|
withIOC
|
|
28895
28906
|
});
|
|
28896
28907
|
const entriesResult = getParticipantEntries({
|
|
28897
|
-
withMatchUps: withMatchUps
|
|
28898
|
-
withEvents: withEvents
|
|
28899
|
-
withDraws: withDraws
|
|
28908
|
+
withMatchUps: withMatchUps ?? withRankingProfile,
|
|
28909
|
+
withEvents: withEvents ?? withRankingProfile,
|
|
28910
|
+
withDraws: withDraws ?? withRankingProfile,
|
|
28900
28911
|
withPotentialMatchUps,
|
|
28901
28912
|
participantFilters,
|
|
28902
28913
|
withRankingProfile,
|
|
@@ -28922,7 +28933,7 @@ function getParticipants$1(params) {
|
|
|
28922
28933
|
} = entriesResult;
|
|
28923
28934
|
const matchUps = entriesResult.matchUps;
|
|
28924
28935
|
participantMap = entriesResult.participantMap;
|
|
28925
|
-
const nextMatchUps = scheduleAnalysis
|
|
28936
|
+
const nextMatchUps = scheduleAnalysis ?? withPotentialMatchUps;
|
|
28926
28937
|
const processedParticipants = Object.values(participantMap).map(
|
|
28927
28938
|
({
|
|
28928
28939
|
potentialMatchUps,
|