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/forge/generate.mjs
CHANGED
|
@@ -5307,7 +5307,7 @@ function getValidSeedBlocks({
|
|
|
5307
5307
|
});
|
|
5308
5308
|
const { positionAssignments } = structureAssignedDrawPositions({ structure });
|
|
5309
5309
|
const positionsCount = positionAssignments?.length;
|
|
5310
|
-
const seedsCount = seedAssignments?.length
|
|
5310
|
+
const seedsCount = seedAssignments?.length ?? 0;
|
|
5311
5311
|
let allDrawPositions = [];
|
|
5312
5312
|
const roundNumbers = Object.keys(roundMatchUps).map((n) => parseInt(n)).sort((a, b) => a - b);
|
|
5313
5313
|
const uniqueDrawPositionsByRound = roundNumbers.map((roundNumber) => {
|
|
@@ -5569,7 +5569,7 @@ function getNextSeedBlock(params) {
|
|
|
5569
5569
|
const seedsWithoutDrawPositions = seedAssignments?.filter(
|
|
5570
5570
|
(assignment) => !assignment.participantId
|
|
5571
5571
|
);
|
|
5572
|
-
const seedsLeftToAssign = unplacedSeedAssignments?.length
|
|
5572
|
+
const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0 ? unplacedSeedAssignments.length : seedsWithoutDrawPositions?.length ?? 0;
|
|
5573
5573
|
const unfilled = seedsLeftToAssign && nextSeedBlock?.drawPositions.filter(
|
|
5574
5574
|
(drawPosition) => !assignedDrawPositions?.includes(drawPosition)
|
|
5575
5575
|
) || [];
|
|
@@ -14919,7 +14919,7 @@ function getParticipantResults({
|
|
|
14919
14919
|
const manualGamesOverride = tieFormat && matchUp._disableAutoCalc && tieFormat.collectionDefinitions.every(({ scoreValue }) => scoreValue);
|
|
14920
14920
|
const winningParticipantId = winningSide && getWinningSideId(matchUp);
|
|
14921
14921
|
const losingParticipantId = winningSide && getLosingSideId(matchUp);
|
|
14922
|
-
if (!winningParticipantId
|
|
14922
|
+
if (!winningParticipantId && !losingParticipantId) {
|
|
14923
14923
|
if (completedMatchUpStatuses.includes(matchUpStatus)) {
|
|
14924
14924
|
const participantIdSide1 = getSideId(matchUp, 0);
|
|
14925
14925
|
const participantIdSide2 = getSideId(matchUp, 1);
|
|
@@ -14931,53 +14931,51 @@ function getParticipantResults({
|
|
|
14931
14931
|
checkInitializeParticipant(participantResults, participantIdSide2);
|
|
14932
14932
|
participantResults[participantIdSide2].matchUpsCancelled += 1;
|
|
14933
14933
|
}
|
|
14934
|
-
} else {
|
|
14935
|
-
|
|
14936
|
-
|
|
14937
|
-
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
-
|
|
14952
|
-
|
|
14953
|
-
|
|
14954
|
-
|
|
14955
|
-
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
|
|
14961
|
-
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
14962
|
-
}
|
|
14934
|
+
} else if (tieMatchUps?.length) {
|
|
14935
|
+
perPlayer = 0;
|
|
14936
|
+
for (const tieMatchUp of tieMatchUps) {
|
|
14937
|
+
if (tieMatchUp.winningSide) {
|
|
14938
|
+
const tieWinningParticipantId = sides.find(
|
|
14939
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
14940
|
+
)?.participantId;
|
|
14941
|
+
const tieLosingParticipantId = sides.find(
|
|
14942
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
14943
|
+
)?.participantId;
|
|
14944
|
+
if (tieWinningParticipantId && tieLosingParticipantId) {
|
|
14945
|
+
checkInitializeParticipant(
|
|
14946
|
+
participantResults,
|
|
14947
|
+
tieWinningParticipantId
|
|
14948
|
+
);
|
|
14949
|
+
checkInitializeParticipant(
|
|
14950
|
+
participantResults,
|
|
14951
|
+
tieLosingParticipantId
|
|
14952
|
+
);
|
|
14953
|
+
participantResults[tieWinningParticipantId].tieMatchUpsWon += 1;
|
|
14954
|
+
participantResults[tieLosingParticipantId].tieMatchUpsLost += 1;
|
|
14955
|
+
if (tieMatchUp.matchUpType === SINGLES$1) {
|
|
14956
|
+
participantResults[tieWinningParticipantId].tieSinglesWon += 1;
|
|
14957
|
+
participantResults[tieLosingParticipantId].tieSinglesLost += 1;
|
|
14958
|
+
} else if (tieMatchUp.matchUpType === DOUBLES$1) {
|
|
14959
|
+
participantResults[tieWinningParticipantId].tieDoublesWon += 1;
|
|
14960
|
+
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
14963
14961
|
}
|
|
14964
14962
|
}
|
|
14965
|
-
processScore({
|
|
14966
|
-
score: tieMatchUp.score,
|
|
14967
|
-
manualGamesOverride,
|
|
14968
|
-
participantResults,
|
|
14969
|
-
sides
|
|
14970
|
-
// use sides from the TEAM matchUp
|
|
14971
|
-
});
|
|
14972
14963
|
}
|
|
14973
|
-
} else {
|
|
14974
14964
|
processScore({
|
|
14965
|
+
score: tieMatchUp.score,
|
|
14975
14966
|
manualGamesOverride,
|
|
14976
14967
|
participantResults,
|
|
14977
|
-
score,
|
|
14978
14968
|
sides
|
|
14969
|
+
// use sides from the TEAM matchUp
|
|
14979
14970
|
});
|
|
14980
14971
|
}
|
|
14972
|
+
} else {
|
|
14973
|
+
processScore({
|
|
14974
|
+
manualGamesOverride,
|
|
14975
|
+
participantResults,
|
|
14976
|
+
score,
|
|
14977
|
+
sides
|
|
14978
|
+
});
|
|
14981
14979
|
}
|
|
14982
14980
|
} else {
|
|
14983
14981
|
checkInitializeParticipant(participantResults, winningParticipantId);
|
|
@@ -15827,9 +15825,8 @@ function modifyMatchUpScore({
|
|
|
15827
15825
|
return { error: MATCHUP_NOT_FOUND };
|
|
15828
15826
|
({ matchUp, structure } = findResult);
|
|
15829
15827
|
}
|
|
15830
|
-
} else {
|
|
15831
|
-
|
|
15832
|
-
console.log("!!!!!");
|
|
15828
|
+
} else if (matchUp.matchUpId !== matchUpId) {
|
|
15829
|
+
console.log("!!!!!");
|
|
15833
15830
|
}
|
|
15834
15831
|
if (matchUpStatus && [WALKOVER$1, DOUBLE_WALKOVER].includes(matchUpStatus) || removeScore) {
|
|
15835
15832
|
Object.assign(matchUp, { ...toBePlayed });
|
|
@@ -15867,31 +15864,45 @@ function modifyMatchUpScore({
|
|
|
15867
15864
|
})?.appliedPolicies;
|
|
15868
15865
|
defaultedProcessCodes = appliedPolicies?.[POLICY_TYPE_SCORING]?.processCodes?.incompleteAssignmentsOnDefault;
|
|
15869
15866
|
}
|
|
15870
|
-
if (
|
|
15871
|
-
|
|
15872
|
-
const
|
|
15873
|
-
|
|
15874
|
-
|
|
15875
|
-
|
|
15876
|
-
|
|
15877
|
-
|
|
15878
|
-
|
|
15879
|
-
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15867
|
+
if (!matchUp.collectionId) {
|
|
15868
|
+
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
15869
|
+
const isAdHocStructure = isAdHoc({ drawDefinition, structure });
|
|
15870
|
+
if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
|
|
15871
|
+
const updateTally = (structure2) => {
|
|
15872
|
+
matchUpFormat = isDualMatchUp ? "SET1-S:T100" : matchUpFormat ?? matchUp.matchUpFormat ?? structure2?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
15873
|
+
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : void 0;
|
|
15874
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
15875
|
+
afterRecoveryTimes: false,
|
|
15876
|
+
inContext: true,
|
|
15877
|
+
matchUpFilters,
|
|
15878
|
+
structure: structure2,
|
|
15879
|
+
event
|
|
15880
|
+
});
|
|
15881
|
+
if (isAdHocStructure) {
|
|
15882
|
+
structure2.positionAssignments = unique(
|
|
15883
|
+
matchUps.flatMap(
|
|
15884
|
+
(matchUp2) => (matchUp2.sides ?? []).map((side) => side.participantId)
|
|
15885
|
+
).filter(Boolean)
|
|
15886
|
+
).map((participantId) => ({ participantId }));
|
|
15887
|
+
}
|
|
15888
|
+
return updateAssignmentParticipantResults({
|
|
15889
|
+
positionAssignments: structure2.positionAssignments,
|
|
15890
|
+
tournamentRecord,
|
|
15891
|
+
drawDefinition,
|
|
15892
|
+
matchUpFormat,
|
|
15893
|
+
matchUps,
|
|
15894
|
+
event
|
|
15895
|
+
});
|
|
15896
|
+
};
|
|
15897
|
+
const itemStructure = isRoundRobin && structure.structures.find((itemStructure2) => {
|
|
15898
|
+
return itemStructure2?.matchUps.find(
|
|
15899
|
+
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
15900
|
+
);
|
|
15901
|
+
});
|
|
15902
|
+
const result = updateTally(itemStructure || structure);
|
|
15903
|
+
if (result.error)
|
|
15904
|
+
return decorateResult({ result, stack });
|
|
15905
|
+
}
|
|
15895
15906
|
}
|
|
15896
15907
|
if (notes) {
|
|
15897
15908
|
const result = addNotes({ element: matchUp, notes });
|