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