tods-competition-factory 1.6.10 → 1.6.11
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 +145 -136
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +5 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +5 -2
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +32 -24
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +53 -50
- 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 +3 -3
package/dist/forge/generate.mjs
CHANGED
|
@@ -3185,7 +3185,7 @@ function structureSort(a, b, config) {
|
|
|
3185
3185
|
const completedStructure = (s) => s?.matchUps.every(
|
|
3186
3186
|
({ matchUpStatus }) => completedMatchUpStatuses.includes(matchUpStatus) ? 1 : -1
|
|
3187
3187
|
);
|
|
3188
|
-
return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length
|
|
3188
|
+
return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length ?? Infinity) - (a?.positionAssignments?.length ?? Infinity) || (a?.stageSequence ?? 0) - (b?.stageSequence ?? 0) || (getMinFinishingPositionRange(a) || 0) - (getMinFinishingPositionRange(b) || 0);
|
|
3189
3189
|
}
|
|
3190
3190
|
function getMinFinishingPositionRange(structure) {
|
|
3191
3191
|
return (structure?.matchUps || []).reduce((rangeSum, matchUp) => {
|
|
@@ -3327,6 +3327,7 @@ function getStageEntryTypeCount({ stage, drawDefinition, entryStatus }) {
|
|
|
3327
3327
|
}
|
|
3328
3328
|
function getStageEntries({
|
|
3329
3329
|
provisionalPositioning,
|
|
3330
|
+
placementGroup,
|
|
3330
3331
|
drawDefinition,
|
|
3331
3332
|
stageSequence,
|
|
3332
3333
|
entryStatuses,
|
|
@@ -3356,7 +3357,9 @@ function getStageEntries({
|
|
|
3356
3357
|
if (error) {
|
|
3357
3358
|
console.log("playoff entries error");
|
|
3358
3359
|
}
|
|
3359
|
-
return playoffEntries?.length ? playoffEntries : entries
|
|
3360
|
+
return (playoffEntries?.length ? playoffEntries : entries).filter(
|
|
3361
|
+
(entry) => !placementGroup || entry.placementGroup === placementGroup
|
|
3362
|
+
);
|
|
3360
3363
|
}
|
|
3361
3364
|
return entries;
|
|
3362
3365
|
}
|
|
@@ -12805,6 +12808,7 @@ function automatedPositioning$1({
|
|
|
12805
12808
|
placeByes = true,
|
|
12806
12809
|
tournamentRecord,
|
|
12807
12810
|
appliedPolicies,
|
|
12811
|
+
placementGroup,
|
|
12808
12812
|
drawDefinition,
|
|
12809
12813
|
seedingProfile,
|
|
12810
12814
|
participants,
|
|
@@ -12856,6 +12860,7 @@ function automatedPositioning$1({
|
|
|
12856
12860
|
stageSequence: structure.stageSequence,
|
|
12857
12861
|
provisionalPositioning,
|
|
12858
12862
|
stage: structure.stage,
|
|
12863
|
+
placementGroup,
|
|
12859
12864
|
drawDefinition,
|
|
12860
12865
|
entryStatuses,
|
|
12861
12866
|
structureId
|
|
@@ -13103,10 +13108,12 @@ function automatedPlayoffPositioning(params) {
|
|
|
13103
13108
|
if (!structureIsComplete && !provisionalPositioning) {
|
|
13104
13109
|
return { error: INCOMPLETE_SOURCE_STRUCTURE };
|
|
13105
13110
|
}
|
|
13106
|
-
const
|
|
13111
|
+
const playoffStructures = getPlayoffStructures({
|
|
13107
13112
|
drawDefinition,
|
|
13108
13113
|
structureId
|
|
13109
|
-
})
|
|
13114
|
+
}).playoffStructures?.sort(
|
|
13115
|
+
(a, b) => getMinFinishingPositionRange(a) - getMinFinishingPositionRange(b)
|
|
13116
|
+
);
|
|
13110
13117
|
const structurePositionAssignments = [];
|
|
13111
13118
|
const participants = tournamentRecord?.participants;
|
|
13112
13119
|
if (playoffStructures) {
|
|
@@ -14337,10 +14344,10 @@ function processPlayoffGroups({
|
|
|
14337
14344
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
14338
14345
|
}
|
|
14339
14346
|
const params = {
|
|
14347
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
14340
14348
|
structureName: playoffGroup.structureName,
|
|
14341
14349
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
14342
14350
|
appliedPolicies: policyDefinitions,
|
|
14343
|
-
structureId: uuids?.pop(),
|
|
14344
14351
|
finishingPositionOffset,
|
|
14345
14352
|
stage: PLAY_OFF,
|
|
14346
14353
|
stageSequence,
|
|
@@ -14376,9 +14383,9 @@ function processPlayoffGroups({
|
|
|
14376
14383
|
uuids
|
|
14377
14384
|
});
|
|
14378
14385
|
const playoffStructure = structureTemplate({
|
|
14386
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
14379
14387
|
structureName: playoffGroup.structureName,
|
|
14380
14388
|
matchUpFormat: playoffMatchUpFormat,
|
|
14381
|
-
structureId: uuids?.pop(),
|
|
14382
14389
|
stage: PLAY_OFF,
|
|
14383
14390
|
stageSequence,
|
|
14384
14391
|
matchUps
|
|
@@ -14398,6 +14405,7 @@ function processPlayoffGroups({
|
|
|
14398
14405
|
} else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
14399
14406
|
const { structureName } = playoffGroup;
|
|
14400
14407
|
const params2 = {
|
|
14408
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
14401
14409
|
playoffStructureNameBase: structureName,
|
|
14402
14410
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
14403
14411
|
addNameBaseToAttributeName: true,
|
|
@@ -14451,6 +14459,7 @@ function processPlayoffGroups({
|
|
|
14451
14459
|
].includes(playoffDrawType)) {
|
|
14452
14460
|
const uuidsFMLC = [uuids?.pop(), uuids?.pop()];
|
|
14453
14461
|
const params2 = {
|
|
14462
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
14454
14463
|
structureName: playoffGroup.structureName,
|
|
14455
14464
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
14456
14465
|
finishingPositionOffset,
|
|
@@ -14498,9 +14507,9 @@ function processPlayoffGroups({
|
|
|
14498
14507
|
updateStructureAndLinks({ playoffStructures, playoffLinks });
|
|
14499
14508
|
} else if ([AD_HOC].includes(playoffDrawType)) {
|
|
14500
14509
|
const structure = structureTemplate({
|
|
14510
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
14501
14511
|
structureName: playoffGroup.structureName,
|
|
14502
14512
|
finishingPosition: WIN_RATIO$1,
|
|
14503
|
-
structureId: uuids?.pop(),
|
|
14504
14513
|
stage: PLAY_OFF,
|
|
14505
14514
|
stageSequence,
|
|
14506
14515
|
matchUps: []
|
|
@@ -14682,6 +14691,7 @@ function addNotes(params) {
|
|
|
14682
14691
|
}
|
|
14683
14692
|
|
|
14684
14693
|
const FORMAT_STANDARD = "SET3-S:6/TB7";
|
|
14694
|
+
const FORMAT_ATP_DOUBLES = "SET3-S:6/TB7-F:TB10";
|
|
14685
14695
|
|
|
14686
14696
|
function countSets({
|
|
14687
14697
|
winningSide: matchUpWinningSide,
|
|
@@ -17202,9 +17212,9 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
17202
17212
|
structureId: sourceStructureId,
|
|
17203
17213
|
addNameBaseToAttributeName,
|
|
17204
17214
|
playoffStructureNameBase,
|
|
17205
|
-
tournamentRecord,
|
|
17206
17215
|
playoffAttributes,
|
|
17207
17216
|
playoffPositions,
|
|
17217
|
+
tournamentRecord,
|
|
17208
17218
|
exitProfileLimit,
|
|
17209
17219
|
roundProfiles,
|
|
17210
17220
|
roundNumbers,
|
|
@@ -17279,7 +17289,7 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
17279
17289
|
const roundsRanges = validRoundNumbers ? availablePlayoffRoundsRanges : playoffRoundsRanges;
|
|
17280
17290
|
const newStructures = [];
|
|
17281
17291
|
const newLinks = [];
|
|
17282
|
-
for (const roundNumber of sourceRounds
|
|
17292
|
+
for (const roundNumber of sourceRounds ?? []) {
|
|
17283
17293
|
const roundInfo = roundsRanges?.find(
|
|
17284
17294
|
(roundInfo2) => roundInfo2.roundNumber === roundNumber
|
|
17285
17295
|
);
|
|
@@ -20275,6 +20285,124 @@ function addDrawDefinition(params) {
|
|
|
20275
20285
|
return { ...SUCCESS, modifiedEventEntryStatusCount };
|
|
20276
20286
|
}
|
|
20277
20287
|
|
|
20288
|
+
function generateAdHocMatchUps({
|
|
20289
|
+
participantIdPairings,
|
|
20290
|
+
addToStructure = true,
|
|
20291
|
+
tournamentRecord,
|
|
20292
|
+
matchUpIds = [],
|
|
20293
|
+
drawDefinition,
|
|
20294
|
+
matchUpsCount,
|
|
20295
|
+
roundNumber,
|
|
20296
|
+
structureId,
|
|
20297
|
+
newRound
|
|
20298
|
+
}) {
|
|
20299
|
+
if (typeof drawDefinition !== "object")
|
|
20300
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
20301
|
+
if (!structureId && drawDefinition.structures?.length === 1)
|
|
20302
|
+
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
20303
|
+
if (typeof structureId !== "string")
|
|
20304
|
+
return { error: MISSING_STRUCTURE_ID };
|
|
20305
|
+
if (participantIdPairings && !Array.isArray(participantIdPairings) || matchUpsCount && !isConvertableInteger(matchUpsCount) || matchUpIds && !Array.isArray(matchUpIds) || !participantIdPairings && !matchUpsCount) {
|
|
20306
|
+
return { error: INVALID_VALUES, info: "matchUpsCount or pairings error" };
|
|
20307
|
+
}
|
|
20308
|
+
const structure = drawDefinition?.structures?.find(
|
|
20309
|
+
(structure2) => structure2.structureId === structureId
|
|
20310
|
+
);
|
|
20311
|
+
let structureHasRoundPositions;
|
|
20312
|
+
const existingMatchUps = structure?.matchUps;
|
|
20313
|
+
const lastRoundNumber = existingMatchUps?.reduce(
|
|
20314
|
+
(roundNumber2, matchUp) => {
|
|
20315
|
+
if (matchUp.roundPosition)
|
|
20316
|
+
structureHasRoundPositions = true;
|
|
20317
|
+
return (matchUp?.roundNumber || 0) > roundNumber2 ? matchUp.roundNumber : roundNumber2;
|
|
20318
|
+
},
|
|
20319
|
+
0
|
|
20320
|
+
);
|
|
20321
|
+
if (structure?.structures || structureHasRoundPositions || structure?.finishingPosition === ROUND_OUTCOME) {
|
|
20322
|
+
return { error: INVALID_STRUCTURE };
|
|
20323
|
+
}
|
|
20324
|
+
if (roundNumber && roundNumber - 1 > (lastRoundNumber || 0))
|
|
20325
|
+
return { error: INVALID_VALUES, info: "roundNumber error" };
|
|
20326
|
+
const nextRoundNumber = roundNumber ?? (newRound ? (lastRoundNumber ?? 0) + 1 : lastRoundNumber ?? 1);
|
|
20327
|
+
participantIdPairings = participantIdPairings ?? generateRange(0, matchUpsCount).map(() => ({
|
|
20328
|
+
participantIds: [void 0, void 0]
|
|
20329
|
+
}));
|
|
20330
|
+
const matchUps = participantIdPairings?.map((pairing) => {
|
|
20331
|
+
const idStack = pairing?.participantIds ?? [void 0, void 0];
|
|
20332
|
+
idStack.push(...[void 0, void 0]);
|
|
20333
|
+
const participantIds = idStack.slice(0, 2);
|
|
20334
|
+
const sides = participantIds.map(
|
|
20335
|
+
(participantId, i) => definedAttributes({
|
|
20336
|
+
sideNumber: i + 1,
|
|
20337
|
+
participantId
|
|
20338
|
+
})
|
|
20339
|
+
);
|
|
20340
|
+
return {
|
|
20341
|
+
matchUpStatus: MatchUpStatusEnum.ToBePlayed,
|
|
20342
|
+
matchUpId: matchUpIds.pop() ?? UUID(),
|
|
20343
|
+
roundNumber: nextRoundNumber,
|
|
20344
|
+
sides
|
|
20345
|
+
};
|
|
20346
|
+
});
|
|
20347
|
+
if (addToStructure) {
|
|
20348
|
+
const result = addAdHocMatchUps({
|
|
20349
|
+
tournamentRecord,
|
|
20350
|
+
drawDefinition,
|
|
20351
|
+
structureId,
|
|
20352
|
+
matchUps
|
|
20353
|
+
});
|
|
20354
|
+
if (result.error)
|
|
20355
|
+
return result;
|
|
20356
|
+
}
|
|
20357
|
+
return { matchUpsCount: matchUps.length, matchUps, ...SUCCESS };
|
|
20358
|
+
}
|
|
20359
|
+
function addAdHocMatchUps({
|
|
20360
|
+
tournamentRecord,
|
|
20361
|
+
drawDefinition,
|
|
20362
|
+
structureId,
|
|
20363
|
+
matchUps
|
|
20364
|
+
}) {
|
|
20365
|
+
if (typeof drawDefinition !== "object")
|
|
20366
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
20367
|
+
if (!structureId && drawDefinition.structures?.length === 1)
|
|
20368
|
+
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
20369
|
+
if (typeof structureId !== "string")
|
|
20370
|
+
return { error: MISSING_STRUCTURE_ID };
|
|
20371
|
+
if (!validMatchUps(matchUps))
|
|
20372
|
+
return { error: INVALID_VALUES, info: mustBeAnArray("matchUps") };
|
|
20373
|
+
const structure = drawDefinition.structures?.find(
|
|
20374
|
+
(structure2) => structure2.structureId === structureId
|
|
20375
|
+
);
|
|
20376
|
+
if (!structure)
|
|
20377
|
+
return { error: STRUCTURE_NOT_FOUND };
|
|
20378
|
+
const existingMatchUps = structure?.matchUps;
|
|
20379
|
+
const structureHasRoundPositions = existingMatchUps.find(
|
|
20380
|
+
(matchUp) => !!matchUp.roundPosition
|
|
20381
|
+
);
|
|
20382
|
+
if (structure.structures || structureHasRoundPositions || structure.finishingPosition === ROUND_OUTCOME) {
|
|
20383
|
+
return { error: INVALID_STRUCTURE };
|
|
20384
|
+
}
|
|
20385
|
+
const existingMatchUpIds = allTournamentMatchUps({
|
|
20386
|
+
tournamentRecord,
|
|
20387
|
+
inContext: false
|
|
20388
|
+
})?.matchUps?.map(getMatchUpId) ?? [];
|
|
20389
|
+
const newMatchUpIds = matchUps.map(getMatchUpId);
|
|
20390
|
+
if (overlap(existingMatchUpIds, newMatchUpIds)) {
|
|
20391
|
+
return {
|
|
20392
|
+
error: EXISTING_MATCHUP_ID,
|
|
20393
|
+
info: "One or more matchUpIds already present in tournamentRecord"
|
|
20394
|
+
};
|
|
20395
|
+
}
|
|
20396
|
+
structure.matchUps.push(...matchUps);
|
|
20397
|
+
addMatchUpsNotice({
|
|
20398
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
20399
|
+
drawDefinition,
|
|
20400
|
+
matchUps
|
|
20401
|
+
});
|
|
20402
|
+
modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
|
|
20403
|
+
return { ...SUCCESS };
|
|
20404
|
+
}
|
|
20405
|
+
|
|
20278
20406
|
function attachPolicies({ drawDefinition, policyDefinitions }) {
|
|
20279
20407
|
if (!drawDefinition) {
|
|
20280
20408
|
return { error: MISSING_DRAW_DEFINITION };
|
|
@@ -20588,124 +20716,6 @@ function pairingHash(id1, id2) {
|
|
|
20588
20716
|
return [id1, id2].sort().join("|");
|
|
20589
20717
|
}
|
|
20590
20718
|
|
|
20591
|
-
function generateAdHocMatchUps({
|
|
20592
|
-
participantIdPairings,
|
|
20593
|
-
addToStructure = true,
|
|
20594
|
-
tournamentRecord,
|
|
20595
|
-
matchUpIds = [],
|
|
20596
|
-
drawDefinition,
|
|
20597
|
-
matchUpsCount,
|
|
20598
|
-
roundNumber,
|
|
20599
|
-
structureId,
|
|
20600
|
-
newRound
|
|
20601
|
-
}) {
|
|
20602
|
-
if (typeof drawDefinition !== "object")
|
|
20603
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
20604
|
-
if (!structureId && drawDefinition.structures?.length === 1)
|
|
20605
|
-
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
20606
|
-
if (typeof structureId !== "string")
|
|
20607
|
-
return { error: MISSING_STRUCTURE_ID };
|
|
20608
|
-
if (participantIdPairings && !Array.isArray(participantIdPairings) || matchUpsCount && !isConvertableInteger(matchUpsCount) || matchUpIds && !Array.isArray(matchUpIds) || !participantIdPairings && !matchUpsCount) {
|
|
20609
|
-
return { error: INVALID_VALUES, info: "matchUpsCount or pairings error" };
|
|
20610
|
-
}
|
|
20611
|
-
const structure = drawDefinition?.structures?.find(
|
|
20612
|
-
(structure2) => structure2.structureId === structureId
|
|
20613
|
-
);
|
|
20614
|
-
let structureHasRoundPositions;
|
|
20615
|
-
const existingMatchUps = structure?.matchUps;
|
|
20616
|
-
const lastRoundNumber = existingMatchUps?.reduce(
|
|
20617
|
-
(roundNumber2, matchUp) => {
|
|
20618
|
-
if (matchUp.roundPosition)
|
|
20619
|
-
structureHasRoundPositions = true;
|
|
20620
|
-
return (matchUp?.roundNumber || 0) > roundNumber2 ? matchUp.roundNumber : roundNumber2;
|
|
20621
|
-
},
|
|
20622
|
-
0
|
|
20623
|
-
);
|
|
20624
|
-
if (structure?.structures || structureHasRoundPositions || structure?.finishingPosition === ROUND_OUTCOME) {
|
|
20625
|
-
return { error: INVALID_STRUCTURE };
|
|
20626
|
-
}
|
|
20627
|
-
if (roundNumber && roundNumber - 1 > (lastRoundNumber || 0))
|
|
20628
|
-
return { error: INVALID_VALUES, info: "roundNumber error" };
|
|
20629
|
-
const nextRoundNumber = roundNumber ?? (newRound ? (lastRoundNumber ?? 0) + 1 : lastRoundNumber ?? 1);
|
|
20630
|
-
participantIdPairings = participantIdPairings ?? generateRange(0, matchUpsCount).map(() => ({
|
|
20631
|
-
participantIds: [void 0, void 0]
|
|
20632
|
-
}));
|
|
20633
|
-
const matchUps = participantIdPairings?.map((pairing) => {
|
|
20634
|
-
const idStack = pairing?.participantIds ?? [void 0, void 0];
|
|
20635
|
-
idStack.push(...[void 0, void 0]);
|
|
20636
|
-
const participantIds = idStack.slice(0, 2);
|
|
20637
|
-
const sides = participantIds.map(
|
|
20638
|
-
(participantId, i) => definedAttributes({
|
|
20639
|
-
sideNumber: i + 1,
|
|
20640
|
-
participantId
|
|
20641
|
-
})
|
|
20642
|
-
);
|
|
20643
|
-
return {
|
|
20644
|
-
matchUpStatus: MatchUpStatusEnum.ToBePlayed,
|
|
20645
|
-
matchUpId: matchUpIds.pop() ?? UUID(),
|
|
20646
|
-
roundNumber: nextRoundNumber,
|
|
20647
|
-
sides
|
|
20648
|
-
};
|
|
20649
|
-
});
|
|
20650
|
-
if (addToStructure) {
|
|
20651
|
-
const result = addAdHocMatchUps({
|
|
20652
|
-
tournamentRecord,
|
|
20653
|
-
drawDefinition,
|
|
20654
|
-
structureId,
|
|
20655
|
-
matchUps
|
|
20656
|
-
});
|
|
20657
|
-
if (result.error)
|
|
20658
|
-
return result;
|
|
20659
|
-
}
|
|
20660
|
-
return { matchUpsCount: matchUps.length, matchUps, ...SUCCESS };
|
|
20661
|
-
}
|
|
20662
|
-
function addAdHocMatchUps({
|
|
20663
|
-
tournamentRecord,
|
|
20664
|
-
drawDefinition,
|
|
20665
|
-
structureId,
|
|
20666
|
-
matchUps
|
|
20667
|
-
}) {
|
|
20668
|
-
if (typeof drawDefinition !== "object")
|
|
20669
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
20670
|
-
if (!structureId && drawDefinition.structures?.length === 1)
|
|
20671
|
-
structureId = drawDefinition.structures?.[0]?.structureId;
|
|
20672
|
-
if (typeof structureId !== "string")
|
|
20673
|
-
return { error: MISSING_STRUCTURE_ID };
|
|
20674
|
-
if (!validMatchUps(matchUps))
|
|
20675
|
-
return { error: INVALID_VALUES, info: mustBeAnArray("matchUps") };
|
|
20676
|
-
const structure = drawDefinition.structures?.find(
|
|
20677
|
-
(structure2) => structure2.structureId === structureId
|
|
20678
|
-
);
|
|
20679
|
-
if (!structure)
|
|
20680
|
-
return { error: STRUCTURE_NOT_FOUND };
|
|
20681
|
-
const existingMatchUps = structure?.matchUps;
|
|
20682
|
-
const structureHasRoundPositions = existingMatchUps.find(
|
|
20683
|
-
(matchUp) => !!matchUp.roundPosition
|
|
20684
|
-
);
|
|
20685
|
-
if (structure.structures || structureHasRoundPositions || structure.finishingPosition === ROUND_OUTCOME) {
|
|
20686
|
-
return { error: INVALID_STRUCTURE };
|
|
20687
|
-
}
|
|
20688
|
-
const existingMatchUpIds = allTournamentMatchUps({
|
|
20689
|
-
tournamentRecord,
|
|
20690
|
-
inContext: false
|
|
20691
|
-
})?.matchUps?.map(getMatchUpId) ?? [];
|
|
20692
|
-
const newMatchUpIds = matchUps.map(getMatchUpId);
|
|
20693
|
-
if (overlap(existingMatchUpIds, newMatchUpIds)) {
|
|
20694
|
-
return {
|
|
20695
|
-
error: EXISTING_MATCHUP_ID,
|
|
20696
|
-
info: "One or more matchUpIds already present in tournamentRecord"
|
|
20697
|
-
};
|
|
20698
|
-
}
|
|
20699
|
-
structure.matchUps.push(...matchUps);
|
|
20700
|
-
addMatchUpsNotice({
|
|
20701
|
-
tournamentId: tournamentRecord?.tournamentId,
|
|
20702
|
-
drawDefinition,
|
|
20703
|
-
matchUps
|
|
20704
|
-
});
|
|
20705
|
-
modifyDrawNotice({ drawDefinition, structureIds: [structureId] });
|
|
20706
|
-
return { ...SUCCESS };
|
|
20707
|
-
}
|
|
20708
|
-
|
|
20709
20719
|
const ENCOUNTER_VALUE = 50;
|
|
20710
20720
|
const SAME_TEAM_VALUE = 60;
|
|
20711
20721
|
const DEFAULT_RATING = 0;
|
|
@@ -21963,7 +21973,6 @@ const USTA_TOC = "USTA_TOC";
|
|
|
21963
21973
|
const USTA_WTT_ITT = "USTA_WTT_ITT";
|
|
21964
21974
|
const USTA_ZONAL = "USTA_ZONAL";
|
|
21965
21975
|
|
|
21966
|
-
const bestOf3tbSets = "SET3-S:6/TB7";
|
|
21967
21976
|
const STANDARD = "STANDARD";
|
|
21968
21977
|
const namedFormats = {
|
|
21969
21978
|
[STANDARD]: {
|
|
@@ -21980,9 +21989,9 @@ const namedFormats = {
|
|
|
21980
21989
|
matchUpFormat: "SET1-S:8/TB7@7"
|
|
21981
21990
|
},
|
|
21982
21991
|
singles: {
|
|
21992
|
+
matchUpFormat: FORMAT_STANDARD,
|
|
21983
21993
|
matchUpCount: 6,
|
|
21984
|
-
matchUpValue: 1
|
|
21985
|
-
matchUpFormat: bestOf3tbSets
|
|
21994
|
+
matchUpValue: 1
|
|
21986
21995
|
},
|
|
21987
21996
|
tieFormatName: COLLEGE_D3,
|
|
21988
21997
|
valueGoal: 5
|
|
@@ -21992,12 +22001,12 @@ const namedFormats = {
|
|
|
21992
22001
|
doubles: {
|
|
21993
22002
|
matchUpCount: 3,
|
|
21994
22003
|
collectionValue: 1,
|
|
21995
|
-
matchUpFormat:
|
|
22004
|
+
matchUpFormat: FORMAT_STANDARD
|
|
21996
22005
|
},
|
|
21997
22006
|
singles: {
|
|
21998
22007
|
matchUpCount: 6,
|
|
21999
22008
|
matchUpValue: 1,
|
|
22000
|
-
matchUpFormat:
|
|
22009
|
+
matchUpFormat: FORMAT_STANDARD
|
|
22001
22010
|
},
|
|
22002
22011
|
tieFormatName: COLLEGE_DEFAULT,
|
|
22003
22012
|
valueGoal: 4
|
|
@@ -22012,7 +22021,7 @@ const namedFormats = {
|
|
|
22012
22021
|
singles: {
|
|
22013
22022
|
matchUpCount: 6,
|
|
22014
22023
|
matchUpValue: 1,
|
|
22015
|
-
matchUpFormat:
|
|
22024
|
+
matchUpFormat: FORMAT_STANDARD
|
|
22016
22025
|
},
|
|
22017
22026
|
tieFormatName: COLLEGE_JUCO,
|
|
22018
22027
|
valueGoal: 5
|
|
@@ -22052,7 +22061,7 @@ const tieFormatDefaults = (params) => {
|
|
|
22052
22061
|
collectionDefinitions: [
|
|
22053
22062
|
{
|
|
22054
22063
|
collectionId: uuids?.pop() || UUID(),
|
|
22055
|
-
matchUpFormat:
|
|
22064
|
+
matchUpFormat: FORMAT_ATP_DOUBLES,
|
|
22056
22065
|
matchUpType: TypeEnum.Doubles,
|
|
22057
22066
|
collectionName: "Doubles",
|
|
22058
22067
|
...template.doubles
|
|
@@ -22060,7 +22069,7 @@ const tieFormatDefaults = (params) => {
|
|
|
22060
22069
|
{
|
|
22061
22070
|
collectionId: uuids?.pop() || UUID(),
|
|
22062
22071
|
matchUpType: TypeEnum.Singles,
|
|
22063
|
-
matchUpFormat:
|
|
22072
|
+
matchUpFormat: FORMAT_STANDARD,
|
|
22064
22073
|
collectionName: "Singles",
|
|
22065
22074
|
...template.singles
|
|
22066
22075
|
}
|
|
@@ -22568,7 +22577,7 @@ function generateDrawDefinition(params) {
|
|
|
22568
22577
|
} else if (!matchUpFormat) {
|
|
22569
22578
|
tieFormat = void 0;
|
|
22570
22579
|
if (!event?.matchUpFormat) {
|
|
22571
|
-
matchUpFormat =
|
|
22580
|
+
matchUpFormat = FORMAT_STANDARD;
|
|
22572
22581
|
}
|
|
22573
22582
|
}
|
|
22574
22583
|
const invalidDrawId = params.drawId && typeof params.drawId !== "string";
|