tods-competition-factory 0.67.2 → 0.68.1
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/tods-competition-factory.development.cjs.js +529 -263
- 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/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +4 -4
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.68.1';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -9403,7 +9403,10 @@ function getAppliedPolicies({
|
|
|
9403
9403
|
function getRoundMatchUps$1({
|
|
9404
9404
|
matchUps = []
|
|
9405
9405
|
}) {
|
|
9406
|
-
|
|
9406
|
+
if (!Array.isArray(matchUps)) return {
|
|
9407
|
+
error: INVALID_VALUES
|
|
9408
|
+
}; // create an array of arrays of matchUps grouped by roundNumber
|
|
9409
|
+
|
|
9407
9410
|
const roundMatchUpsArray = matchUps.reduce((roundNumbers, matchUp) => {
|
|
9408
9411
|
return !matchUp.roundNumber || roundNumbers.includes(matchUp.roundNumber) ? roundNumbers : roundNumbers.concat(parseInt(matchUp.roundNumber));
|
|
9409
9412
|
}, []).sort(numericSort).map(roundNumber => {
|
|
@@ -9439,13 +9442,21 @@ function getRoundMatchUps$1({
|
|
|
9439
9442
|
// - finishingRound: reverse count of rounds. Final is finishingRound #1
|
|
9440
9443
|
|
|
9441
9444
|
const roundProfile = Object.assign({}, ...Object.keys(roundMatchUps).map(roundNumber => {
|
|
9442
|
-
var _roundMatchUps$roundN;
|
|
9445
|
+
var _roundMatchUps$roundN, _roundMatchUps$roundN2, _roundMatchUps$roundN3;
|
|
9443
9446
|
|
|
9444
9447
|
const matchUpsCount = (_roundMatchUps$roundN = roundMatchUps[roundNumber]) === null || _roundMatchUps$roundN === void 0 ? void 0 : _roundMatchUps$roundN.length;
|
|
9448
|
+
const inactiveCount = (_roundMatchUps$roundN2 = roundMatchUps[roundNumber]) === null || _roundMatchUps$roundN2 === void 0 ? void 0 : (_roundMatchUps$roundN3 = _roundMatchUps$roundN2.filter(matchUp => {
|
|
9449
|
+
var _matchUp$score;
|
|
9450
|
+
|
|
9451
|
+
return !completedMatchUpStatuses.includes(matchUp.matchUpStatus) && !((_matchUp$score = matchUp.score) !== null && _matchUp$score !== void 0 && _matchUp$score.scoreStringSide1);
|
|
9452
|
+
})) === null || _roundMatchUps$roundN3 === void 0 ? void 0 : _roundMatchUps$roundN3.length;
|
|
9453
|
+
const inactiveRound = matchUpsCount && matchUpsCount === inactiveCount;
|
|
9445
9454
|
maxMatchUpsCount = Math.max(maxMatchUpsCount, matchUpsCount);
|
|
9446
9455
|
return {
|
|
9447
9456
|
[roundNumber]: {
|
|
9448
|
-
matchUpsCount
|
|
9457
|
+
matchUpsCount,
|
|
9458
|
+
inactiveCount,
|
|
9459
|
+
inactiveRound
|
|
9449
9460
|
}
|
|
9450
9461
|
};
|
|
9451
9462
|
}));
|
|
@@ -9630,7 +9641,7 @@ function findStructure({
|
|
|
9630
9641
|
};
|
|
9631
9642
|
const {
|
|
9632
9643
|
structures
|
|
9633
|
-
} = getDrawStructures
|
|
9644
|
+
} = getDrawStructures({
|
|
9634
9645
|
drawDefinition
|
|
9635
9646
|
});
|
|
9636
9647
|
const allStructures = structures.map(structure => {
|
|
@@ -9648,7 +9659,7 @@ function findStructure({
|
|
|
9648
9659
|
TESTS: structureGetter.test.js
|
|
9649
9660
|
*/
|
|
9650
9661
|
|
|
9651
|
-
function getDrawStructures
|
|
9662
|
+
function getDrawStructures({
|
|
9652
9663
|
stage,
|
|
9653
9664
|
stageSequence,
|
|
9654
9665
|
drawDefinition
|
|
@@ -9857,8 +9868,8 @@ function modifyEntryProfile({
|
|
|
9857
9868
|
let {
|
|
9858
9869
|
extension
|
|
9859
9870
|
} = findDrawDefinitionExtension({
|
|
9860
|
-
|
|
9861
|
-
|
|
9871
|
+
name: ENTRY_PROFILE,
|
|
9872
|
+
drawDefinition
|
|
9862
9873
|
});
|
|
9863
9874
|
const entryProfile = ((_extension = extension) === null || _extension === void 0 ? void 0 : _extension.value) || drawDefinition.entryProfile || {};
|
|
9864
9875
|
attributes.forEach(attribute => {
|
|
@@ -10678,7 +10689,7 @@ function isAdHoc({
|
|
|
10678
10689
|
drawDefinition,
|
|
10679
10690
|
structure
|
|
10680
10691
|
}) {
|
|
10681
|
-
if (!
|
|
10692
|
+
if (!structure) return false;
|
|
10682
10693
|
return !(structure !== null && structure !== void 0 && structure.structures) && !(drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.drawType && drawDefinition.drawType !== AD_HOC) && !(structure !== null && structure !== void 0 && structure.matchUps.find(({
|
|
10683
10694
|
roundPosition
|
|
10684
10695
|
}) => !!roundPosition));
|
|
@@ -11397,7 +11408,7 @@ function getAllStructureMatchUps({
|
|
|
11397
11408
|
}) {
|
|
11398
11409
|
var _roundNamingProfile$r, _roundNamingProfile$r2, _roundProfile$roundNu, _roundProfile$roundNu2, _roundProfile$roundNu3;
|
|
11399
11410
|
|
|
11400
|
-
const tieFormat = matchUp.tieFormat || structure.tieFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat);
|
|
11411
|
+
const tieFormat = matchUp.tieFormat || structure.tieFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
|
|
11401
11412
|
const collectionDefinitions = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions;
|
|
11402
11413
|
const collectionDefinition = matchUp.collectionId && (collectionDefinitions === null || collectionDefinitions === void 0 ? void 0 : collectionDefinitions.find(definition => definition.collectionId === matchUp.collectionId));
|
|
11403
11414
|
const matchUpFormat = matchUp.matchUpFormat || matchUp.collectionId ? collectionDefinition && collectionDefinition.matchUpFormat : structure.matchUpFormat || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpFormat) || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
@@ -11670,7 +11681,7 @@ function findMatchUp$1({
|
|
|
11670
11681
|
};
|
|
11671
11682
|
const {
|
|
11672
11683
|
structures
|
|
11673
|
-
} = getDrawStructures
|
|
11684
|
+
} = getDrawStructures({
|
|
11674
11685
|
drawDefinition
|
|
11675
11686
|
});
|
|
11676
11687
|
|
|
@@ -13376,7 +13387,7 @@ function getDrawMatchUps({
|
|
|
13376
13387
|
|
|
13377
13388
|
const {
|
|
13378
13389
|
structures
|
|
13379
|
-
} = getDrawStructures
|
|
13390
|
+
} = getDrawStructures({
|
|
13380
13391
|
drawDefinition
|
|
13381
13392
|
});
|
|
13382
13393
|
|
|
@@ -14416,7 +14427,7 @@ function tournamentRelevantSchedulingIds({
|
|
|
14416
14427
|
tournamentMap[tournamentId][eventId][drawId] = {};
|
|
14417
14428
|
const {
|
|
14418
14429
|
structures
|
|
14419
|
-
} = getDrawStructures
|
|
14430
|
+
} = getDrawStructures({
|
|
14420
14431
|
drawDefinition
|
|
14421
14432
|
});
|
|
14422
14433
|
(structures || []).forEach(structure => {
|
|
@@ -15396,23 +15407,24 @@ function isActiveMatchUp({
|
|
|
15396
15407
|
|
|
15397
15408
|
function structureActiveDrawPositions({
|
|
15398
15409
|
drawDefinition,
|
|
15399
|
-
structureId
|
|
15410
|
+
structureId,
|
|
15411
|
+
structure
|
|
15400
15412
|
}) {
|
|
15401
15413
|
const matchUpFilters = {
|
|
15402
15414
|
isCollectionMatchUp: false
|
|
15403
15415
|
};
|
|
15416
|
+
|
|
15417
|
+
if (!structure) {
|
|
15418
|
+
const result = findStructure({
|
|
15419
|
+
drawDefinition,
|
|
15420
|
+
structureId
|
|
15421
|
+
});
|
|
15422
|
+
if (result.error) return result;
|
|
15423
|
+
structure = result.structure;
|
|
15424
|
+
}
|
|
15425
|
+
|
|
15404
15426
|
const {
|
|
15405
|
-
|
|
15406
|
-
error
|
|
15407
|
-
} = findStructure({
|
|
15408
|
-
drawDefinition,
|
|
15409
|
-
structureId
|
|
15410
|
-
});
|
|
15411
|
-
if (error) return {
|
|
15412
|
-
error
|
|
15413
|
-
};
|
|
15414
|
-
const {
|
|
15415
|
-
matchUps
|
|
15427
|
+
matchUps: inContextStructureMatchUps
|
|
15416
15428
|
} = getAllStructureMatchUps({
|
|
15417
15429
|
inContext: true,
|
|
15418
15430
|
drawDefinition,
|
|
@@ -15420,24 +15432,24 @@ function structureActiveDrawPositions({
|
|
|
15420
15432
|
structure
|
|
15421
15433
|
}); // first collect all drawPositions for the structure
|
|
15422
15434
|
|
|
15423
|
-
const drawPositions = unique([].concat(...
|
|
15435
|
+
const drawPositions = unique([].concat(...inContextStructureMatchUps.map(matchUp => matchUp.drawPositions || [])).filter(Boolean)).sort(numericSort); // get a mapping of all matchUpIds to dependent matchUpIds
|
|
15424
15436
|
|
|
15425
15437
|
const {
|
|
15426
15438
|
matchUpDependencies
|
|
15427
15439
|
} = getMatchUpDependencies({
|
|
15440
|
+
matchUps: inContextStructureMatchUps,
|
|
15428
15441
|
drawIds: [drawDefinition.drawId],
|
|
15429
|
-
drawDefinition
|
|
15430
|
-
matchUps
|
|
15442
|
+
drawDefinition
|
|
15431
15443
|
}); // determine which matchUps are active
|
|
15432
15444
|
|
|
15433
|
-
const activeMatchUps =
|
|
15445
|
+
const activeMatchUps = inContextStructureMatchUps.filter(isActiveMatchUp); // create an array of all matchUpIds active because they are dependent
|
|
15434
15446
|
|
|
15435
15447
|
const activeDependentMatchUpIds = unique(activeMatchUps.map(matchUp => {
|
|
15436
15448
|
var _matchUpDependencies$;
|
|
15437
15449
|
|
|
15438
15450
|
return [].concat(...(((_matchUpDependencies$ = matchUpDependencies[matchUp.matchUpId]) === null || _matchUpDependencies$ === void 0 ? void 0 : _matchUpDependencies$.matchUpIds) || []), matchUp.matchUpId);
|
|
15439
15451
|
}).flat());
|
|
15440
|
-
const activeDrawPositions = unique(
|
|
15452
|
+
const activeDrawPositions = unique(inContextStructureMatchUps.map(({
|
|
15441
15453
|
matchUpId,
|
|
15442
15454
|
drawPositions
|
|
15443
15455
|
}) => activeDependentMatchUpIds.includes(matchUpId) ? drawPositions : []).flat().filter(Boolean)).sort(numericSort);
|
|
@@ -15452,6 +15464,8 @@ function structureActiveDrawPositions({
|
|
|
15452
15464
|
const inactiveDrawPositions = (drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.filter(drawPosition => !activeDrawPositions.includes(drawPosition))) || [];
|
|
15453
15465
|
return {
|
|
15454
15466
|
allDrawPositions: drawPositions,
|
|
15467
|
+
inContextStructureMatchUps,
|
|
15468
|
+
activeDependentMatchUpIds,
|
|
15455
15469
|
inactiveDrawPositions,
|
|
15456
15470
|
positionAssignments,
|
|
15457
15471
|
activeDrawPositions,
|
|
@@ -22278,7 +22292,7 @@ function addParticipantContext(params) {
|
|
|
22278
22292
|
[entry.participantId]: entry
|
|
22279
22293
|
})));
|
|
22280
22294
|
const drawEntries = Object.values(entriesMap);
|
|
22281
|
-
const mainStructure = getDrawStructures
|
|
22295
|
+
const mainStructure = getDrawStructures({
|
|
22282
22296
|
stageSequence: 1,
|
|
22283
22297
|
drawDefinition,
|
|
22284
22298
|
stage: MAIN
|
|
@@ -22286,7 +22300,7 @@ function addParticipantContext(params) {
|
|
|
22286
22300
|
const drawSize = mainStructure && ((_getPositionAssignmen = getPositionAssignments$1({
|
|
22287
22301
|
structure: mainStructure
|
|
22288
22302
|
})) === null || _getPositionAssignmen === void 0 ? void 0 : (_getPositionAssignmen2 = _getPositionAssignmen.positionAssignments) === null || _getPositionAssignmen2 === void 0 ? void 0 : _getPositionAssignmen2.length);
|
|
22289
|
-
const qualifyingStructure = getDrawStructures
|
|
22303
|
+
const qualifyingStructure = getDrawStructures({
|
|
22290
22304
|
stageSequence: 1,
|
|
22291
22305
|
drawDefinition,
|
|
22292
22306
|
stage: QUALIFYING
|
|
@@ -31002,34 +31016,32 @@ function automatedPositioning$1({
|
|
|
31002
31016
|
}
|
|
31003
31017
|
|
|
31004
31018
|
const structureTemplate = ({
|
|
31005
|
-
|
|
31006
|
-
|
|
31007
|
-
|
|
31008
|
-
|
|
31009
|
-
|
|
31010
|
-
|
|
31011
|
-
roundOffset,
|
|
31012
|
-
exitProfile,
|
|
31013
|
-
// matchUpType, // unnecessary; factory propagates to this point in case it is ever necessary
|
|
31019
|
+
finishingPosition = ROUND_OUTCOME,
|
|
31020
|
+
structureAbbreviation,
|
|
31021
|
+
seedAssignments = [],
|
|
31022
|
+
stageSequence = 1,
|
|
31023
|
+
qualifyingRoundNumber,
|
|
31024
|
+
seedingProfile,
|
|
31014
31025
|
matchUpFormat,
|
|
31015
31026
|
structureType,
|
|
31016
|
-
structureAbbreviation,
|
|
31017
31027
|
structureName,
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
|
|
31022
|
-
|
|
31028
|
+
matchUps = [],
|
|
31029
|
+
structureId,
|
|
31030
|
+
exitProfile,
|
|
31031
|
+
roundOffset,
|
|
31032
|
+
roundLimit,
|
|
31033
|
+
stageOrder,
|
|
31034
|
+
structures,
|
|
31035
|
+
stage
|
|
31023
31036
|
}) => {
|
|
31024
31037
|
const structure = {
|
|
31038
|
+
structureId: structureId || UUID(),
|
|
31025
31039
|
structureAbbreviation,
|
|
31026
|
-
structureName,
|
|
31027
|
-
// matchUpType,
|
|
31028
|
-
matchUpFormat,
|
|
31029
|
-
stageSequence,
|
|
31030
31040
|
finishingPosition,
|
|
31031
31041
|
seedAssignments,
|
|
31032
|
-
|
|
31042
|
+
matchUpFormat,
|
|
31043
|
+
stageSequence,
|
|
31044
|
+
structureName
|
|
31033
31045
|
};
|
|
31034
31046
|
if (stage) structure.stage = stage;
|
|
31035
31047
|
if (stageOrder) structure.stageOrder = stageOrder;
|
|
@@ -31037,7 +31049,7 @@ const structureTemplate = ({
|
|
|
31037
31049
|
if (roundOffset) structure.roundOffset = roundOffset;
|
|
31038
31050
|
if (structureType) structure.structureType = structureType;
|
|
31039
31051
|
if (seedingProfile) structure.seedingProfile = seedingProfile;
|
|
31040
|
-
if (
|
|
31052
|
+
if (qualifyingRoundNumber) structure.qualifyingRoundNumber = qualifyingRoundNumber;
|
|
31041
31053
|
if (exitProfile) structure.exitProfile = exitProfile;
|
|
31042
31054
|
const positionAssignments = [].concat(...matchUps.map(matchUp => matchUp.drawPositions)).filter(Boolean);
|
|
31043
31055
|
|
|
@@ -31054,10 +31066,11 @@ const structureTemplate = ({
|
|
|
31054
31066
|
};
|
|
31055
31067
|
|
|
31056
31068
|
function treeMatchUps({
|
|
31057
|
-
|
|
31069
|
+
qualifyingRoundNumber,
|
|
31058
31070
|
// round at which participants qualify
|
|
31059
31071
|
finishingPositionOffset,
|
|
31060
31072
|
qualifyingPositions,
|
|
31073
|
+
// number of positions which qualify
|
|
31061
31074
|
matchUpType,
|
|
31062
31075
|
roundLimit,
|
|
31063
31076
|
idPrefix,
|
|
@@ -31091,7 +31104,7 @@ function treeMatchUps({
|
|
|
31091
31104
|
uuids
|
|
31092
31105
|
}));
|
|
31093
31106
|
roundNumber++;
|
|
31094
|
-
roundLimit = roundLimit ||
|
|
31107
|
+
roundLimit = roundLimit || qualifyingRoundNumber;
|
|
31095
31108
|
|
|
31096
31109
|
while (roundNodes.length > 1) {
|
|
31097
31110
|
if (qualifyingPositions && roundNodes.length === qualifyingPositions) roundLimit = roundNumber - 1;
|
|
@@ -31469,24 +31482,21 @@ function getMatchUpId({
|
|
|
31469
31482
|
}
|
|
31470
31483
|
|
|
31471
31484
|
function generateVoluntaryConsolationStructure$1({
|
|
31485
|
+
structureName = VOLUNTARY_CONSOLATION,
|
|
31486
|
+
structureAbbreviation,
|
|
31472
31487
|
drawDefinition,
|
|
31473
31488
|
participants,
|
|
31474
31489
|
matchUpType,
|
|
31475
|
-
event,
|
|
31476
|
-
structureName = VOLUNTARY_CONSOLATION,
|
|
31477
|
-
structureAbbreviation,
|
|
31478
31490
|
structureId,
|
|
31479
|
-
automated
|
|
31491
|
+
automated,
|
|
31492
|
+
drawSize,
|
|
31493
|
+
event
|
|
31480
31494
|
}) {
|
|
31481
31495
|
const stage = VOLUNTARY_CONSOLATION;
|
|
31482
31496
|
if (!drawDefinition) return {
|
|
31483
31497
|
error: MISSING_DRAW_DEFINITION
|
|
31484
31498
|
};
|
|
31485
31499
|
matchUpType = matchUpType || drawDefinition.matchUpType;
|
|
31486
|
-
const drawSize = getStageDrawPositionsCount({
|
|
31487
|
-
stage,
|
|
31488
|
-
drawDefinition
|
|
31489
|
-
});
|
|
31490
31500
|
const {
|
|
31491
31501
|
matchUps
|
|
31492
31502
|
} = treeMatchUps({
|
|
@@ -31521,6 +31531,34 @@ function generateVoluntaryConsolationStructure$1({
|
|
|
31521
31531
|
};
|
|
31522
31532
|
}
|
|
31523
31533
|
|
|
31534
|
+
function generateQualifyingLink$1({
|
|
31535
|
+
targetEntryRound = 1,
|
|
31536
|
+
sourceRoundNumber,
|
|
31537
|
+
sourceStructureId,
|
|
31538
|
+
targetStructureId,
|
|
31539
|
+
drawDefinition
|
|
31540
|
+
}) {
|
|
31541
|
+
if (!drawDefinition) return {
|
|
31542
|
+
error: MISSING_DRAW_DEFINITION
|
|
31543
|
+
};
|
|
31544
|
+
const link = {
|
|
31545
|
+
linkType: WINNER,
|
|
31546
|
+
source: {
|
|
31547
|
+
roundNumber: sourceRoundNumber,
|
|
31548
|
+
structureId: sourceStructureId
|
|
31549
|
+
},
|
|
31550
|
+
target: {
|
|
31551
|
+
feedProfile: DRAW,
|
|
31552
|
+
roundNumber: targetEntryRound,
|
|
31553
|
+
structureId: targetStructureId
|
|
31554
|
+
}
|
|
31555
|
+
};
|
|
31556
|
+
drawDefinition.links.push(link);
|
|
31557
|
+
modifyDrawNotice({
|
|
31558
|
+
drawDefinition
|
|
31559
|
+
});
|
|
31560
|
+
}
|
|
31561
|
+
|
|
31524
31562
|
/**
|
|
31525
31563
|
*
|
|
31526
31564
|
* @param {string} drawId - required - tournamentEngine discovers and passes { drawDefinition }
|
|
@@ -31729,12 +31767,12 @@ function setStageDrawSize({
|
|
|
31729
31767
|
const {
|
|
31730
31768
|
entryProfile
|
|
31731
31769
|
} = modifyEntryProfile({
|
|
31732
|
-
drawDefinition,
|
|
31733
31770
|
attributes: [{
|
|
31734
31771
|
[stage]: {
|
|
31735
31772
|
drawSize
|
|
31736
31773
|
}
|
|
31737
|
-
}]
|
|
31774
|
+
}],
|
|
31775
|
+
drawDefinition
|
|
31738
31776
|
});
|
|
31739
31777
|
modifyDrawNotice({
|
|
31740
31778
|
drawDefinition
|
|
@@ -31762,12 +31800,12 @@ function setStageAlternatesCount({
|
|
|
31762
31800
|
}
|
|
31763
31801
|
|
|
31764
31802
|
modifyEntryProfile({
|
|
31765
|
-
drawDefinition,
|
|
31766
31803
|
attributes: [{
|
|
31767
31804
|
[stage]: {
|
|
31768
31805
|
alternates: alternatesCount
|
|
31769
31806
|
}
|
|
31770
|
-
}]
|
|
31807
|
+
}],
|
|
31808
|
+
drawDefinition
|
|
31771
31809
|
});
|
|
31772
31810
|
|
|
31773
31811
|
if (!alternatesCount) {
|
|
@@ -31834,12 +31872,12 @@ function setStageWildcardsCount({
|
|
|
31834
31872
|
}
|
|
31835
31873
|
|
|
31836
31874
|
modifyEntryProfile({
|
|
31837
|
-
drawDefinition,
|
|
31838
31875
|
attributes: [{
|
|
31839
31876
|
[stage]: {
|
|
31840
31877
|
wildcardsCount
|
|
31841
31878
|
}
|
|
31842
|
-
}]
|
|
31879
|
+
}],
|
|
31880
|
+
drawDefinition
|
|
31843
31881
|
});
|
|
31844
31882
|
modifyDrawNotice({
|
|
31845
31883
|
drawDefinition
|
|
@@ -31848,9 +31886,9 @@ function setStageWildcardsCount({
|
|
|
31848
31886
|
};
|
|
31849
31887
|
}
|
|
31850
31888
|
function setStageQualifiersCount({
|
|
31889
|
+
qualifiersCount = 0,
|
|
31851
31890
|
drawDefinition,
|
|
31852
|
-
stage
|
|
31853
|
-
qualifiersCount = 0
|
|
31891
|
+
stage
|
|
31854
31892
|
}) {
|
|
31855
31893
|
if (!drawDefinition) return {
|
|
31856
31894
|
error: MISSING_DRAW_DEFINITION
|
|
@@ -31885,12 +31923,12 @@ function setStageQualifiersCount({
|
|
|
31885
31923
|
error: 'Total stage Entries cannot be greater than drawPositions'
|
|
31886
31924
|
};
|
|
31887
31925
|
modifyEntryProfile({
|
|
31888
|
-
drawDefinition,
|
|
31889
31926
|
attributes: [{
|
|
31890
31927
|
[stage]: {
|
|
31891
31928
|
qualifiersCount
|
|
31892
31929
|
}
|
|
31893
|
-
}]
|
|
31930
|
+
}],
|
|
31931
|
+
drawDefinition
|
|
31894
31932
|
});
|
|
31895
31933
|
modifyDrawNotice({
|
|
31896
31934
|
drawDefinition
|
|
@@ -31918,6 +31956,45 @@ function addVoluntaryConsolationStage$1({
|
|
|
31918
31956
|
return SUCCESS;
|
|
31919
31957
|
}
|
|
31920
31958
|
|
|
31959
|
+
function getStructureQualifiersCount({
|
|
31960
|
+
drawDefinition,
|
|
31961
|
+
structure,
|
|
31962
|
+
structureId
|
|
31963
|
+
}) {
|
|
31964
|
+
let error, qualifiersCount;
|
|
31965
|
+
|
|
31966
|
+
if (!structure) {
|
|
31967
|
+
({
|
|
31968
|
+
structure,
|
|
31969
|
+
error
|
|
31970
|
+
} = findStructure({
|
|
31971
|
+
drawDefinition,
|
|
31972
|
+
structureId
|
|
31973
|
+
}));
|
|
31974
|
+
}
|
|
31975
|
+
|
|
31976
|
+
if (!error) {
|
|
31977
|
+
if (structure.stage !== QUALIFYING) {
|
|
31978
|
+
error = 'Structure is not Qualifying';
|
|
31979
|
+
} else {
|
|
31980
|
+
const {
|
|
31981
|
+
matchUps
|
|
31982
|
+
} = getAllStructureMatchUps({
|
|
31983
|
+
drawDefinition,
|
|
31984
|
+
structure
|
|
31985
|
+
});
|
|
31986
|
+
qualifiersCount = matchUps.reduce((count, matchUp) => {
|
|
31987
|
+
return count + (matchUp.finishingRound === 1 ? 1 : 0);
|
|
31988
|
+
}, 0);
|
|
31989
|
+
}
|
|
31990
|
+
}
|
|
31991
|
+
|
|
31992
|
+
return {
|
|
31993
|
+
qualifiersCount,
|
|
31994
|
+
error
|
|
31995
|
+
};
|
|
31996
|
+
}
|
|
31997
|
+
|
|
31921
31998
|
function getStructureRoundProfile({
|
|
31922
31999
|
drawDefinition,
|
|
31923
32000
|
structureId
|
|
@@ -32121,7 +32198,7 @@ function getAvailablePlayoffRounds$1({
|
|
|
32121
32198
|
};
|
|
32122
32199
|
let {
|
|
32123
32200
|
structures
|
|
32124
|
-
} = getDrawStructures
|
|
32201
|
+
} = getDrawStructures({
|
|
32125
32202
|
stageSeqence: 1,
|
|
32126
32203
|
drawDefinition,
|
|
32127
32204
|
stage: MAIN
|
|
@@ -32135,7 +32212,7 @@ function getAvailablePlayoffRounds$1({
|
|
|
32135
32212
|
});
|
|
32136
32213
|
({
|
|
32137
32214
|
structures
|
|
32138
|
-
} = getDrawStructures
|
|
32215
|
+
} = getDrawStructures({
|
|
32139
32216
|
drawDefinition
|
|
32140
32217
|
}));
|
|
32141
32218
|
const filteredStructures = structures.filter(structure => !structureId || structure.structureId === structureId);
|
|
@@ -32560,7 +32637,8 @@ function playoffStructures({
|
|
|
32560
32637
|
};
|
|
32561
32638
|
const {
|
|
32562
32639
|
matchUps
|
|
32563
|
-
} = staggeredEntry ? feedInMatchUps(mainParams) :
|
|
32640
|
+
} = staggeredEntry ? feedInMatchUps(mainParams) // TODO: is this ever valid?
|
|
32641
|
+
: treeMatchUps(mainParams);
|
|
32564
32642
|
const structure = structureTemplate({
|
|
32565
32643
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
32566
32644
|
structureAbbreviation,
|
|
@@ -32935,10 +33013,6 @@ function deleteAdHocMatchUps$1({
|
|
|
32935
33013
|
}
|
|
32936
33014
|
|
|
32937
33015
|
function firstRoundLoserConsolation(params) {
|
|
32938
|
-
let {
|
|
32939
|
-
drawSize,
|
|
32940
|
-
consolationStructureName
|
|
32941
|
-
} = params;
|
|
32942
33016
|
const {
|
|
32943
33017
|
finishingPositionOffset = 0,
|
|
32944
33018
|
stageSequence = 1,
|
|
@@ -32948,13 +33022,10 @@ function firstRoundLoserConsolation(params) {
|
|
|
32948
33022
|
stage = MAIN,
|
|
32949
33023
|
matchUpType,
|
|
32950
33024
|
idPrefix,
|
|
33025
|
+
drawSize,
|
|
32951
33026
|
isMock,
|
|
32952
33027
|
uuids
|
|
32953
33028
|
} = params;
|
|
32954
|
-
drawSize = drawSize || getStageDrawPositionsCount({
|
|
32955
|
-
stage,
|
|
32956
|
-
drawDefinition
|
|
32957
|
-
});
|
|
32958
33029
|
const mainParams = {
|
|
32959
33030
|
finishingPositionOffset,
|
|
32960
33031
|
matchUpType,
|
|
@@ -32967,12 +33038,12 @@ function firstRoundLoserConsolation(params) {
|
|
|
32967
33038
|
matchUps
|
|
32968
33039
|
} = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
32969
33040
|
const mainStructure = structureTemplate({
|
|
32970
|
-
|
|
32971
|
-
matchUps,
|
|
32972
|
-
matchUpType,
|
|
32973
|
-
stageSequence,
|
|
33041
|
+
structureName: structureName || MAIN,
|
|
32974
33042
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
32975
|
-
|
|
33043
|
+
stageSequence,
|
|
33044
|
+
matchUpType,
|
|
33045
|
+
matchUps,
|
|
33046
|
+
stage
|
|
32976
33047
|
});
|
|
32977
33048
|
|
|
32978
33049
|
if (drawDefinition) {
|
|
@@ -32984,19 +33055,19 @@ function firstRoundLoserConsolation(params) {
|
|
|
32984
33055
|
matchUps: consolationMatchUps
|
|
32985
33056
|
} = treeMatchUps({
|
|
32986
33057
|
finishingPositionOffset: finishingPositionOffset + consolationDrawPositions,
|
|
32987
|
-
drawSize: consolationDrawPositions,
|
|
32988
33058
|
idPrefix: idPrefix && `${idPrefix}-c`,
|
|
33059
|
+
drawSize: consolationDrawPositions,
|
|
32989
33060
|
matchUpType,
|
|
32990
33061
|
isMock
|
|
32991
33062
|
});
|
|
32992
|
-
consolationStructureName = consolationStructureName || (structureName ? `${structureName} ${CONSOLATION}` : CONSOLATION);
|
|
33063
|
+
const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${CONSOLATION}` : CONSOLATION);
|
|
32993
33064
|
const consolationStructure = structureTemplate({
|
|
32994
|
-
|
|
32995
|
-
stageSequence: 1,
|
|
32996
|
-
stage: CONSOLATION,
|
|
32997
|
-
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33065
|
+
structureName: consolationStructureName,
|
|
32998
33066
|
matchUps: consolationMatchUps,
|
|
32999
|
-
|
|
33067
|
+
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33068
|
+
stage: CONSOLATION,
|
|
33069
|
+
stageSequence: 1,
|
|
33070
|
+
matchUpType
|
|
33000
33071
|
});
|
|
33001
33072
|
|
|
33002
33073
|
if (drawDefinition) {
|
|
@@ -33021,9 +33092,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
33021
33092
|
}
|
|
33022
33093
|
|
|
33023
33094
|
return Object.assign({
|
|
33024
|
-
|
|
33025
|
-
mainStructure,
|
|
33026
|
-
consolationStructure,
|
|
33095
|
+
structures: [mainStructure, consolationStructure],
|
|
33027
33096
|
links: drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.links
|
|
33028
33097
|
}, SUCCESS);
|
|
33029
33098
|
}
|
|
@@ -33201,10 +33270,10 @@ function generateDoubleElimination({
|
|
|
33201
33270
|
}
|
|
33202
33271
|
|
|
33203
33272
|
function feedInLinks({
|
|
33204
|
-
mainStructure,
|
|
33205
33273
|
consolationStructure,
|
|
33206
|
-
roundsCount,
|
|
33207
33274
|
roundOffset = 0,
|
|
33275
|
+
mainStructure,
|
|
33276
|
+
roundsCount,
|
|
33208
33277
|
feedPolicy,
|
|
33209
33278
|
fmlc
|
|
33210
33279
|
}) {
|
|
@@ -33258,13 +33327,10 @@ function generateCurtisConsolation({
|
|
|
33258
33327
|
drawDefinition,
|
|
33259
33328
|
matchUpType,
|
|
33260
33329
|
idPrefix,
|
|
33330
|
+
drawSize,
|
|
33261
33331
|
isMock,
|
|
33262
33332
|
uuids
|
|
33263
33333
|
}) {
|
|
33264
|
-
const drawSize = getStageDrawPositionsCount({
|
|
33265
|
-
stage: MAIN,
|
|
33266
|
-
drawDefinition
|
|
33267
|
-
});
|
|
33268
33334
|
const mainParams = {
|
|
33269
33335
|
finishingPositionOffset,
|
|
33270
33336
|
matchUpType,
|
|
@@ -33400,27 +33466,107 @@ function consolationFeedStructure({
|
|
|
33400
33466
|
};
|
|
33401
33467
|
}
|
|
33402
33468
|
|
|
33469
|
+
function generateQualifyingStructures({
|
|
33470
|
+
qualifyingProfiles,
|
|
33471
|
+
drawDefinition,
|
|
33472
|
+
matchUpType,
|
|
33473
|
+
idPrefix,
|
|
33474
|
+
isMock,
|
|
33475
|
+
uuids
|
|
33476
|
+
}) {
|
|
33477
|
+
const structures = [];
|
|
33478
|
+
|
|
33479
|
+
const sequenceSort = (a, b) => a.stageSequence - b.stageSequence;
|
|
33480
|
+
|
|
33481
|
+
let qualifyingDrawPositionsCount = 0,
|
|
33482
|
+
finalQualifyingRoundNumber,
|
|
33483
|
+
finalQualifyingStructureId,
|
|
33484
|
+
qualifiersCount = 0,
|
|
33485
|
+
stageSequence = 0;
|
|
33486
|
+
|
|
33487
|
+
for (const qualifyingProfile of qualifyingProfiles.sort(sequenceSort)) {
|
|
33488
|
+
var _matchUps$filter;
|
|
33489
|
+
|
|
33490
|
+
const {
|
|
33491
|
+
drawSize,
|
|
33492
|
+
qualifyingRoundNumber,
|
|
33493
|
+
qualifyingPositions,
|
|
33494
|
+
structureName
|
|
33495
|
+
} = qualifyingProfile;
|
|
33496
|
+
if (!drawSize || !isConvertableInteger(drawSize)) return {
|
|
33497
|
+
error: MISSING_DRAW_SIZE
|
|
33498
|
+
};
|
|
33499
|
+
const {
|
|
33500
|
+
matchUps,
|
|
33501
|
+
roundLimit
|
|
33502
|
+
} = treeMatchUps({
|
|
33503
|
+
qualifyingPositions,
|
|
33504
|
+
qualifyingRoundNumber,
|
|
33505
|
+
idPrefix,
|
|
33506
|
+
drawSize,
|
|
33507
|
+
isMock,
|
|
33508
|
+
uuids
|
|
33509
|
+
});
|
|
33510
|
+
stageSequence += 1;
|
|
33511
|
+
const qualifyingStructureName = structureName || (qualifyingProfiles.length > 1 ? `${QUALIFYING} ${stageSequence}` : QUALIFYING);
|
|
33512
|
+
const structure = structureTemplate({
|
|
33513
|
+
structureName: qualifyingStructureName,
|
|
33514
|
+
qualifyingRoundNumber: roundLimit,
|
|
33515
|
+
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33516
|
+
stage: QUALIFYING,
|
|
33517
|
+
stageSequence,
|
|
33518
|
+
matchUpType,
|
|
33519
|
+
roundLimit,
|
|
33520
|
+
// redundant
|
|
33521
|
+
matchUps
|
|
33522
|
+
}); // order of operations is important here!! finalyQualifier positions is not yet updated when this step occurs
|
|
33523
|
+
|
|
33524
|
+
if (stageSequence > 1) {
|
|
33525
|
+
generateQualifyingLink$1({
|
|
33526
|
+
sourceStructureId: finalQualifyingStructureId,
|
|
33527
|
+
targetStructureId: structure.structureId,
|
|
33528
|
+
sourceRoundNumber: finalQualifyingRoundNumber,
|
|
33529
|
+
drawDefinition
|
|
33530
|
+
}); // if more than one qualifying stageSequence, remove last stageSequence qualifier positions from count
|
|
33531
|
+
|
|
33532
|
+
qualifyingDrawPositionsCount += drawSize - qualifiersCount;
|
|
33533
|
+
} else {
|
|
33534
|
+
qualifyingDrawPositionsCount += drawSize;
|
|
33535
|
+
}
|
|
33536
|
+
|
|
33537
|
+
qualifiersCount = (_matchUps$filter = matchUps.filter(matchUp => matchUp.roundNumber === roundLimit)) === null || _matchUps$filter === void 0 ? void 0 : _matchUps$filter.length;
|
|
33538
|
+
finalQualifyingStructureId = structure.structureId;
|
|
33539
|
+
finalQualifyingRoundNumber = roundLimit;
|
|
33540
|
+
structures.push(structure);
|
|
33541
|
+
}
|
|
33542
|
+
|
|
33543
|
+
return {
|
|
33544
|
+
qualifyingDrawPositionsCount,
|
|
33545
|
+
finalQualifyingRoundNumber,
|
|
33546
|
+
finalQualifyingStructureId,
|
|
33547
|
+
qualifiersCount,
|
|
33548
|
+
structures,
|
|
33549
|
+
...SUCCESS
|
|
33550
|
+
};
|
|
33551
|
+
}
|
|
33552
|
+
|
|
33403
33553
|
function feedInChampionship(params = {}) {
|
|
33404
33554
|
const {
|
|
33405
|
-
uuids,
|
|
33406
|
-
feedRounds,
|
|
33407
|
-
matchUpType,
|
|
33408
|
-
stage = MAIN,
|
|
33409
|
-
structureName,
|
|
33410
|
-
drawDefinition,
|
|
33411
|
-
feedsFromFinal,
|
|
33412
|
-
stageSequence = 1,
|
|
33413
33555
|
finishingPositionOffset,
|
|
33556
|
+
stageSequence = 1,
|
|
33557
|
+
feedsFromFinal,
|
|
33414
33558
|
staggeredEntry,
|
|
33559
|
+
drawDefinition,
|
|
33560
|
+
structureName,
|
|
33561
|
+
matchUpType,
|
|
33415
33562
|
feedPolicy,
|
|
33563
|
+
feedRounds,
|
|
33416
33564
|
idPrefix,
|
|
33565
|
+
drawSize,
|
|
33417
33566
|
isMock,
|
|
33567
|
+
uuids,
|
|
33418
33568
|
fmlc
|
|
33419
33569
|
} = params;
|
|
33420
|
-
const drawSize = getStageDrawPositionsCount({
|
|
33421
|
-
stage,
|
|
33422
|
-
drawDefinition
|
|
33423
|
-
});
|
|
33424
33570
|
const mainParams = {
|
|
33425
33571
|
finishingPositionOffset,
|
|
33426
33572
|
matchUpType,
|
|
@@ -33447,98 +33593,38 @@ function feedInChampionship(params = {}) {
|
|
|
33447
33593
|
roundsCount
|
|
33448
33594
|
} = feedInMatchUps({
|
|
33449
33595
|
finishingPositionOffset: baseDrawSize,
|
|
33596
|
+
idPrefix: idPrefix && `${idPrefix}-c`,
|
|
33450
33597
|
isConsolation: true,
|
|
33451
33598
|
feedsFromFinal,
|
|
33452
33599
|
baseDrawSize,
|
|
33453
33600
|
matchUpType,
|
|
33454
33601
|
feedRounds,
|
|
33455
|
-
idPrefix: idPrefix && `${idPrefix}-c`,
|
|
33456
33602
|
isMock,
|
|
33457
33603
|
uuids,
|
|
33458
33604
|
fmlc
|
|
33459
33605
|
});
|
|
33460
33606
|
const consolationStructure = structureTemplate({
|
|
33461
|
-
|
|
33462
|
-
stageSequence: 1,
|
|
33463
|
-
stage: CONSOLATION,
|
|
33607
|
+
matchUps: consolationMatchUps,
|
|
33464
33608
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33465
33609
|
structureName: CONSOLATION,
|
|
33466
|
-
|
|
33610
|
+
stage: CONSOLATION,
|
|
33611
|
+
stageSequence: 1,
|
|
33612
|
+
matchUpType
|
|
33467
33613
|
});
|
|
33468
33614
|
drawDefinition.structures.push(consolationStructure);
|
|
33469
33615
|
const links = feedInLinks({
|
|
33470
|
-
mainStructure,
|
|
33471
33616
|
consolationStructure,
|
|
33617
|
+
mainStructure,
|
|
33472
33618
|
roundsCount,
|
|
33473
33619
|
feedPolicy,
|
|
33474
33620
|
fmlc
|
|
33475
33621
|
});
|
|
33476
33622
|
drawDefinition.links = drawDefinition.links.concat(...links);
|
|
33477
33623
|
return Object.assign({
|
|
33478
|
-
mainStructure,
|
|
33479
|
-
consolationStructure,
|
|
33624
|
+
structures: [mainStructure, consolationStructure],
|
|
33480
33625
|
links: drawDefinition.links
|
|
33481
|
-
}, SUCCESS
|
|
33482
|
-
}
|
|
33483
|
-
|
|
33484
|
-
function getDrawStructures({
|
|
33485
|
-
stage,
|
|
33486
|
-
stageSequence,
|
|
33487
|
-
drawDefinition
|
|
33488
|
-
} = {}) {
|
|
33489
|
-
if (!drawDefinition) return {
|
|
33490
|
-
error: MISSING_DRAW_DEFINITION
|
|
33491
|
-
};
|
|
33492
|
-
const stageStructures = drawDefinition.structures.filter(isStage).filter(isStageSequence);
|
|
33493
|
-
return {
|
|
33494
|
-
structures: stageStructures
|
|
33495
|
-
};
|
|
33496
|
-
|
|
33497
|
-
function isStage(structure) {
|
|
33498
|
-
return structure.stage === stage;
|
|
33499
|
-
}
|
|
33500
|
-
|
|
33501
|
-
function isStageSequence(structure) {
|
|
33502
|
-
return !stageSequence || structure.stageSequence === stageSequence;
|
|
33503
|
-
}
|
|
33504
|
-
}
|
|
33505
|
-
function getStructureQualifiersCount({
|
|
33506
|
-
drawDefinition,
|
|
33507
|
-
structure,
|
|
33508
|
-
structureId
|
|
33509
|
-
}) {
|
|
33510
|
-
let error, qualifiersCount;
|
|
33511
|
-
|
|
33512
|
-
if (!structure) {
|
|
33513
|
-
({
|
|
33514
|
-
structure,
|
|
33515
|
-
error
|
|
33516
|
-
} = findStructure({
|
|
33517
|
-
drawDefinition,
|
|
33518
|
-
structureId
|
|
33519
|
-
}));
|
|
33520
|
-
}
|
|
33521
|
-
|
|
33522
|
-
if (!error) {
|
|
33523
|
-
if (structure.stage !== QUALIFYING) {
|
|
33524
|
-
error = 'Structure is not Qualifying';
|
|
33525
|
-
} else {
|
|
33526
|
-
const {
|
|
33527
|
-
matchUps
|
|
33528
|
-
} = getAllStructureMatchUps({
|
|
33529
|
-
drawDefinition,
|
|
33530
|
-
structure
|
|
33531
|
-
});
|
|
33532
|
-
qualifiersCount = matchUps.reduce((count, matchUp) => {
|
|
33533
|
-
return count + (matchUp.finishingRound === 1 ? 1 : 0);
|
|
33534
|
-
}, 0);
|
|
33535
|
-
}
|
|
33536
|
-
}
|
|
33537
|
-
|
|
33538
|
-
return {
|
|
33539
|
-
qualifiersCount,
|
|
33540
|
-
error
|
|
33541
|
-
};
|
|
33626
|
+
}, { ...SUCCESS
|
|
33627
|
+
});
|
|
33542
33628
|
}
|
|
33543
33629
|
|
|
33544
33630
|
function generateRoundRobin({
|
|
@@ -33549,14 +33635,10 @@ function generateRoundRobin({
|
|
|
33549
33635
|
drawDefinition,
|
|
33550
33636
|
stage = MAIN,
|
|
33551
33637
|
matchUpType,
|
|
33638
|
+
drawSize,
|
|
33552
33639
|
idPrefix,
|
|
33553
33640
|
uuids
|
|
33554
33641
|
}) {
|
|
33555
|
-
const finishingPosition = WIN_RATIO;
|
|
33556
|
-
const drawSize = getStageDrawPositionsCount({
|
|
33557
|
-
stage,
|
|
33558
|
-
drawDefinition
|
|
33559
|
-
});
|
|
33560
33642
|
const {
|
|
33561
33643
|
groupCount,
|
|
33562
33644
|
groupSize
|
|
@@ -33564,6 +33646,7 @@ function generateRoundRobin({
|
|
|
33564
33646
|
structureOptions,
|
|
33565
33647
|
drawSize
|
|
33566
33648
|
});
|
|
33649
|
+
const finishingPosition = WIN_RATIO;
|
|
33567
33650
|
const structures = generateRange(1, groupCount + 1).map(structureOrder => structureTemplate({
|
|
33568
33651
|
structureName: `Group ${structureOrder}`,
|
|
33569
33652
|
matchUps: roundRobinMatchUps({
|
|
@@ -33592,10 +33675,11 @@ function generateRoundRobin({
|
|
|
33592
33675
|
});
|
|
33593
33676
|
drawDefinition.structures.push(structure);
|
|
33594
33677
|
return Object.assign({
|
|
33595
|
-
structure,
|
|
33678
|
+
structures: [structure],
|
|
33596
33679
|
groupCount,
|
|
33597
33680
|
groupSize
|
|
33598
|
-
}, SUCCESS
|
|
33681
|
+
}, { ...SUCCESS
|
|
33682
|
+
});
|
|
33599
33683
|
} // first iteration only links to a single playoff structure
|
|
33600
33684
|
// future iteration should allow structureOptions to specify
|
|
33601
33685
|
// groups of finishing drawPositions which playoff
|
|
@@ -33617,7 +33701,7 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
33617
33701
|
stage: MAIN
|
|
33618
33702
|
});
|
|
33619
33703
|
const {
|
|
33620
|
-
|
|
33704
|
+
structures: [mainStructure],
|
|
33621
33705
|
groupCount,
|
|
33622
33706
|
groupSize
|
|
33623
33707
|
} = generateRoundRobin(mainDrawProperties); // TODO: test for and handle this situation
|
|
@@ -33712,13 +33796,12 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
33712
33796
|
}
|
|
33713
33797
|
|
|
33714
33798
|
return undefined;
|
|
33715
|
-
}).filter(Boolean);
|
|
33716
|
-
|
|
33799
|
+
}).filter(Boolean);
|
|
33717
33800
|
return Object.assign({
|
|
33718
|
-
mainStructure,
|
|
33719
|
-
playoffStructures,
|
|
33801
|
+
structures: [mainStructure, ...playoffStructures],
|
|
33720
33802
|
links: drawDefinition.links
|
|
33721
|
-
}, SUCCESS
|
|
33803
|
+
}, { ...SUCCESS
|
|
33804
|
+
});
|
|
33722
33805
|
}
|
|
33723
33806
|
|
|
33724
33807
|
function generatePlayoffLink({
|
|
@@ -33889,19 +33972,18 @@ function groupRounds({
|
|
|
33889
33972
|
// TODO: consider refactoring to return structures rather than pushing them into drawDefinition
|
|
33890
33973
|
|
|
33891
33974
|
function generateDrawType(params = {}) {
|
|
33975
|
+
var _params$qualifyingPro, _qualifyingResult$str;
|
|
33976
|
+
|
|
33892
33977
|
const {
|
|
33893
33978
|
drawType = SINGLE_ELIMINATION,
|
|
33894
33979
|
stageSequence = 1,
|
|
33895
33980
|
drawDefinition,
|
|
33896
33981
|
staggeredEntry,
|
|
33982
|
+
// optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
33897
33983
|
structureName,
|
|
33898
33984
|
goesTo = true,
|
|
33899
|
-
stage = MAIN,
|
|
33900
33985
|
isMock,
|
|
33901
|
-
uuids
|
|
33902
|
-
// qualifyingRound, => passed through in params to treeMatchUps
|
|
33903
|
-
// TODO: description => is this passed on?
|
|
33904
|
-
|
|
33986
|
+
uuids
|
|
33905
33987
|
} = params;
|
|
33906
33988
|
if (!drawDefinition) return {
|
|
33907
33989
|
error: MISSING_DRAW_DEFINITION
|
|
@@ -33912,10 +33994,59 @@ function generateDrawType(params = {}) {
|
|
|
33912
33994
|
} = params;
|
|
33913
33995
|
tieFormat = tieFormat || drawDefinition.tieFormat || undefined;
|
|
33914
33996
|
matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
|
|
33915
|
-
const
|
|
33916
|
-
|
|
33917
|
-
|
|
33997
|
+
const mainStageDrawPositionsCount = getStageDrawPositionsCount({
|
|
33998
|
+
drawDefinition,
|
|
33999
|
+
stage: MAIN
|
|
33918
34000
|
});
|
|
34001
|
+
|
|
34002
|
+
if (!mainStageDrawPositionsCount) {
|
|
34003
|
+
setStageDrawSize({
|
|
34004
|
+
drawSize: params.drawSize,
|
|
34005
|
+
drawDefinition,
|
|
34006
|
+
stage: MAIN
|
|
34007
|
+
});
|
|
34008
|
+
} // first generate any qualifying structures
|
|
34009
|
+
|
|
34010
|
+
|
|
34011
|
+
const qualifyingResult = ((_params$qualifyingPro = params.qualifyingProfiles) === null || _params$qualifyingPro === void 0 ? void 0 : _params$qualifyingPro.length) && generateQualifyingStructures({
|
|
34012
|
+
qualifyingProfiles: params.qualifyingProfiles,
|
|
34013
|
+
idPrefix: params.idPrefix,
|
|
34014
|
+
drawDefinition,
|
|
34015
|
+
matchUpType,
|
|
34016
|
+
isMock,
|
|
34017
|
+
uuids
|
|
34018
|
+
});
|
|
34019
|
+
if (qualifyingResult !== null && qualifyingResult !== void 0 && qualifyingResult.error) return qualifyingResult;
|
|
34020
|
+
const {
|
|
34021
|
+
qualifiersCount = 0,
|
|
34022
|
+
qualifyingDrawPositionsCount
|
|
34023
|
+
} = qualifyingResult || {};
|
|
34024
|
+
|
|
34025
|
+
if (qualifyingDrawPositionsCount) {
|
|
34026
|
+
drawDefinition.structures.push(...qualifyingResult.structures);
|
|
34027
|
+
const qualifyingStageDrawPositionsCount = getStageDrawPositionsCount({
|
|
34028
|
+
stage: QUALIFYING,
|
|
34029
|
+
drawDefinition
|
|
34030
|
+
});
|
|
34031
|
+
|
|
34032
|
+
if (!qualifyingStageDrawPositionsCount) {
|
|
34033
|
+
const result = setStageDrawSize({
|
|
34034
|
+
drawSize: qualifyingDrawPositionsCount,
|
|
34035
|
+
stage: QUALIFYING,
|
|
34036
|
+
drawDefinition
|
|
34037
|
+
});
|
|
34038
|
+
if (result.error) return result;
|
|
34039
|
+
}
|
|
34040
|
+
|
|
34041
|
+
const result = setStageQualifiersCount({
|
|
34042
|
+
drawDefinition,
|
|
34043
|
+
qualifiersCount,
|
|
34044
|
+
stage: MAIN
|
|
34045
|
+
});
|
|
34046
|
+
if (result.error) return result;
|
|
34047
|
+
}
|
|
34048
|
+
|
|
34049
|
+
const drawSize = params.drawSize || mainStageDrawPositionsCount;
|
|
33919
34050
|
Object.assign(params, definedAttributes({
|
|
33920
34051
|
drawSize,
|
|
33921
34052
|
matchUpType,
|
|
@@ -33947,7 +34078,7 @@ function generateDrawType(params = {}) {
|
|
|
33947
34078
|
} = getDrawStructures({
|
|
33948
34079
|
drawDefinition,
|
|
33949
34080
|
stageSequence,
|
|
33950
|
-
stage
|
|
34081
|
+
stage: MAIN
|
|
33951
34082
|
});
|
|
33952
34083
|
const structureCount = stageStructures.length;
|
|
33953
34084
|
if (structureCount >= sequenceLimit) return {
|
|
@@ -33956,38 +34087,34 @@ function generateDrawType(params = {}) {
|
|
|
33956
34087
|
const generators = {
|
|
33957
34088
|
[AD_HOC]: () => {
|
|
33958
34089
|
const structure = structureTemplate({
|
|
33959
|
-
structureName: structureName ||
|
|
34090
|
+
structureName: structureName || MAIN,
|
|
33960
34091
|
finishingPosition: WIN_RATIO,
|
|
33961
34092
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33962
34093
|
stageSequence,
|
|
33963
34094
|
matchUps: [],
|
|
33964
34095
|
matchUpType,
|
|
33965
|
-
stage
|
|
34096
|
+
stage: MAIN
|
|
33966
34097
|
});
|
|
33967
34098
|
drawDefinition.structures.push(structure);
|
|
33968
34099
|
return Object.assign({
|
|
33969
|
-
structure
|
|
34100
|
+
structures: [structure]
|
|
33970
34101
|
}, SUCCESS);
|
|
33971
34102
|
},
|
|
33972
34103
|
[SINGLE_ELIMINATION]: () => {
|
|
33973
34104
|
const {
|
|
33974
|
-
matchUps
|
|
33975
|
-
roundLimit: derivedRoundLimit
|
|
34105
|
+
matchUps
|
|
33976
34106
|
} = treeMatchUps(params);
|
|
33977
|
-
const qualifyingRound = stage === QUALIFYING && derivedRoundLimit;
|
|
33978
34107
|
const structure = structureTemplate({
|
|
33979
|
-
structureName: structureName ||
|
|
33980
|
-
roundLimit: derivedRoundLimit,
|
|
34108
|
+
structureName: structureName || MAIN,
|
|
33981
34109
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
33982
|
-
qualifyingRound,
|
|
33983
34110
|
stageSequence,
|
|
33984
34111
|
matchUpType,
|
|
33985
|
-
|
|
33986
|
-
|
|
34112
|
+
stage: MAIN,
|
|
34113
|
+
matchUps
|
|
33987
34114
|
});
|
|
33988
34115
|
drawDefinition.structures.push(structure);
|
|
33989
34116
|
return Object.assign({
|
|
33990
|
-
structure
|
|
34117
|
+
structures: [structure]
|
|
33991
34118
|
}, SUCCESS);
|
|
33992
34119
|
},
|
|
33993
34120
|
[DOUBLE_ELIMINATION]: () => generateDoubleElimination(params),
|
|
@@ -34009,16 +34136,16 @@ function generateDrawType(params = {}) {
|
|
|
34009
34136
|
matchUpType
|
|
34010
34137
|
});
|
|
34011
34138
|
const structure = structureTemplate({
|
|
34012
|
-
structureName: structureName ||
|
|
34139
|
+
structureName: structureName || MAIN,
|
|
34013
34140
|
structureId: uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
34014
34141
|
stageSequence,
|
|
34015
34142
|
matchUpType,
|
|
34016
|
-
|
|
34017
|
-
|
|
34143
|
+
stage: MAIN,
|
|
34144
|
+
matchUps
|
|
34018
34145
|
});
|
|
34019
34146
|
drawDefinition.structures.push(structure);
|
|
34020
34147
|
return Object.assign({
|
|
34021
|
-
structure
|
|
34148
|
+
structures: [structure]
|
|
34022
34149
|
}, SUCCESS);
|
|
34023
34150
|
},
|
|
34024
34151
|
[FIRST_ROUND_LOSER_CONSOLATION]: () => firstRoundLoserConsolation(params),
|
|
@@ -34052,6 +34179,23 @@ function generateDrawType(params = {}) {
|
|
|
34052
34179
|
};
|
|
34053
34180
|
}
|
|
34054
34181
|
|
|
34182
|
+
if (qualifyingResult !== null && qualifyingResult !== void 0 && (_qualifyingResult$str = qualifyingResult.structures) !== null && _qualifyingResult$str !== void 0 && _qualifyingResult$str.length) {
|
|
34183
|
+
const {
|
|
34184
|
+
finalQualifyingRoundNumber: qualifyingRoundNumber,
|
|
34185
|
+
finalQualifyingStructureId: qualifyingStructureId
|
|
34186
|
+
} = qualifyingResult;
|
|
34187
|
+
const mainStructure = generatorResult.structures.find(({
|
|
34188
|
+
stage,
|
|
34189
|
+
stageSequence
|
|
34190
|
+
}) => stage === MAIN && stageSequence === 1);
|
|
34191
|
+
generateQualifyingLink$1({
|
|
34192
|
+
sourceStructureId: qualifyingStructureId,
|
|
34193
|
+
sourceRoundNumber: qualifyingRoundNumber,
|
|
34194
|
+
targetStructureId: mainStructure.structureId,
|
|
34195
|
+
drawDefinition
|
|
34196
|
+
});
|
|
34197
|
+
}
|
|
34198
|
+
|
|
34055
34199
|
const {
|
|
34056
34200
|
matchUps,
|
|
34057
34201
|
matchUpsMap
|
|
@@ -34081,17 +34225,17 @@ function generateDrawType(params = {}) {
|
|
|
34081
34225
|
drawDefinition,
|
|
34082
34226
|
matchUpsMap
|
|
34083
34227
|
}));
|
|
34084
|
-
const result = { ...SUCCESS,
|
|
34085
|
-
matchUps
|
|
34086
|
-
};
|
|
34087
|
-
Object.assign(result, generatorResult, {
|
|
34088
|
-
inContextDrawMatchUps,
|
|
34089
|
-
matchUpsMap
|
|
34090
|
-
});
|
|
34091
34228
|
modifyDrawNotice({
|
|
34092
34229
|
drawDefinition
|
|
34093
34230
|
});
|
|
34094
|
-
return
|
|
34231
|
+
return {
|
|
34232
|
+
structures: drawDefinition.structures,
|
|
34233
|
+
links: drawDefinition.links,
|
|
34234
|
+
inContextDrawMatchUps,
|
|
34235
|
+
matchUpsMap,
|
|
34236
|
+
...SUCCESS,
|
|
34237
|
+
matchUps
|
|
34238
|
+
};
|
|
34095
34239
|
}
|
|
34096
34240
|
|
|
34097
34241
|
function removeStructure({
|
|
@@ -34181,6 +34325,7 @@ const structureGovernor = {
|
|
|
34181
34325
|
getAvailablePlayoffRounds: getAvailablePlayoffRounds$1,
|
|
34182
34326
|
addPlayoffStructures: addPlayoffStructures$1,
|
|
34183
34327
|
removeStructure,
|
|
34328
|
+
generateQualifyingLink: generateQualifyingLink$1,
|
|
34184
34329
|
generateAdHocMatchUps: generateAdHocMatchUps$1,
|
|
34185
34330
|
deleteAdHocMatchUps: deleteAdHocMatchUps$1,
|
|
34186
34331
|
structureSort,
|
|
@@ -38484,7 +38629,7 @@ const entryGovernor = {
|
|
|
38484
38629
|
function generateQualifyingLink({
|
|
38485
38630
|
qualifyingStructureId,
|
|
38486
38631
|
mainStructureId,
|
|
38487
|
-
|
|
38632
|
+
qualifyingRoundNumber,
|
|
38488
38633
|
mainEntryRound = 1,
|
|
38489
38634
|
drawDefinition
|
|
38490
38635
|
}) {
|
|
@@ -38494,7 +38639,7 @@ function generateQualifyingLink({
|
|
|
38494
38639
|
const link = {
|
|
38495
38640
|
linkType: WINNER,
|
|
38496
38641
|
source: {
|
|
38497
|
-
roundNumber:
|
|
38642
|
+
roundNumber: qualifyingRoundNumber,
|
|
38498
38643
|
structureId: qualifyingStructureId
|
|
38499
38644
|
},
|
|
38500
38645
|
target: {
|
|
@@ -41227,11 +41372,11 @@ function getEventData({
|
|
|
41227
41372
|
}
|
|
41228
41373
|
|
|
41229
41374
|
function publishEvent({
|
|
41230
|
-
tournamentRecord,
|
|
41231
41375
|
policyDefinitions,
|
|
41232
|
-
status = PUBLIC,
|
|
41233
41376
|
structureIds = [],
|
|
41377
|
+
tournamentRecord,
|
|
41234
41378
|
drawIdsToRemove,
|
|
41379
|
+
status = PUBLIC,
|
|
41235
41380
|
drawIdsToAdd,
|
|
41236
41381
|
drawIds,
|
|
41237
41382
|
event
|
|
@@ -41469,6 +41614,118 @@ const publishingGovernor = {
|
|
|
41469
41614
|
unPublishEvent
|
|
41470
41615
|
};
|
|
41471
41616
|
|
|
41617
|
+
function analyzeDraws(tournamentRecord) {
|
|
41618
|
+
var _tournamentRecord$eve;
|
|
41619
|
+
|
|
41620
|
+
const drawsAnalysis = {
|
|
41621
|
+
noPositionsAssigned: 0,
|
|
41622
|
+
// no positions assigned
|
|
41623
|
+
positionsNoOutcomes: 0,
|
|
41624
|
+
// all positions assigned and no outcomes
|
|
41625
|
+
matchPlayDraws: 0,
|
|
41626
|
+
// only first round has active matchUps; some unassigned positions
|
|
41627
|
+
canBePruned: 0,
|
|
41628
|
+
// partially assigned positions with outcomes => drawSizes can be reduced
|
|
41629
|
+
draws: []
|
|
41630
|
+
};
|
|
41631
|
+
const drawDefinitions = (_tournamentRecord$eve = tournamentRecord.events) === null || _tournamentRecord$eve === void 0 ? void 0 : _tournamentRecord$eve.map(event => event === null || event === void 0 ? void 0 : event.drawDefinitions).flat().filter(Boolean);
|
|
41632
|
+
drawDefinitions.forEach(drawDefinition => {
|
|
41633
|
+
const structures = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || [];
|
|
41634
|
+
const structureData = structures.map(structure => {
|
|
41635
|
+
const {
|
|
41636
|
+
stage,
|
|
41637
|
+
stageSequence,
|
|
41638
|
+
structureId
|
|
41639
|
+
} = structure;
|
|
41640
|
+
const orderNumber = stageOrder[stage];
|
|
41641
|
+
const {
|
|
41642
|
+
inContextStructureMatchUps
|
|
41643
|
+
} = structureActiveDrawPositions({
|
|
41644
|
+
drawDefinition,
|
|
41645
|
+
structure
|
|
41646
|
+
});
|
|
41647
|
+
const {
|
|
41648
|
+
positionAssignments
|
|
41649
|
+
} = getPositionAssignments$1({
|
|
41650
|
+
structure
|
|
41651
|
+
});
|
|
41652
|
+
const positionsAssigned = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(({
|
|
41653
|
+
participantId
|
|
41654
|
+
}) => participantId);
|
|
41655
|
+
const unassignedPositionsCount = ((positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length) || 0) - ((positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) || 0);
|
|
41656
|
+
const {
|
|
41657
|
+
roundMatchUps,
|
|
41658
|
+
roundProfile,
|
|
41659
|
+
roundNumbers,
|
|
41660
|
+
maxMatchUpsCount
|
|
41661
|
+
} = getRoundMatchUps$1({
|
|
41662
|
+
matchUps: inContextStructureMatchUps
|
|
41663
|
+
});
|
|
41664
|
+
const activeRounds = Object.keys(roundProfile).filter(roundNumber => !roundProfile[roundNumber].inactiveRound);
|
|
41665
|
+
const inactiveStructure = Object.values(roundProfile).every(profile => profile.inactiveRound);
|
|
41666
|
+
return {
|
|
41667
|
+
positionsAssignedCount: (positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) || 0,
|
|
41668
|
+
unassignedPositionsCount,
|
|
41669
|
+
inactiveStructure,
|
|
41670
|
+
maxMatchUpsCount,
|
|
41671
|
+
roundMatchUps,
|
|
41672
|
+
activeRounds,
|
|
41673
|
+
roundNumbers,
|
|
41674
|
+
roundProfile,
|
|
41675
|
+
structureId,
|
|
41676
|
+
stageSequence,
|
|
41677
|
+
orderNumber,
|
|
41678
|
+
stage
|
|
41679
|
+
};
|
|
41680
|
+
});
|
|
41681
|
+
const mainStructure = structureData.find(data => data.orderNumber === 2 && data.stageSequence === 1);
|
|
41682
|
+
const isMatchPlay = mainStructure.activeRounds.length === 1 && parseInt(mainStructure.activeRounds[0]) === 1;
|
|
41683
|
+
const canBePruned = mainStructure.activeRounds.length && mainStructure.roundProfile[1].inActiveCount;
|
|
41684
|
+
if (isMatchPlay) drawsAnalysis.matchPlayDraws += 1;
|
|
41685
|
+
if (canBePruned) drawsAnalysis.canBePruned += 1;
|
|
41686
|
+
drawsAnalysis.draws.push({
|
|
41687
|
+
drawId: drawDefinition.drawId,
|
|
41688
|
+
structureData,
|
|
41689
|
+
isMatchPlay
|
|
41690
|
+
});
|
|
41691
|
+
});
|
|
41692
|
+
return { ...SUCCESS,
|
|
41693
|
+
drawsAnalysis
|
|
41694
|
+
};
|
|
41695
|
+
}
|
|
41696
|
+
|
|
41697
|
+
function checkIsDual(tournamentRecord) {
|
|
41698
|
+
var _tournamentRecord$par, _tournamentRecord$eve, _event$drawDefinition, _drawDefinition$struc, _structure$positionAs;
|
|
41699
|
+
|
|
41700
|
+
const teamParticipants = (_tournamentRecord$par = tournamentRecord.participants) === null || _tournamentRecord$par === void 0 ? void 0 : _tournamentRecord$par.filter(({
|
|
41701
|
+
participantType
|
|
41702
|
+
}) => participantType === TEAM$1);
|
|
41703
|
+
const twoTeams = (teamParticipants === null || teamParticipants === void 0 ? void 0 : teamParticipants.length) === 2;
|
|
41704
|
+
const event = ((_tournamentRecord$eve = tournamentRecord.events) === null || _tournamentRecord$eve === void 0 ? void 0 : _tournamentRecord$eve.length) === 1 && tournamentRecord.events[0];
|
|
41705
|
+
const drawDefinition = (event === null || event === void 0 ? void 0 : (_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.length) === 1 && event.drawDefinitions[0];
|
|
41706
|
+
const structure = (drawDefinition === null || drawDefinition === void 0 ? void 0 : (_drawDefinition$struc = drawDefinition.structures) === null || _drawDefinition$struc === void 0 ? void 0 : _drawDefinition$struc.length) === 1 && drawDefinition.structures[0];
|
|
41707
|
+
const twoDrawPositions = (structure === null || structure === void 0 ? void 0 : (_structure$positionAs = structure.positionAssignments) === null || _structure$positionAs === void 0 ? void 0 : _structure$positionAs.length) === 2;
|
|
41708
|
+
return event.tieFormat && twoTeams && twoDrawPositions;
|
|
41709
|
+
}
|
|
41710
|
+
|
|
41711
|
+
function analyzeTournament({
|
|
41712
|
+
tournamentRecord
|
|
41713
|
+
}) {
|
|
41714
|
+
if (!tournamentRecord) return {
|
|
41715
|
+
error: MISSING_TOURNAMENT_RECORD
|
|
41716
|
+
};
|
|
41717
|
+
const {
|
|
41718
|
+
drawsAnalysis
|
|
41719
|
+
} = analyzeDraws(tournamentRecord);
|
|
41720
|
+
const analysis = {
|
|
41721
|
+
isDual: checkIsDual(tournamentRecord),
|
|
41722
|
+
drawsAnalysis
|
|
41723
|
+
};
|
|
41724
|
+
return { ...SUCCESS,
|
|
41725
|
+
analysis
|
|
41726
|
+
};
|
|
41727
|
+
}
|
|
41728
|
+
|
|
41472
41729
|
function setTournamentName({
|
|
41473
41730
|
tournamentRecord,
|
|
41474
41731
|
tournamentName,
|
|
@@ -41565,6 +41822,7 @@ function setTournamentCategories({
|
|
|
41565
41822
|
const tournamentGovernor = {
|
|
41566
41823
|
addNotes,
|
|
41567
41824
|
removeNotes,
|
|
41825
|
+
analyzeTournament,
|
|
41568
41826
|
setTournamentName,
|
|
41569
41827
|
setTournamentNotes,
|
|
41570
41828
|
setTournamentEndDate,
|
|
@@ -43894,17 +44152,15 @@ function generateDrawDefinition(params) {
|
|
|
43894
44152
|
// mainly used by mocksEngine for scenario testing
|
|
43895
44153
|
playoffMatchUpFormat,
|
|
43896
44154
|
seedByRanking = true,
|
|
43897
|
-
|
|
44155
|
+
qualifyingProfiles,
|
|
43898
44156
|
seededParticipants,
|
|
43899
44157
|
policyDefinitions,
|
|
43900
44158
|
seedingScaleName,
|
|
43901
44159
|
assignSeedsCount,
|
|
43902
44160
|
// used for testing bye placement next to seeds
|
|
43903
44161
|
automated = true,
|
|
43904
|
-
qualifyingRound,
|
|
43905
44162
|
seedingProfile,
|
|
43906
44163
|
tieFormatName,
|
|
43907
|
-
stage = MAIN,
|
|
43908
44164
|
drawEntries,
|
|
43909
44165
|
feedPolicy,
|
|
43910
44166
|
idPrefix,
|
|
@@ -43971,7 +44227,7 @@ function generateDrawDefinition(params) {
|
|
|
43971
44227
|
}
|
|
43972
44228
|
|
|
43973
44229
|
const entries = drawEntries || (event === null || event === void 0 ? void 0 : event.entries) || [];
|
|
43974
|
-
const stageEntries = entries.filter(entry => (!entry.entryStage || entry.entryStage ===
|
|
44230
|
+
const stageEntries = entries.filter(entry => (!entry.entryStage || entry.entryStage === MAIN) && STRUCTURE_SELECTED_STATUSES.includes(entry.entryStatus)); // the reason for this needs to be clarified
|
|
43975
44231
|
|
|
43976
44232
|
if ([ROUND_ROBIN].includes(drawType)) {
|
|
43977
44233
|
drawSize = stageEntries.length || drawSize;
|
|
@@ -43981,17 +44237,6 @@ function generateDrawDefinition(params) {
|
|
|
43981
44237
|
drawType,
|
|
43982
44238
|
drawId
|
|
43983
44239
|
});
|
|
43984
|
-
setStageDrawSize({
|
|
43985
|
-
drawDefinition,
|
|
43986
|
-
stage,
|
|
43987
|
-
drawSize
|
|
43988
|
-
});
|
|
43989
|
-
|
|
43990
|
-
if (drawEntries) {
|
|
43991
|
-
const drawEntryStages = drawEntries.reduce((stages, entry) => stages.includes(entry.entryStage) ? stages : stages.concat(entry.entryStage), []).filter(entryStage => entryStage !== stage).filter(Boolean); // if (drawEntryStages.length) console.log({ drawEntryStages, drawEntries });
|
|
43992
|
-
|
|
43993
|
-
if (drawEntryStages.length) console.log('drawEntryStages');
|
|
43994
|
-
}
|
|
43995
44240
|
|
|
43996
44241
|
if (matchUpFormat || tieFormat) {
|
|
43997
44242
|
let equivalentInScope = matchUpFormat && (event === null || event === void 0 ? void 0 : event.matchUpFormat) === matchUpFormat || (event === null || event === void 0 ? void 0 : event.tieFormat) && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat); // if an equivalent matchUpFormat or tieFormat is attached to the event
|
|
@@ -44020,19 +44265,18 @@ function generateDrawDefinition(params) {
|
|
|
44020
44265
|
finishingPositionNaming,
|
|
44021
44266
|
goesTo: params.goesTo,
|
|
44022
44267
|
playoffMatchUpFormat,
|
|
44023
|
-
|
|
44268
|
+
qualifyingProfiles,
|
|
44024
44269
|
structureOptions,
|
|
44025
|
-
qualifyingRound,
|
|
44026
44270
|
drawDefinition,
|
|
44027
44271
|
seedingProfile,
|
|
44028
44272
|
matchUpFormat,
|
|
44029
44273
|
matchUpType,
|
|
44030
44274
|
feedPolicy,
|
|
44031
44275
|
tieFormat,
|
|
44276
|
+
drawSize,
|
|
44032
44277
|
drawType,
|
|
44033
44278
|
idPrefix,
|
|
44034
44279
|
isMock,
|
|
44035
|
-
stage,
|
|
44036
44280
|
uuids
|
|
44037
44281
|
});
|
|
44038
44282
|
if (result.error) return result;
|
|
@@ -44045,7 +44289,7 @@ function generateDrawDefinition(params) {
|
|
|
44045
44289
|
} = getDrawStructures({
|
|
44046
44290
|
drawDefinition,
|
|
44047
44291
|
stageSequence: 1,
|
|
44048
|
-
stage
|
|
44292
|
+
stage: MAIN
|
|
44049
44293
|
});
|
|
44050
44294
|
const [structure] = structures;
|
|
44051
44295
|
const {
|
|
@@ -44170,8 +44414,8 @@ function generateDrawDefinition(params) {
|
|
|
44170
44414
|
} = getScaledEntries({
|
|
44171
44415
|
scaleAttributes: seedingScaleAttributes,
|
|
44172
44416
|
tournamentRecord,
|
|
44173
|
-
|
|
44174
|
-
|
|
44417
|
+
stage: MAIN,
|
|
44418
|
+
entries
|
|
44175
44419
|
});
|
|
44176
44420
|
|
|
44177
44421
|
if (!((_scaledEntries = scaledEntries) !== null && _scaledEntries !== void 0 && _scaledEntries.length) && seedByRanking) {
|
|
@@ -44185,8 +44429,8 @@ function generateDrawDefinition(params) {
|
|
|
44185
44429
|
} = getScaledEntries({
|
|
44186
44430
|
scaleAttributes: rankingScaleAttributes,
|
|
44187
44431
|
tournamentRecord,
|
|
44188
|
-
|
|
44189
|
-
|
|
44432
|
+
stage: MAIN,
|
|
44433
|
+
entries
|
|
44190
44434
|
}));
|
|
44191
44435
|
}
|
|
44192
44436
|
|
|
@@ -48796,6 +49040,7 @@ function generatePersons({
|
|
|
48796
49040
|
error: INVALID_VALUES
|
|
48797
49041
|
};
|
|
48798
49042
|
let validPersonData = defaultPersonData.filter(person => !sex || person.sex === sex);
|
|
49043
|
+
let nationalityCodes = [];
|
|
48799
49044
|
|
|
48800
49045
|
if (Array.isArray(personData)) {
|
|
48801
49046
|
const validatedPersonData = personData.filter(person => {
|
|
@@ -48806,6 +49051,7 @@ function generatePersons({
|
|
|
48806
49051
|
iso,
|
|
48807
49052
|
ioc
|
|
48808
49053
|
}) => [iso, ioc].includes(person.nationalityCode)))) return false;
|
|
49054
|
+
if (person.nationalityCode) nationalityCodes.push(person.nationalityCode);
|
|
48809
49055
|
return true;
|
|
48810
49056
|
});
|
|
48811
49057
|
|
|
@@ -48890,7 +49136,8 @@ function generatePersons({
|
|
|
48890
49136
|
}), person);
|
|
48891
49137
|
});
|
|
48892
49138
|
return {
|
|
48893
|
-
persons: persons.length && persons || shuffledPersons[0]
|
|
49139
|
+
persons: persons.length && persons || shuffledPersons[0],
|
|
49140
|
+
nationalityCodes
|
|
48894
49141
|
};
|
|
48895
49142
|
}
|
|
48896
49143
|
|
|
@@ -50332,6 +50579,7 @@ function generateParticipants({
|
|
|
50332
50579
|
const team = participantType === TEAM$1 || matchUpType === TEAM$1;
|
|
50333
50580
|
const individualParticipantsCount = participantsCount * (doubles ? 2 : team ? 8 : 1);
|
|
50334
50581
|
const {
|
|
50582
|
+
nationalityCodes: personNationalityCodes,
|
|
50335
50583
|
persons: mockedPersons,
|
|
50336
50584
|
error
|
|
50337
50585
|
} = generatePersons({
|
|
@@ -50481,7 +50729,7 @@ function generateParticipants({
|
|
|
50481
50729
|
const standardFamilyName = lastName || 'FamilyName';
|
|
50482
50730
|
const participantName = `${standardGivenName} ${standardFamilyName}`;
|
|
50483
50731
|
const country = countriesList[participantIndex];
|
|
50484
|
-
const nationalityCode = country && (nationalityCodeType === 'ISO' ? country.iso : country.ioc || country.iso) || personNationalityCode;
|
|
50732
|
+
const nationalityCode = (personNationalityCodes === null || personNationalityCodes === void 0 ? void 0 : personNationalityCodes.length) && personNationalityCode || country && (nationalityCodeType === 'ISO' ? country.iso : country.ioc || country.iso) || personNationalityCode;
|
|
50485
50733
|
|
|
50486
50734
|
if (countriesList !== null && countriesList !== void 0 && countriesList.length && !nationalityCode && !personNationalityCode) {
|
|
50487
50735
|
console.log('%c Invalid Nationality Code', {
|
|
@@ -50513,7 +50761,7 @@ function generateParticipants({
|
|
|
50513
50761
|
standardGivenName,
|
|
50514
50762
|
nationalityCode,
|
|
50515
50763
|
extensions,
|
|
50516
|
-
birthDate,
|
|
50764
|
+
birthDate: isValidDateString(birthDate) ? birthDate : undefined,
|
|
50517
50765
|
sex
|
|
50518
50766
|
}
|
|
50519
50767
|
});
|
|
@@ -51041,6 +51289,7 @@ function generateEventWithFlights({
|
|
|
51041
51289
|
tournamentRecord,
|
|
51042
51290
|
eventProfile,
|
|
51043
51291
|
eventIndex,
|
|
51292
|
+
publish,
|
|
51044
51293
|
uuids
|
|
51045
51294
|
}) {
|
|
51046
51295
|
let gender = eventProfile.gender;
|
|
@@ -51170,6 +51419,14 @@ function generateEventWithFlights({
|
|
|
51170
51419
|
});
|
|
51171
51420
|
if (result.error) return result;
|
|
51172
51421
|
const drawIds = result.drawIds;
|
|
51422
|
+
|
|
51423
|
+
if (publish) {
|
|
51424
|
+
publishEvent({
|
|
51425
|
+
tournamentRecord,
|
|
51426
|
+
event
|
|
51427
|
+
});
|
|
51428
|
+
}
|
|
51429
|
+
|
|
51173
51430
|
return {
|
|
51174
51431
|
drawIds,
|
|
51175
51432
|
eventId,
|
|
@@ -51198,6 +51455,7 @@ function generateEventWithDraw({
|
|
|
51198
51455
|
excessParticipantAlternates = true,
|
|
51199
51456
|
matchUpFormat = FORMAT_STANDARD,
|
|
51200
51457
|
drawType = SINGLE_ELIMINATION,
|
|
51458
|
+
tournamentAlternates = 0,
|
|
51201
51459
|
alternatesCount = 0,
|
|
51202
51460
|
generate = true,
|
|
51203
51461
|
eventExtensions,
|
|
@@ -51207,6 +51465,7 @@ function generateEventWithDraw({
|
|
|
51207
51465
|
seedsCount,
|
|
51208
51466
|
category,
|
|
51209
51467
|
idPrefix,
|
|
51468
|
+
publish,
|
|
51210
51469
|
gender,
|
|
51211
51470
|
stage
|
|
51212
51471
|
} = drawProfile;
|
|
@@ -51351,7 +51610,7 @@ function generateEventWithDraw({
|
|
|
51351
51610
|
|
|
51352
51611
|
const alternatesParticipantIds = excessParticipantAlternates && (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : (_tournamentRecord$par = tournamentRecord.participants) === null || _tournamentRecord$par === void 0 ? void 0 : _tournamentRecord$par.filter(({
|
|
51353
51612
|
participantId
|
|
51354
|
-
}) => !participantIds.includes(participantId)).filter(isEventParticipantType).filter(isEventGender).slice(0, alternatesCount || drawSize - participantsCount).map(p => p.participantId));
|
|
51613
|
+
}) => !participantIds.includes(participantId)).filter(isEventParticipantType).filter(isEventGender).slice(0, alternatesCount || drawSize - participantsCount || tournamentAlternates).map(p => p.participantId));
|
|
51355
51614
|
|
|
51356
51615
|
if (alternatesParticipantIds !== null && alternatesParticipantIds !== void 0 && alternatesParticipantIds.length) {
|
|
51357
51616
|
const result = addEventEntries({
|
|
@@ -51539,6 +51798,13 @@ function generateEventWithDraw({
|
|
|
51539
51798
|
|
|
51540
51799
|
}
|
|
51541
51800
|
}
|
|
51801
|
+
|
|
51802
|
+
if (publish) {
|
|
51803
|
+
publishEvent({
|
|
51804
|
+
tournamentRecord,
|
|
51805
|
+
event
|
|
51806
|
+
});
|
|
51807
|
+
}
|
|
51542
51808
|
}
|
|
51543
51809
|
|
|
51544
51810
|
return { ...SUCCESS,
|