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/transform.mjs
CHANGED
|
@@ -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);
|
|
@@ -11074,9 +11072,8 @@ function modifyMatchUpScore({
|
|
|
11074
11072
|
return { error: MATCHUP_NOT_FOUND };
|
|
11075
11073
|
({ matchUp, structure } = findResult);
|
|
11076
11074
|
}
|
|
11077
|
-
} else {
|
|
11078
|
-
|
|
11079
|
-
console.log("!!!!!");
|
|
11075
|
+
} else if (matchUp.matchUpId !== matchUpId) {
|
|
11076
|
+
console.log("!!!!!");
|
|
11080
11077
|
}
|
|
11081
11078
|
if (matchUpStatus && [WALKOVER$1, DOUBLE_WALKOVER].includes(matchUpStatus) || removeScore) {
|
|
11082
11079
|
Object.assign(matchUp, { ...toBePlayed });
|
|
@@ -11114,31 +11111,45 @@ function modifyMatchUpScore({
|
|
|
11114
11111
|
})?.appliedPolicies;
|
|
11115
11112
|
defaultedProcessCodes = appliedPolicies?.[POLICY_TYPE_SCORING]?.processCodes?.incompleteAssignmentsOnDefault;
|
|
11116
11113
|
}
|
|
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
|
-
|
|
11114
|
+
if (!matchUp.collectionId) {
|
|
11115
|
+
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
11116
|
+
const isAdHocStructure = isAdHoc({ drawDefinition, structure });
|
|
11117
|
+
if (isLucky({ drawDefinition, structure }) || isAdHocStructure || isRoundRobin) {
|
|
11118
|
+
const updateTally = (structure2) => {
|
|
11119
|
+
matchUpFormat = isDualMatchUp ? "SET1-S:T100" : matchUpFormat ?? matchUp.matchUpFormat ?? structure2?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
11120
|
+
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : void 0;
|
|
11121
|
+
const { matchUps } = getAllStructureMatchUps({
|
|
11122
|
+
afterRecoveryTimes: false,
|
|
11123
|
+
inContext: true,
|
|
11124
|
+
matchUpFilters,
|
|
11125
|
+
structure: structure2,
|
|
11126
|
+
event
|
|
11127
|
+
});
|
|
11128
|
+
if (isAdHocStructure) {
|
|
11129
|
+
structure2.positionAssignments = unique(
|
|
11130
|
+
matchUps.flatMap(
|
|
11131
|
+
(matchUp2) => (matchUp2.sides ?? []).map((side) => side.participantId)
|
|
11132
|
+
).filter(Boolean)
|
|
11133
|
+
).map((participantId) => ({ participantId }));
|
|
11134
|
+
}
|
|
11135
|
+
return updateAssignmentParticipantResults({
|
|
11136
|
+
positionAssignments: structure2.positionAssignments,
|
|
11137
|
+
tournamentRecord,
|
|
11138
|
+
drawDefinition,
|
|
11139
|
+
matchUpFormat,
|
|
11140
|
+
matchUps,
|
|
11141
|
+
event
|
|
11142
|
+
});
|
|
11143
|
+
};
|
|
11144
|
+
const itemStructure = isRoundRobin && structure.structures.find((itemStructure2) => {
|
|
11145
|
+
return itemStructure2?.matchUps.find(
|
|
11146
|
+
(matchUp2) => matchUp2.matchUpId === matchUpId
|
|
11147
|
+
);
|
|
11148
|
+
});
|
|
11149
|
+
const result = updateTally(itemStructure || structure);
|
|
11150
|
+
if (result.error)
|
|
11151
|
+
return decorateResult({ result, stack });
|
|
11152
|
+
}
|
|
11142
11153
|
}
|
|
11143
11154
|
if (notes) {
|
|
11144
11155
|
const result = addNotes({ element: matchUp, notes });
|
|
@@ -13097,7 +13108,7 @@ function getValidSeedBlocks({
|
|
|
13097
13108
|
});
|
|
13098
13109
|
const { positionAssignments } = structureAssignedDrawPositions({ structure });
|
|
13099
13110
|
const positionsCount = positionAssignments?.length;
|
|
13100
|
-
const seedsCount = seedAssignments?.length
|
|
13111
|
+
const seedsCount = seedAssignments?.length ?? 0;
|
|
13101
13112
|
let allDrawPositions = [];
|
|
13102
13113
|
const roundNumbers = Object.keys(roundMatchUps).map((n) => parseInt(n)).sort((a, b) => a - b);
|
|
13103
13114
|
const uniqueDrawPositionsByRound = roundNumbers.map((roundNumber) => {
|