tods-competition-factory 0.70.2 → 0.72.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 +218 -125
- 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.72.1';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -11560,6 +11560,8 @@ function getAllStructureMatchUps({
|
|
|
11560
11560
|
|
|
11561
11561
|
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
11562
11562
|
matchUpWithContext.sides.filter(Boolean).forEach(side => {
|
|
11563
|
+
var _side$participant;
|
|
11564
|
+
|
|
11563
11565
|
if (side.participantId) {
|
|
11564
11566
|
const participant = findParticipant({
|
|
11565
11567
|
policyDefinitions: appliedPolicies,
|
|
@@ -11574,7 +11576,7 @@ function getAllStructureMatchUps({
|
|
|
11574
11576
|
}
|
|
11575
11577
|
}
|
|
11576
11578
|
|
|
11577
|
-
if (side
|
|
11579
|
+
if (side !== null && side !== void 0 && (_side$participant = side.participant) !== null && _side$participant !== void 0 && _side$participant.individualParticipantIds) {
|
|
11578
11580
|
const individualParticipants = side.participant.individualParticipantIds.map(participantId => {
|
|
11579
11581
|
return findParticipant({
|
|
11580
11582
|
policyDefinitions: appliedPolicies,
|
|
@@ -16878,14 +16880,6 @@ function getPairedPreviousMatchUpIsWOWO(params) {
|
|
|
16878
16880
|
roundNumber,
|
|
16879
16881
|
roundPosition
|
|
16880
16882
|
}) => roundNumber === previousRoundNumber && roundPosition === pairedRoundPosition);
|
|
16881
|
-
/*
|
|
16882
|
-
const { pairedPreviousMatchUp } = getPairedPreviousMatchUp({
|
|
16883
|
-
matchUp: sourceMatchUp,
|
|
16884
|
-
structureId: structure.structureId,
|
|
16885
|
-
matchUpsMap,
|
|
16886
|
-
});
|
|
16887
|
-
*/
|
|
16888
|
-
|
|
16889
16883
|
const pairedPreviousMatchUpStatus = pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus;
|
|
16890
16884
|
const pairedPreviousMatchUpisWOWO = [DOUBLE_WALKOVER].includes(pairedPreviousMatchUpStatus);
|
|
16891
16885
|
return {
|
|
@@ -17439,12 +17433,12 @@ function getWalkoverWinningSide({
|
|
|
17439
17433
|
}
|
|
17440
17434
|
|
|
17441
17435
|
function assignMatchUpDrawPosition({
|
|
17436
|
+
inContextDrawMatchUps,
|
|
17442
17437
|
drawDefinition,
|
|
17443
|
-
matchUpId,
|
|
17444
17438
|
matchUpStatus,
|
|
17445
17439
|
drawPosition,
|
|
17446
17440
|
matchUpsMap,
|
|
17447
|
-
|
|
17441
|
+
matchUpId
|
|
17448
17442
|
}) {
|
|
17449
17443
|
var _drawDefinition$struc, _matchUpsMap, _matchUpsMap$drawMatc;
|
|
17450
17444
|
|
|
@@ -17519,10 +17513,10 @@ function assignMatchUpDrawPosition({
|
|
|
17519
17513
|
}
|
|
17520
17514
|
|
|
17521
17515
|
const targetData = positionTargets({
|
|
17522
|
-
matchUpId,
|
|
17523
|
-
drawDefinition,
|
|
17524
17516
|
inContextDrawMatchUps,
|
|
17525
|
-
inContextMatchUp
|
|
17517
|
+
inContextMatchUp,
|
|
17518
|
+
drawDefinition,
|
|
17519
|
+
matchUpId
|
|
17526
17520
|
});
|
|
17527
17521
|
const {
|
|
17528
17522
|
targetMatchUps: {
|
|
@@ -17543,12 +17537,12 @@ function assignMatchUpDrawPosition({
|
|
|
17543
17537
|
if (winnerMatchUp) {
|
|
17544
17538
|
if ([BYE, DOUBLE_WALKOVER].includes(matchUpStatus)) {
|
|
17545
17539
|
const result = assignMatchUpDrawPosition({
|
|
17546
|
-
drawDefinition,
|
|
17547
|
-
drawPosition,
|
|
17548
17540
|
matchUpId: winnerMatchUp.matchUpId,
|
|
17549
17541
|
iterative: 'brightmagenta',
|
|
17550
|
-
|
|
17551
|
-
|
|
17542
|
+
inContextDrawMatchUps,
|
|
17543
|
+
drawDefinition,
|
|
17544
|
+
drawPosition,
|
|
17545
|
+
matchUpsMap
|
|
17552
17546
|
});
|
|
17553
17547
|
if (result.error) return result;
|
|
17554
17548
|
} else {
|
|
@@ -17561,24 +17555,24 @@ function assignMatchUpDrawPosition({
|
|
|
17561
17555
|
}
|
|
17562
17556
|
}
|
|
17563
17557
|
}
|
|
17564
|
-
} else {
|
|
17558
|
+
} else if (winnerMatchUp && !inContextMatchUp.feedRound) {
|
|
17565
17559
|
const {
|
|
17566
17560
|
pairedPreviousMatchUpisWOWO
|
|
17567
17561
|
} = getPairedPreviousMatchUpIsWOWO({
|
|
17568
17562
|
winnerMatchUp: matchUp,
|
|
17569
17563
|
drawPosition,
|
|
17570
|
-
|
|
17571
|
-
|
|
17564
|
+
matchUpsMap,
|
|
17565
|
+
structure
|
|
17572
17566
|
});
|
|
17573
17567
|
|
|
17574
|
-
if (pairedPreviousMatchUpisWOWO
|
|
17568
|
+
if (pairedPreviousMatchUpisWOWO) {
|
|
17575
17569
|
const result = assignMatchUpDrawPosition({
|
|
17576
|
-
drawDefinition,
|
|
17577
|
-
drawPosition,
|
|
17578
17570
|
matchUpId: winnerMatchUp.matchUpId,
|
|
17579
17571
|
iterative: 'brightred',
|
|
17580
|
-
|
|
17581
|
-
|
|
17572
|
+
inContextDrawMatchUps,
|
|
17573
|
+
drawDefinition,
|
|
17574
|
+
drawPosition,
|
|
17575
|
+
matchUpsMap
|
|
17582
17576
|
});
|
|
17583
17577
|
if (result.error) return result;
|
|
17584
17578
|
}
|
|
@@ -18389,20 +18383,30 @@ function getSeedBlocks({
|
|
|
18389
18383
|
};
|
|
18390
18384
|
}
|
|
18391
18385
|
|
|
18386
|
+
/**
|
|
18387
|
+
* A seedBlock is an object pairing an array of drawPositions with an array of seedNumbers { drawPositions: [], seedNumbers: []}
|
|
18388
|
+
* In an elimination structure The first seedBlock is { drawPositions: [1], seedNumbers: [1] }
|
|
18389
|
+
* In an elimination structure The second seedBlock is{ drawPositions: [drawSize], seedNumbers: [2] }
|
|
18390
|
+
* In an elimination structure the third seedBlock is { drawPositions: [a, b], seedNumbers: [3, 4] }
|
|
18391
|
+
* In an elimination structure the fourth seedBlock is { drawPositions: [w, x, y, z], seedNumbers: [5, 6, 7, 8] }
|
|
18392
|
+
* The calculations for the positioning of [a, b] and [w, x, y, z] are specific to seeding policies
|
|
18393
|
+
*/
|
|
18394
|
+
|
|
18392
18395
|
function getValidSeedBlocks({
|
|
18393
|
-
drawDefinition,
|
|
18394
18396
|
appliedPolicies,
|
|
18397
|
+
drawDefinition,
|
|
18395
18398
|
allPositions,
|
|
18396
18399
|
structure
|
|
18397
18400
|
}) {
|
|
18398
18401
|
var _appliedPolicies$seed;
|
|
18399
18402
|
|
|
18400
|
-
let
|
|
18401
|
-
|
|
18402
|
-
|
|
18403
|
-
isFeedIn,
|
|
18403
|
+
let fedSeedNumberOffset = 0,
|
|
18404
|
+
firstRoundSeedsCount,
|
|
18405
|
+
validSeedBlocks = [],
|
|
18404
18406
|
isContainer,
|
|
18405
|
-
|
|
18407
|
+
isFeedIn,
|
|
18408
|
+
isLucky,
|
|
18409
|
+
error;
|
|
18406
18410
|
if (!structure) return {
|
|
18407
18411
|
error: MISSING_STRUCTURE
|
|
18408
18412
|
};
|
|
@@ -18471,40 +18475,53 @@ function getValidSeedBlocks({
|
|
|
18471
18475
|
// should be equal fo firstRoundDrawPositionOffset
|
|
18472
18476
|
|
|
18473
18477
|
fedSeedNumberOffset = fedSeedBlockPositions.length;
|
|
18478
|
+
} else if (firstRoundDrawPositions && !isPowerOf2(baseDrawSize)) {
|
|
18479
|
+
// if there are first round draw positions it is not AdHoc
|
|
18480
|
+
// if the baseDrawSize is not a power of 2 then it isLucky
|
|
18481
|
+
firstRoundSeedsCount = 0;
|
|
18482
|
+
isLucky = true;
|
|
18474
18483
|
} else {
|
|
18475
18484
|
firstRoundSeedsCount = countLimit;
|
|
18476
18485
|
}
|
|
18477
18486
|
|
|
18478
|
-
if (!isContainer) {
|
|
18487
|
+
if (!isContainer && !isLucky) {
|
|
18479
18488
|
const {
|
|
18480
18489
|
blocks,
|
|
18481
18490
|
error
|
|
18482
18491
|
} = constructPower2Blocks({
|
|
18483
|
-
|
|
18484
|
-
seedingProfile,
|
|
18485
|
-
seedCountGoal: firstRoundSeedsCount,
|
|
18492
|
+
drawPositionOffset: firstRoundDrawPositionOffset,
|
|
18486
18493
|
seedNumberOffset: fedSeedNumberOffset,
|
|
18487
|
-
|
|
18494
|
+
seedCountGoal: firstRoundSeedsCount,
|
|
18495
|
+
seedingProfile,
|
|
18496
|
+
baseDrawSize
|
|
18488
18497
|
});
|
|
18489
18498
|
|
|
18490
18499
|
if (error) {
|
|
18491
18500
|
return {
|
|
18492
|
-
error,
|
|
18493
18501
|
validSeedBlocks: [],
|
|
18494
18502
|
isContainer,
|
|
18495
|
-
isFeedIn
|
|
18503
|
+
isFeedIn,
|
|
18504
|
+
error
|
|
18496
18505
|
};
|
|
18497
18506
|
}
|
|
18498
18507
|
|
|
18499
18508
|
blocks.forEach(block => validSeedBlocks.push(block));
|
|
18500
18509
|
}
|
|
18501
18510
|
|
|
18511
|
+
if (isLucky) {
|
|
18512
|
+
const blocks = chunkArray(firstRoundDrawPositions, 2).map((block, i) => ({
|
|
18513
|
+
drawPositions: [block[0]],
|
|
18514
|
+
seedNumbers: [i + 1]
|
|
18515
|
+
}));
|
|
18516
|
+
blocks.forEach(block => validSeedBlocks.push(block));
|
|
18517
|
+
}
|
|
18518
|
+
|
|
18502
18519
|
const seedDrawPositions = [].concat(...validSeedBlocks.map(seedBlock => seedBlock.drawPositions));
|
|
18503
18520
|
const validSeedPositions = seedDrawPositions.reduce((result, drawPosition) => {
|
|
18504
18521
|
return (firstRoundDrawPositions === null || firstRoundDrawPositions === void 0 ? void 0 : firstRoundDrawPositions.includes(drawPosition)) && result;
|
|
18505
18522
|
}, true);
|
|
18506
18523
|
|
|
18507
|
-
if (!isFeedIn && !isContainer && !validSeedPositions) {
|
|
18524
|
+
if (!isLucky && !isFeedIn && !isContainer && !validSeedPositions) {
|
|
18508
18525
|
return {
|
|
18509
18526
|
error: INVALID_SEED_POSITION,
|
|
18510
18527
|
validSeedBlocks: [],
|
|
@@ -18515,8 +18532,9 @@ function getValidSeedBlocks({
|
|
|
18515
18532
|
|
|
18516
18533
|
return {
|
|
18517
18534
|
validSeedBlocks,
|
|
18535
|
+
isContainer,
|
|
18518
18536
|
isFeedIn,
|
|
18519
|
-
|
|
18537
|
+
isLucky
|
|
18520
18538
|
};
|
|
18521
18539
|
}
|
|
18522
18540
|
|
|
@@ -18620,11 +18638,11 @@ function constructContainerBlocks({
|
|
|
18620
18638
|
}
|
|
18621
18639
|
|
|
18622
18640
|
function constructPower2Blocks({
|
|
18623
|
-
baseDrawSize,
|
|
18624
|
-
seedCountGoal,
|
|
18625
|
-
seedingProfile,
|
|
18626
18641
|
drawPositionOffset = 0,
|
|
18627
|
-
seedNumberOffset = 0
|
|
18642
|
+
seedNumberOffset = 0,
|
|
18643
|
+
seedingProfile,
|
|
18644
|
+
seedCountGoal,
|
|
18645
|
+
baseDrawSize
|
|
18628
18646
|
}) {
|
|
18629
18647
|
let count = 1;
|
|
18630
18648
|
const blocks = [];
|
|
@@ -19557,9 +19575,9 @@ function attemptToSetWinningSide(params) {
|
|
|
19557
19575
|
}
|
|
19558
19576
|
|
|
19559
19577
|
function getPairedPreviousMatchUp({
|
|
19560
|
-
matchUp,
|
|
19561
19578
|
structureId,
|
|
19562
|
-
matchUpsMap
|
|
19579
|
+
matchUpsMap,
|
|
19580
|
+
matchUp
|
|
19563
19581
|
}) {
|
|
19564
19582
|
const sourceRoundPosition = matchUp === null || matchUp === void 0 ? void 0 : matchUp.roundPosition;
|
|
19565
19583
|
const offset = sourceRoundPosition % 2 ? 1 : -1;
|
|
@@ -19579,12 +19597,12 @@ function getPairedPreviousMatchUp({
|
|
|
19579
19597
|
|
|
19580
19598
|
function removeDoubleWalkover(params) {
|
|
19581
19599
|
const {
|
|
19600
|
+
inContextDrawMatchUps,
|
|
19582
19601
|
drawDefinition,
|
|
19602
|
+
matchUpsMap,
|
|
19583
19603
|
targetData,
|
|
19584
19604
|
structure,
|
|
19585
|
-
matchUp
|
|
19586
|
-
matchUpsMap,
|
|
19587
|
-
inContextDrawMatchUps
|
|
19605
|
+
matchUp
|
|
19588
19606
|
} = params;
|
|
19589
19607
|
const {
|
|
19590
19608
|
targetLinks: {
|
|
@@ -19610,29 +19628,40 @@ function removeDoubleWalkover(params) {
|
|
|
19610
19628
|
|
|
19611
19629
|
|
|
19612
19630
|
if (winnerMatchUp) {
|
|
19613
|
-
var _pairedPreviousMatchU;
|
|
19614
|
-
|
|
19615
|
-
const noContextWinnerMatchUp = matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === winnerMatchUp.matchUpId);
|
|
19616
|
-
const {
|
|
19617
|
-
pairedPreviousMatchUp
|
|
19618
|
-
} = getPairedPreviousMatchUp({
|
|
19619
|
-
matchUp,
|
|
19620
|
-
structureId: structure.structureId,
|
|
19621
|
-
matchUpsMap
|
|
19622
|
-
});
|
|
19623
|
-
const pairedPreviousWOWO = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) === DOUBLE_WALKOVER;
|
|
19624
|
-
const pairedPreviousDrawPositions = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : (_pairedPreviousMatchU = pairedPreviousMatchUp.drawPositions) === null || _pairedPreviousMatchU === void 0 ? void 0 : _pairedPreviousMatchU.filter(Boolean)) || [];
|
|
19625
|
-
const pairedPreviousMatchUpComplete = [...completedMatchUpStatuses, BYE].includes(pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) || (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.winningSide);
|
|
19626
19631
|
const nextTargetData = positionTargets({
|
|
19627
19632
|
matchUpId: winnerMatchUp.matchUpId,
|
|
19628
|
-
|
|
19629
|
-
|
|
19633
|
+
inContextDrawMatchUps,
|
|
19634
|
+
drawDefinition
|
|
19630
19635
|
});
|
|
19631
19636
|
const {
|
|
19632
19637
|
targetMatchUps: {
|
|
19633
19638
|
winnerMatchUp: nextWinnerMatchUp
|
|
19634
19639
|
}
|
|
19635
19640
|
} = nextTargetData;
|
|
19641
|
+
const noContextWinnerMatchUp = matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === winnerMatchUp.matchUpId);
|
|
19642
|
+
let pairedPreviousDrawPositions = [];
|
|
19643
|
+
let pairedPreviousMatchUpComplete;
|
|
19644
|
+
let pairedPreviousWOWO; // winnerMatchUp has context
|
|
19645
|
+
|
|
19646
|
+
if (winnerMatchUp.feedRound) {
|
|
19647
|
+
var _nextWinnerMatchUp$dr;
|
|
19648
|
+
|
|
19649
|
+
pairedPreviousDrawPositions = nextWinnerMatchUp === null || nextWinnerMatchUp === void 0 ? void 0 : (_nextWinnerMatchUp$dr = nextWinnerMatchUp.drawPositions) === null || _nextWinnerMatchUp$dr === void 0 ? void 0 : _nextWinnerMatchUp$dr.filter(Boolean);
|
|
19650
|
+
pairedPreviousMatchUpComplete = true;
|
|
19651
|
+
} else {
|
|
19652
|
+
var _pairedPreviousMatchU;
|
|
19653
|
+
|
|
19654
|
+
const {
|
|
19655
|
+
pairedPreviousMatchUp
|
|
19656
|
+
} = getPairedPreviousMatchUp({
|
|
19657
|
+
structureId: structure.structureId,
|
|
19658
|
+
matchUpsMap,
|
|
19659
|
+
matchUp
|
|
19660
|
+
});
|
|
19661
|
+
pairedPreviousWOWO = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) === DOUBLE_WALKOVER;
|
|
19662
|
+
pairedPreviousDrawPositions = (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : (_pairedPreviousMatchU = pairedPreviousMatchUp.drawPositions) === null || _pairedPreviousMatchU === void 0 ? void 0 : _pairedPreviousMatchU.filter(Boolean)) || [];
|
|
19663
|
+
pairedPreviousMatchUpComplete = [...completedMatchUpStatuses, BYE].includes(pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.matchUpStatus) || (pairedPreviousMatchUp === null || pairedPreviousMatchUp === void 0 ? void 0 : pairedPreviousMatchUp.winningSide);
|
|
19664
|
+
}
|
|
19636
19665
|
|
|
19637
19666
|
if (pairedPreviousMatchUpComplete) {
|
|
19638
19667
|
const sourceDrawPositions = matchUp.drawPositions || [];
|
|
@@ -19647,23 +19676,23 @@ function removeDoubleWalkover(params) {
|
|
|
19647
19676
|
|
|
19648
19677
|
if (nextWinnerMatchUp && drawPositionToRemove) {
|
|
19649
19678
|
const result = removeDirectedWinner({
|
|
19679
|
+
winningDrawPosition: drawPositionToRemove,
|
|
19650
19680
|
winnerMatchUp: nextWinnerMatchUp,
|
|
19681
|
+
inContextDrawMatchUps,
|
|
19651
19682
|
drawDefinition,
|
|
19652
|
-
|
|
19653
|
-
matchUpsMap,
|
|
19654
|
-
inContextDrawMatchUps
|
|
19683
|
+
matchUpsMap
|
|
19655
19684
|
});
|
|
19656
19685
|
if (result.error) return result;
|
|
19657
19686
|
}
|
|
19658
19687
|
}
|
|
19659
19688
|
|
|
19660
19689
|
removeDoubleWalkover({
|
|
19661
|
-
drawDefinition,
|
|
19662
19690
|
targetData: nextTargetData,
|
|
19663
|
-
structure,
|
|
19664
19691
|
matchUp: winnerMatchUp,
|
|
19692
|
+
inContextDrawMatchUps,
|
|
19693
|
+
drawDefinition,
|
|
19665
19694
|
matchUpsMap,
|
|
19666
|
-
|
|
19695
|
+
structure
|
|
19667
19696
|
});
|
|
19668
19697
|
let matchUpStatus = [WALKOVER$1, DOUBLE_WALKOVER].includes(noContextWinnerMatchUp === null || noContextWinnerMatchUp === void 0 ? void 0 : noContextWinnerMatchUp.matchUpStatus) && pairedPreviousWOWO ? WALKOVER$1 : TO_BE_PLAYED;
|
|
19669
19698
|
const removeScore = !pairedPreviousWOWO;
|
|
@@ -20428,17 +20457,17 @@ function setMatchUpStatus$1(params) {
|
|
|
20428
20457
|
}
|
|
20429
20458
|
|
|
20430
20459
|
return setMatchUpStatus$2({
|
|
20431
|
-
tournamentRecord,
|
|
20432
|
-
drawDefinition,
|
|
20433
|
-
event,
|
|
20434
20460
|
matchUpStatusCodes: outcome === null || outcome === void 0 ? void 0 : outcome.matchUpStatusCodes,
|
|
20435
20461
|
matchUpStatus: outcome === null || outcome === void 0 ? void 0 : outcome.matchUpStatus,
|
|
20436
|
-
matchUpFormat,
|
|
20437
|
-
matchUpId,
|
|
20438
20462
|
winningSide: outcome === null || outcome === void 0 ? void 0 : outcome.winningSide,
|
|
20439
20463
|
allowChangePropagation,
|
|
20440
20464
|
score: outcome === null || outcome === void 0 ? void 0 : outcome.score,
|
|
20465
|
+
tournamentRecord,
|
|
20466
|
+
drawDefinition,
|
|
20467
|
+
matchUpFormat,
|
|
20468
|
+
matchUpId,
|
|
20441
20469
|
schedule,
|
|
20470
|
+
event,
|
|
20442
20471
|
notes
|
|
20443
20472
|
});
|
|
20444
20473
|
}
|
|
@@ -22292,7 +22321,7 @@ function addParticipantContext(params) {
|
|
|
22292
22321
|
var _participant$individu;
|
|
22293
22322
|
|
|
22294
22323
|
const groupParticipantId = participant.participantId;
|
|
22295
|
-
(_participant$individu = participant.individualParticipantIds) === null || _participant$individu === void 0 ? void 0 : _participant$individu.forEach(participantId => {
|
|
22324
|
+
participant === null || participant === void 0 ? void 0 : (_participant$individu = participant.individualParticipantIds) === null || _participant$individu === void 0 ? void 0 : _participant$individu.forEach(participantId => {
|
|
22296
22325
|
if (!participantIdMap[participantId].groupParticipantIds.includes(groupParticipantId)) {
|
|
22297
22326
|
participantIdMap[participantId].groupParticipantIds.push(groupParticipantId);
|
|
22298
22327
|
participantIdMap[participantId].groups.push({
|
|
@@ -22309,7 +22338,7 @@ function addParticipantContext(params) {
|
|
|
22309
22338
|
var _participant$individu2;
|
|
22310
22339
|
|
|
22311
22340
|
const teamParticipantId = participant.participantId;
|
|
22312
|
-
(_participant$individu2 = participant.individualParticipantIds) === null || _participant$individu2 === void 0 ? void 0 : _participant$individu2.forEach(participantId => {
|
|
22341
|
+
participant === null || participant === void 0 ? void 0 : (_participant$individu2 = participant.individualParticipantIds) === null || _participant$individu2 === void 0 ? void 0 : _participant$individu2.forEach(participantId => {
|
|
22313
22342
|
if (!participantIdMap[participantId].teamParticipantIds.includes(teamParticipantId)) {
|
|
22314
22343
|
participantIdMap[participantId].teamParticipantIds.push(teamParticipantId);
|
|
22315
22344
|
participantIdMap[participantId].teams.push({
|
|
@@ -22327,7 +22356,7 @@ function addParticipantContext(params) {
|
|
|
22327
22356
|
var _participant$individu3;
|
|
22328
22357
|
|
|
22329
22358
|
const pairParticipantId = participant.participantId;
|
|
22330
|
-
(_participant$individu3 = participant.individualParticipantIds) === null || _participant$individu3 === void 0 ? void 0 : _participant$individu3.forEach(participantId => {
|
|
22359
|
+
participant === null || participant === void 0 ? void 0 : (_participant$individu3 = participant.individualParticipantIds) === null || _participant$individu3 === void 0 ? void 0 : _participant$individu3.forEach(participantId => {
|
|
22331
22360
|
if (!participantIdMap[participantId].pairParticipantIds.includes(pairParticipantId)) {
|
|
22332
22361
|
participantIdMap[participantId].pairParticipantIds.push(pairParticipantId);
|
|
22333
22362
|
}
|
|
@@ -30531,14 +30560,15 @@ function getStructurePositionedSeeds({
|
|
|
30531
30560
|
}
|
|
30532
30561
|
|
|
30533
30562
|
function getSeedOrderByePositions({
|
|
30534
|
-
|
|
30535
|
-
drawDefinition,
|
|
30563
|
+
relevantMatchUps,
|
|
30536
30564
|
appliedPolicies,
|
|
30537
|
-
|
|
30565
|
+
drawDefinition,
|
|
30566
|
+
structure
|
|
30538
30567
|
}) {
|
|
30539
30568
|
const {
|
|
30540
30569
|
validSeedBlocks,
|
|
30541
30570
|
isFeedIn,
|
|
30571
|
+
isLucky,
|
|
30542
30572
|
isContainer
|
|
30543
30573
|
} = getValidSeedBlocks({
|
|
30544
30574
|
appliedPolicies,
|
|
@@ -30585,8 +30615,9 @@ function getSeedOrderByePositions({
|
|
|
30585
30615
|
return {
|
|
30586
30616
|
strictSeedOrderByePositions,
|
|
30587
30617
|
blockSeedOrderByePositions,
|
|
30618
|
+
isContainer,
|
|
30588
30619
|
isFeedIn,
|
|
30589
|
-
|
|
30620
|
+
isLucky
|
|
30590
30621
|
};
|
|
30591
30622
|
}
|
|
30592
30623
|
|
|
@@ -30599,7 +30630,7 @@ function getOrderedByePositions({
|
|
|
30599
30630
|
// In CONTAINER/ROUND_ROBIN structures drawPositions are duplicated
|
|
30600
30631
|
// and therefore must placed in drawOrder within Groups
|
|
30601
30632
|
const matchUpDrawPositionPairs = relevantMatchUps.map(matchUp => matchUp.drawPositions);
|
|
30602
|
-
const consideredDrawPositionPairs = matchUpDrawPositionPairs.map(pair => pair.sort((a, b) => a - b)).filter(pair => pair[0] + 1 === pair[1]); // sort seededMatchUps so that pairedPositions represent seed order
|
|
30633
|
+
const consideredDrawPositionPairs = matchUpDrawPositionPairs.map(pair => pair === null || pair === void 0 ? void 0 : pair.sort((a, b) => a - b)).filter(pair => (pair === null || pair === void 0 ? void 0 : pair[0]) + 1 === (pair === null || pair === void 0 ? void 0 : pair[1])); // sort seededMatchUps so that pairedPositions represent seed order
|
|
30603
30634
|
|
|
30604
30635
|
const seedOrderSortedDrawPositionPairs = orderedSeedDrawPositions.map(drawPosition => consideredDrawPositionPairs.find(drawPositions => drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(drawPosition))).filter(Boolean);
|
|
30605
30636
|
const orderedByePositions = seedOrderSortedDrawPositionPairs.map(drawPositions => {
|
|
@@ -30611,9 +30642,10 @@ function getOrderedByePositions({
|
|
|
30611
30642
|
}
|
|
30612
30643
|
|
|
30613
30644
|
function getUnseededByePositions({
|
|
30614
|
-
structure,
|
|
30615
30645
|
appliedPolicies,
|
|
30616
|
-
|
|
30646
|
+
structure,
|
|
30647
|
+
isFeedIn,
|
|
30648
|
+
isLucky
|
|
30617
30649
|
}) {
|
|
30618
30650
|
var _appliedPolicies$seed;
|
|
30619
30651
|
|
|
@@ -30702,9 +30734,9 @@ function getUnseededByePositions({
|
|
|
30702
30734
|
const {
|
|
30703
30735
|
validSeedBlocks
|
|
30704
30736
|
} = getValidSeedBlocks({
|
|
30705
|
-
|
|
30737
|
+
allPositions: true,
|
|
30706
30738
|
appliedPolicies,
|
|
30707
|
-
|
|
30739
|
+
structure
|
|
30708
30740
|
});
|
|
30709
30741
|
const validBlockDrawPositions = validSeedBlocks.map(block => {
|
|
30710
30742
|
var _block$drawPositions;
|
|
@@ -30728,7 +30760,7 @@ function getUnseededByePositions({
|
|
|
30728
30760
|
} // for Round Robins pairs need to be reduced to pairs in drawPosition order
|
|
30729
30761
|
|
|
30730
30762
|
|
|
30731
|
-
const matchUpPairedDrawPositions = relevantMatchUps.map(matchUp => matchUp.drawPositions).map(pair => pair.sort((a, b) => a - b)).filter(pair => pair[0] + 1 === pair[1]);
|
|
30763
|
+
const matchUpPairedDrawPositions = relevantMatchUps.map(matchUp => matchUp.drawPositions).map(pair => pair === null || pair === void 0 ? void 0 : pair.sort((a, b) => a - b)).filter(pair => (pair === null || pair === void 0 ? void 0 : pair[0]) + 1 === (pair === null || pair === void 0 ? void 0 : pair[1]));
|
|
30732
30764
|
|
|
30733
30765
|
const findDrawPositionPair = drawPosition => {
|
|
30734
30766
|
return matchUpPairedDrawPositions.reduce((pair, candidate) => {
|
|
@@ -30855,14 +30887,15 @@ function positionByes({
|
|
|
30855
30887
|
drawDefinition
|
|
30856
30888
|
});
|
|
30857
30889
|
const {
|
|
30858
|
-
isFeedIn,
|
|
30859
30890
|
strictSeedOrderByePositions,
|
|
30860
|
-
blockSeedOrderByePositions
|
|
30891
|
+
blockSeedOrderByePositions,
|
|
30892
|
+
isFeedIn,
|
|
30893
|
+
isLucky
|
|
30861
30894
|
} = getSeedOrderByePositions({
|
|
30862
|
-
|
|
30863
|
-
drawDefinition,
|
|
30895
|
+
relevantMatchUps,
|
|
30864
30896
|
appliedPolicies,
|
|
30865
|
-
|
|
30897
|
+
drawDefinition,
|
|
30898
|
+
structure
|
|
30866
30899
|
});
|
|
30867
30900
|
const seedOrderByePositions = blockOrdered ? blockSeedOrderByePositions : strictSeedOrderByePositions;
|
|
30868
30901
|
const {
|
|
@@ -30870,9 +30903,10 @@ function positionByes({
|
|
|
30870
30903
|
} = getUnseededByePositions({
|
|
30871
30904
|
appliedPolicies,
|
|
30872
30905
|
structure,
|
|
30873
|
-
isFeedIn
|
|
30906
|
+
isFeedIn,
|
|
30907
|
+
isLucky
|
|
30874
30908
|
}); // first add all drawPositions paired with sorted seeds drawPositions
|
|
30875
|
-
// then add quarter separated
|
|
30909
|
+
// then add quarter separated and evenly distributed drawPositions
|
|
30876
30910
|
// derived from theoretical seeding of firstRoundParticipants/2
|
|
30877
30911
|
|
|
30878
30912
|
const byePositions = [].concat(...seedOrderByePositions, ...(seedsOnly ? [] : unseededByePositions)); // then take only the number of required byes
|
|
@@ -31087,6 +31121,7 @@ function automatedPositioning$1({
|
|
|
31087
31121
|
structureId,
|
|
31088
31122
|
matchUpsMap,
|
|
31089
31123
|
seedsOnly,
|
|
31124
|
+
drawType,
|
|
31090
31125
|
event
|
|
31091
31126
|
}) {
|
|
31092
31127
|
const {
|
|
@@ -31148,15 +31183,18 @@ function automatedPositioning$1({
|
|
|
31148
31183
|
} else {
|
|
31149
31184
|
// otherwise... seeds need to be placed first so that BYEs
|
|
31150
31185
|
// can follow the seedValues of placed seeds
|
|
31151
|
-
|
|
31152
|
-
|
|
31153
|
-
|
|
31154
|
-
|
|
31155
|
-
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31186
|
+
if (drawType !== LUCKY_DRAW) {
|
|
31187
|
+
let result = positionSeedBlocks({
|
|
31188
|
+
inContextDrawMatchUps,
|
|
31189
|
+
drawDefinition,
|
|
31190
|
+
participants,
|
|
31191
|
+
matchUpsMap,
|
|
31192
|
+
structure
|
|
31193
|
+
});
|
|
31194
|
+
if (result.error) return result;
|
|
31195
|
+
}
|
|
31196
|
+
|
|
31197
|
+
const result = positionByes({
|
|
31160
31198
|
inContextDrawMatchUps,
|
|
31161
31199
|
drawDefinition,
|
|
31162
31200
|
matchUpsMap,
|
|
@@ -31171,12 +31209,12 @@ function automatedPositioning$1({
|
|
|
31171
31209
|
|
|
31172
31210
|
if (!seedsOnly) {
|
|
31173
31211
|
let result = positionUnseededParticipants({
|
|
31212
|
+
inContextDrawMatchUps,
|
|
31174
31213
|
candidatesCount,
|
|
31175
31214
|
drawDefinition,
|
|
31176
31215
|
participants,
|
|
31177
|
-
structure,
|
|
31178
31216
|
matchUpsMap,
|
|
31179
|
-
|
|
31217
|
+
structure
|
|
31180
31218
|
});
|
|
31181
31219
|
if (result.error) return result;
|
|
31182
31220
|
if (result.conflicts) conflicts.unseededConflicts = result.conflicts;
|
|
@@ -36000,14 +36038,14 @@ function addEventEntries(params) {
|
|
|
36000
36038
|
var _tournamentRecord$par;
|
|
36001
36039
|
|
|
36002
36040
|
const {
|
|
36041
|
+
entryStatus = DIRECT_ACCEPTANCE,
|
|
36042
|
+
autoEntryPositions = true,
|
|
36043
|
+
participantIds = [],
|
|
36044
|
+
entryStage = MAIN,
|
|
36003
36045
|
tournamentRecord,
|
|
36004
36046
|
drawDefinition,
|
|
36005
36047
|
drawId,
|
|
36006
|
-
event
|
|
36007
|
-
participantIds = [],
|
|
36008
|
-
entryStatus = DIRECT_ACCEPTANCE,
|
|
36009
|
-
entryStage = MAIN,
|
|
36010
|
-
autoEntryPositions = true
|
|
36048
|
+
event
|
|
36011
36049
|
} = params;
|
|
36012
36050
|
if (!event) return {
|
|
36013
36051
|
error: MISSING_EVENT
|
|
@@ -36035,7 +36073,7 @@ function addEventEntries(params) {
|
|
|
36035
36073
|
return true;
|
|
36036
36074
|
}
|
|
36037
36075
|
|
|
36038
|
-
if (event.eventType === TEAM$1 && participant.participantType === TEAM$1) {
|
|
36076
|
+
if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || entryStatus === UNGROUPED && participant.participantType === INDIVIDUAL$1)) {
|
|
36039
36077
|
return true;
|
|
36040
36078
|
}
|
|
36041
36079
|
|
|
@@ -36055,7 +36093,7 @@ function addEventEntries(params) {
|
|
|
36055
36093
|
});
|
|
36056
36094
|
let message;
|
|
36057
36095
|
|
|
36058
|
-
if (drawId) {
|
|
36096
|
+
if (drawId && !isUngrouped(entryStage)) {
|
|
36059
36097
|
const result = addDrawEntries({
|
|
36060
36098
|
participantIds: validParticipantIds,
|
|
36061
36099
|
autoEntryPositions,
|
|
@@ -36948,7 +36986,7 @@ function generateDrawMaticRound({
|
|
|
36948
36986
|
if (teamParticipants) {
|
|
36949
36987
|
// add SAME_TEAM_VALUE for participants who appear on the same team
|
|
36950
36988
|
for (const teamParticipant of teamParticipants) {
|
|
36951
|
-
const participantIds = teamParticipant.individualParticipantIds;
|
|
36989
|
+
const participantIds = teamParticipant.individualParticipantIds || [];
|
|
36952
36990
|
const {
|
|
36953
36991
|
uniquePairings
|
|
36954
36992
|
} = getPairingsData({
|
|
@@ -40498,6 +40536,44 @@ function addPersons({
|
|
|
40498
40536
|
};
|
|
40499
40537
|
}
|
|
40500
40538
|
|
|
40539
|
+
/**
|
|
40540
|
+
* function called internally to cleanup event entries when individuals have been added to team events
|
|
40541
|
+
*/
|
|
40542
|
+
|
|
40543
|
+
function updateTeamEventEntries({
|
|
40544
|
+
individualParticipantIds,
|
|
40545
|
+
groupingParticipantId,
|
|
40546
|
+
tournamentRecord
|
|
40547
|
+
}) {
|
|
40548
|
+
const relevantEvents = (tournamentRecord.events || []).filter(event => {
|
|
40549
|
+
var _event$entries;
|
|
40550
|
+
|
|
40551
|
+
return (event === null || event === void 0 ? void 0 : event.eventType) === TEAM$2 && (event === null || event === void 0 ? void 0 : (_event$entries = event.entries) === null || _event$entries === void 0 ? void 0 : _event$entries.some(entry => entry.participantId === groupingParticipantId));
|
|
40552
|
+
});
|
|
40553
|
+
|
|
40554
|
+
const filterEntry = entry => !individualParticipantIds.includes(entry.participantId);
|
|
40555
|
+
|
|
40556
|
+
for (const event of relevantEvents) {
|
|
40557
|
+
var _flightProfile$flight, _event$drawDefinition;
|
|
40558
|
+
|
|
40559
|
+
event.entries = (event.entries || []).filter(filterEntry);
|
|
40560
|
+
const {
|
|
40561
|
+
flightProfile
|
|
40562
|
+
} = getFlightProfile({
|
|
40563
|
+
event
|
|
40564
|
+
});
|
|
40565
|
+
flightProfile === null || flightProfile === void 0 ? void 0 : (_flightProfile$flight = flightProfile.flights) === null || _flightProfile$flight === void 0 ? void 0 : _flightProfile$flight.forEach(flight => {
|
|
40566
|
+
flight.drawEntries = (flight.drawEntries || []).filter(filterEntry);
|
|
40567
|
+
});
|
|
40568
|
+
event === null || event === void 0 ? void 0 : (_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.forEach(drawDefinition => {
|
|
40569
|
+
drawDefinition.entries = (drawDefinition.entries || []).filter(filterEntry);
|
|
40570
|
+
});
|
|
40571
|
+
}
|
|
40572
|
+
|
|
40573
|
+
return { ...SUCCESS
|
|
40574
|
+
};
|
|
40575
|
+
}
|
|
40576
|
+
|
|
40501
40577
|
/**
|
|
40502
40578
|
*
|
|
40503
40579
|
* @param {object} tournamentRecord - passed in automatically by tournamentEngine
|
|
@@ -40508,10 +40584,10 @@ function addPersons({
|
|
|
40508
40584
|
*/
|
|
40509
40585
|
|
|
40510
40586
|
function addIndividualParticipantIds({
|
|
40511
|
-
tournamentRecord,
|
|
40512
|
-
groupingParticipantId,
|
|
40513
40587
|
individualParticipantIds,
|
|
40514
|
-
|
|
40588
|
+
groupingParticipantId,
|
|
40589
|
+
removeFromOtherTeams,
|
|
40590
|
+
tournamentRecord
|
|
40515
40591
|
}) {
|
|
40516
40592
|
if (!tournamentRecord) return {
|
|
40517
40593
|
error: MISSING_TOURNAMENT_RECORD
|
|
@@ -40575,9 +40651,15 @@ function addIndividualParticipantIds({
|
|
|
40575
40651
|
});
|
|
40576
40652
|
}
|
|
40577
40653
|
|
|
40578
|
-
|
|
40654
|
+
updateTeamEventEntries({
|
|
40655
|
+
individualParticipantIds,
|
|
40656
|
+
groupingParticipantId,
|
|
40657
|
+
tournamentRecord
|
|
40658
|
+
});
|
|
40659
|
+
return {
|
|
40579
40660
|
groupingParticipant: makeDeepCopy(groupingParticipant),
|
|
40580
|
-
added: participantIdsToAdd.length
|
|
40661
|
+
added: participantIdsToAdd.length,
|
|
40662
|
+
...SUCCESS
|
|
40581
40663
|
};
|
|
40582
40664
|
}
|
|
40583
40665
|
|
|
@@ -44748,7 +44830,9 @@ function generateDrawDefinition(params) {
|
|
|
44748
44830
|
seedsCount,
|
|
44749
44831
|
event
|
|
44750
44832
|
});
|
|
44751
|
-
if (seedLimit && seedLimit < seedsCount) seedsCount = seedLimit;
|
|
44833
|
+
if (seedLimit && seedLimit < seedsCount) seedsCount = seedLimit; // temporary until seeding is supported in LUCKY_DRAW
|
|
44834
|
+
|
|
44835
|
+
if (drawType === LUCKY_DRAW) seedsCount = 0;
|
|
44752
44836
|
|
|
44753
44837
|
if (seededParticipants) {
|
|
44754
44838
|
seededParticipants.filter(({
|
|
@@ -44843,7 +44927,9 @@ function generateDrawDefinition(params) {
|
|
|
44843
44927
|
participants,
|
|
44844
44928
|
structureId,
|
|
44845
44929
|
matchUpsMap,
|
|
44846
|
-
seedsOnly
|
|
44930
|
+
seedsOnly,
|
|
44931
|
+
drawType,
|
|
44932
|
+
event
|
|
44847
44933
|
}));
|
|
44848
44934
|
}
|
|
44849
44935
|
|
|
@@ -50667,6 +50753,7 @@ function completeDrawMatchUps({
|
|
|
50667
50753
|
};
|
|
50668
50754
|
}
|
|
50669
50755
|
function completeDrawMatchUp({
|
|
50756
|
+
matchUpStatusCodes,
|
|
50670
50757
|
drawDefinition,
|
|
50671
50758
|
targetMatchUp,
|
|
50672
50759
|
matchUpStatus,
|
|
@@ -50688,6 +50775,7 @@ function completeDrawMatchUp({
|
|
|
50688
50775
|
scoreString,
|
|
50689
50776
|
winningSide
|
|
50690
50777
|
});
|
|
50778
|
+
if (matchUpStatusCodes) outcome.matchUpStatusCodes = matchUpStatusCodes;
|
|
50691
50779
|
return setMatchUpStatus$1({
|
|
50692
50780
|
drawDefinition,
|
|
50693
50781
|
matchUpFormat,
|
|
@@ -51353,7 +51441,7 @@ function getParticipantsCount({
|
|
|
51353
51441
|
}
|
|
51354
51442
|
});
|
|
51355
51443
|
|
|
51356
|
-
if (drawProfiles) {
|
|
51444
|
+
if (Array.isArray(drawProfiles)) {
|
|
51357
51445
|
for (const drawProfile of drawProfiles) {
|
|
51358
51446
|
processDrawProfile(drawProfile);
|
|
51359
51447
|
}
|
|
@@ -52106,6 +52194,7 @@ function generateEventWithDraw({
|
|
|
52106
52194
|
matchUpFormat,
|
|
52107
52195
|
stageSequence = 1,
|
|
52108
52196
|
matchUpStatus = COMPLETED,
|
|
52197
|
+
matchUpStatusCodes,
|
|
52109
52198
|
matchUpIndex = 0,
|
|
52110
52199
|
structureOrder // like a group number; for RR = the order of the structureType: ITEM within structureType: CONTAINER
|
|
52111
52200
|
|
|
@@ -52133,6 +52222,7 @@ function generateEventWithDraw({
|
|
|
52133
52222
|
|
|
52134
52223
|
const targetMatchUp = targetMatchUps[matchUpIndex];
|
|
52135
52224
|
const result = completeDrawMatchUp({
|
|
52225
|
+
matchUpStatusCodes,
|
|
52136
52226
|
drawDefinition,
|
|
52137
52227
|
targetMatchUp,
|
|
52138
52228
|
matchUpFormat,
|
|
@@ -52636,6 +52726,9 @@ function generateTournamentRecord({
|
|
|
52636
52726
|
if (startDate && !isValidDateString(startDate) || endDate && !isValidDateString(endDate)) return {
|
|
52637
52727
|
error: INVALID_DATE
|
|
52638
52728
|
};
|
|
52729
|
+
if (eventProfiles && !Array.isArray(eventProfiles)) return {
|
|
52730
|
+
error: INVALID_VALUES
|
|
52731
|
+
};
|
|
52639
52732
|
|
|
52640
52733
|
if (!startDate) {
|
|
52641
52734
|
const tournamentDate = new Date();
|
|
@@ -52687,7 +52780,7 @@ function generateTournamentRecord({
|
|
|
52687
52780
|
eventIds = [],
|
|
52688
52781
|
allUniqueParticipantIds = [];
|
|
52689
52782
|
|
|
52690
|
-
if (drawProfiles) {
|
|
52783
|
+
if (Array.isArray(drawProfiles)) {
|
|
52691
52784
|
let drawIndex = 0;
|
|
52692
52785
|
|
|
52693
52786
|
for (const drawProfile of drawProfiles) {
|