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/transform.mjs
CHANGED
|
@@ -1943,7 +1943,7 @@ function validMatchUp(matchUp) {
|
|
|
1943
1943
|
const { matchUpId, drawPositions } = matchUp;
|
|
1944
1944
|
const validMatchUpId = typeof matchUpId === "string";
|
|
1945
1945
|
const validDrawPositions = !drawPositions || Array.isArray(drawPositions) && drawPositions.length <= 2 && drawPositions.every(
|
|
1946
|
-
(dp) => isConvertableInteger(dp) || dp === void 0
|
|
1946
|
+
(dp) => isConvertableInteger(dp) || dp === void 0 || dp === null
|
|
1947
1947
|
);
|
|
1948
1948
|
return validMatchUpId && validDrawPositions;
|
|
1949
1949
|
}
|
|
@@ -2186,7 +2186,7 @@ function getParticipantResults({
|
|
|
2186
2186
|
const manualGamesOverride = tieFormat && matchUp._disableAutoCalc && tieFormat.collectionDefinitions.every(({ scoreValue }) => scoreValue);
|
|
2187
2187
|
const winningParticipantId = winningSide && getWinningSideId(matchUp);
|
|
2188
2188
|
const losingParticipantId = winningSide && getLosingSideId(matchUp);
|
|
2189
|
-
if (!winningParticipantId
|
|
2189
|
+
if (!winningParticipantId && !losingParticipantId) {
|
|
2190
2190
|
if (completedMatchUpStatuses.includes(matchUpStatus)) {
|
|
2191
2191
|
const participantIdSide1 = getSideId(matchUp, 0);
|
|
2192
2192
|
const participantIdSide2 = getSideId(matchUp, 1);
|
|
@@ -2198,53 +2198,51 @@ function getParticipantResults({
|
|
|
2198
2198
|
checkInitializeParticipant(participantResults, participantIdSide2);
|
|
2199
2199
|
participantResults[participantIdSide2].matchUpsCancelled += 1;
|
|
2200
2200
|
}
|
|
2201
|
-
} else {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
2229
|
-
}
|
|
2201
|
+
} else if (tieMatchUps?.length) {
|
|
2202
|
+
perPlayer = 0;
|
|
2203
|
+
for (const tieMatchUp of tieMatchUps) {
|
|
2204
|
+
if (tieMatchUp.winningSide) {
|
|
2205
|
+
const tieWinningParticipantId = sides.find(
|
|
2206
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
2207
|
+
)?.participantId;
|
|
2208
|
+
const tieLosingParticipantId = sides.find(
|
|
2209
|
+
({ sideNumber }) => sideNumber === tieMatchUp.winningSide
|
|
2210
|
+
)?.participantId;
|
|
2211
|
+
if (tieWinningParticipantId && tieLosingParticipantId) {
|
|
2212
|
+
checkInitializeParticipant(
|
|
2213
|
+
participantResults,
|
|
2214
|
+
tieWinningParticipantId
|
|
2215
|
+
);
|
|
2216
|
+
checkInitializeParticipant(
|
|
2217
|
+
participantResults,
|
|
2218
|
+
tieLosingParticipantId
|
|
2219
|
+
);
|
|
2220
|
+
participantResults[tieWinningParticipantId].tieMatchUpsWon += 1;
|
|
2221
|
+
participantResults[tieLosingParticipantId].tieMatchUpsLost += 1;
|
|
2222
|
+
if (tieMatchUp.matchUpType === SINGLES) {
|
|
2223
|
+
participantResults[tieWinningParticipantId].tieSinglesWon += 1;
|
|
2224
|
+
participantResults[tieLosingParticipantId].tieSinglesLost += 1;
|
|
2225
|
+
} else if (tieMatchUp.matchUpType === DOUBLES) {
|
|
2226
|
+
participantResults[tieWinningParticipantId].tieDoublesWon += 1;
|
|
2227
|
+
participantResults[tieLosingParticipantId].tieDoublesLost += 1;
|
|
2230
2228
|
}
|
|
2231
2229
|
}
|
|
2232
|
-
processScore({
|
|
2233
|
-
score: tieMatchUp.score,
|
|
2234
|
-
manualGamesOverride,
|
|
2235
|
-
participantResults,
|
|
2236
|
-
sides
|
|
2237
|
-
// use sides from the TEAM matchUp
|
|
2238
|
-
});
|
|
2239
2230
|
}
|
|
2240
|
-
} else {
|
|
2241
2231
|
processScore({
|
|
2232
|
+
score: tieMatchUp.score,
|
|
2242
2233
|
manualGamesOverride,
|
|
2243
2234
|
participantResults,
|
|
2244
|
-
score,
|
|
2245
2235
|
sides
|
|
2236
|
+
// use sides from the TEAM matchUp
|
|
2246
2237
|
});
|
|
2247
2238
|
}
|
|
2239
|
+
} else {
|
|
2240
|
+
processScore({
|
|
2241
|
+
manualGamesOverride,
|
|
2242
|
+
participantResults,
|
|
2243
|
+
score,
|
|
2244
|
+
sides
|
|
2245
|
+
});
|
|
2248
2246
|
}
|
|
2249
2247
|
} else {
|
|
2250
2248
|
checkInitializeParticipant(participantResults, winningParticipantId);
|
|
@@ -5005,9 +5003,10 @@ function getSourceDrawPositionRanges({
|
|
|
5005
5003
|
structureId: sourceStructureId,
|
|
5006
5004
|
matchUpsMap
|
|
5007
5005
|
});
|
|
5008
|
-
const
|
|
5006
|
+
const roundMatchUpsResult = getRoundMatchUps({
|
|
5009
5007
|
matchUps: structureMatchUps2
|
|
5010
5008
|
});
|
|
5009
|
+
const roundProfile = roundMatchUpsResult.roundProfile;
|
|
5011
5010
|
return { [sourceStructureId]: roundProfile };
|
|
5012
5011
|
})
|
|
5013
5012
|
);
|
|
@@ -11074,9 +11073,8 @@ function modifyMatchUpScore({
|
|
|
11074
11073
|
return { error: MATCHUP_NOT_FOUND };
|
|
11075
11074
|
({ matchUp, structure } = findResult);
|
|
11076
11075
|
}
|
|
11077
|
-
} else {
|
|
11078
|
-
|
|
11079
|
-
console.log("!!!!!");
|
|
11076
|
+
} else if (matchUp.matchUpId !== matchUpId) {
|
|
11077
|
+
console.log("!!!!!");
|
|
11080
11078
|
}
|
|
11081
11079
|
if (matchUpStatus && [WALKOVER$1, DOUBLE_WALKOVER].includes(matchUpStatus) || removeScore) {
|
|
11082
11080
|
Object.assign(matchUp, { ...toBePlayed });
|
|
@@ -11114,31 +11112,45 @@ function modifyMatchUpScore({
|
|
|
11114
11112
|
})?.appliedPolicies;
|
|
11115
11113
|
defaultedProcessCodes = appliedPolicies?.[POLICY_TYPE_SCORING]?.processCodes?.incompleteAssignmentsOnDefault;
|
|
11116
11114
|
}
|
|
11117
|
-
if (
|
|
11118
|
-
|
|
11119
|
-
const
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11115
|
+
if (!matchUp.collectionId) {
|
|
11116
|
+
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
11117
|
+
const isAdHocStructure = isAdHoc({ drawDefinition, structure });
|
|
11118
|
+
if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
|
|
11119
|
+
const updateTally = (structure2) => {
|
|
11120
|
+
matchUpFormat = isDualMatchUp ? "SET1-S:T100" : matchUpFormat ?? matchUp.matchUpFormat ?? structure2?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
11121
|
+
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : void 0;
|
|
11122
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
11123
|
+
afterRecoveryTimes: false,
|
|
11124
|
+
inContext: true,
|
|
11125
|
+
matchUpFilters,
|
|
11126
|
+
structure: structure2,
|
|
11127
|
+
event
|
|
11128
|
+
});
|
|
11129
|
+
if (isAdHocStructure) {
|
|
11130
|
+
structure2.positionAssignments = unique(
|
|
11131
|
+
matchUps.flatMap(
|
|
11132
|
+
(matchUp2) => (matchUp2.sides ?? []).map((side) => side.participantId)
|
|
11133
|
+
).filter(Boolean)
|
|
11134
|
+
).map((participantId) => ({ participantId }));
|
|
11135
|
+
}
|
|
11136
|
+
return updateAssignmentParticipantResults({
|
|
11137
|
+
positionAssignments: structure2.positionAssignments,
|
|
11138
|
+
tournamentRecord,
|
|
11139
|
+
drawDefinition,
|
|
11140
|
+
matchUpFormat,
|
|
11141
|
+
matchUps,
|
|
11142
|
+
event
|
|
11143
|
+
});
|
|
11144
|
+
};
|
|
11145
|
+
const itemStructure = isRoundRobin && structure.structures.find((itemStructure2) => {
|
|
11146
|
+
return itemStructure2?.matchUps.find(
|
|
11147
|
+
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
11148
|
+
);
|
|
11149
|
+
});
|
|
11150
|
+
const result = updateTally(itemStructure || structure);
|
|
11151
|
+
if (result.error)
|
|
11152
|
+
return decorateResult({ result, stack });
|
|
11153
|
+
}
|
|
11142
11154
|
}
|
|
11143
11155
|
if (notes) {
|
|
11144
11156
|
const result = addNotes({ element: matchUp, notes });
|
|
@@ -13097,7 +13109,7 @@ function getValidSeedBlocks({
|
|
|
13097
13109
|
});
|
|
13098
13110
|
const { positionAssignments } = structureAssignedDrawPositions({ structure });
|
|
13099
13111
|
const positionsCount = positionAssignments?.length;
|
|
13100
|
-
const seedsCount = seedAssignments?.length
|
|
13112
|
+
const seedsCount = seedAssignments?.length ?? 0;
|
|
13101
13113
|
let allDrawPositions = [];
|
|
13102
13114
|
const roundNumbers = Object.keys(roundMatchUps).map((n) => parseInt(n)).sort((a, b) => a - b);
|
|
13103
13115
|
const uniqueDrawPositionsByRound = roundNumbers.map((roundNumber) => {
|