tods-competition-factory 0.201.2 → 0.202.0
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 +275 -177
- 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 +5 -5
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.202.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
function decorateResult({
|
|
@@ -258,9 +258,10 @@ function decorateResult({
|
|
|
258
258
|
context,
|
|
259
259
|
info
|
|
260
260
|
}) {
|
|
261
|
-
if (stack
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
if (!result.stack) result.stack = [];
|
|
262
|
+
|
|
263
|
+
if (stack) {
|
|
264
|
+
result.stack.push(stack);
|
|
264
265
|
}
|
|
265
266
|
|
|
266
267
|
if (info && result.error) {
|
|
@@ -303,7 +304,7 @@ function isConvertableInteger(n) {
|
|
|
303
304
|
return Number.isSafeInteger(typeof n === 'string' ? +n : n);
|
|
304
305
|
} // produces an approximated normal distribution between 0 and max
|
|
305
306
|
|
|
306
|
-
function weightedRandom(max = 1, weight, round = true) {
|
|
307
|
+
function weightedRandom(max = 1, weight = 3, round = true) {
|
|
307
308
|
let num = 0;
|
|
308
309
|
|
|
309
310
|
for (let i = 0; i < weight; i++) {
|
|
@@ -4027,7 +4028,7 @@ function getHighTiebreakValue({
|
|
|
4027
4028
|
lowValue = 0,
|
|
4028
4029
|
NoAD = false,
|
|
4029
4030
|
tiebreakTo
|
|
4030
|
-
}) {
|
|
4031
|
+
} = {}) {
|
|
4031
4032
|
const winBy = NoAD ? 1 : 2;
|
|
4032
4033
|
|
|
4033
4034
|
if (lowValue + 1 >= tiebreakTo) {
|
|
@@ -5562,7 +5563,7 @@ function findCategoryTiming({
|
|
|
5562
5563
|
function findMatchupFormatAverageTimes({
|
|
5563
5564
|
matchUpAverageTimes,
|
|
5564
5565
|
matchUpFormat
|
|
5565
|
-
}) {
|
|
5566
|
+
} = {}) {
|
|
5566
5567
|
// first find all matchUpAverageTime definitions which include matchUpFormats...
|
|
5567
5568
|
// ... that either exactly match or start with the target matchUpFormat.
|
|
5568
5569
|
const codeMatches = (matchUpAverageTimes === null || matchUpAverageTimes === void 0 ? void 0 : matchUpAverageTimes.map(({
|
|
@@ -5586,7 +5587,7 @@ function findMatchupFormatRecoveryTimes({
|
|
|
5586
5587
|
matchUpRecoveryTimes,
|
|
5587
5588
|
averageMinutes,
|
|
5588
5589
|
matchUpFormat
|
|
5589
|
-
}) {
|
|
5590
|
+
} = {}) {
|
|
5590
5591
|
var _matchUpRecoveryTimes;
|
|
5591
5592
|
|
|
5592
5593
|
return matchUpRecoveryTimes === null || matchUpRecoveryTimes === void 0 ? void 0 : (_matchUpRecoveryTimes = matchUpRecoveryTimes.find(({
|
|
@@ -7102,7 +7103,7 @@ function getRoundMatchUps$1({
|
|
|
7102
7103
|
|
|
7103
7104
|
function getMatchUpType({
|
|
7104
7105
|
matchUp = {}
|
|
7105
|
-
}) {
|
|
7106
|
+
} = {}) {
|
|
7106
7107
|
var _matchUp$sides;
|
|
7107
7108
|
|
|
7108
7109
|
let matchUpType = matchUp.matchUpType;
|
|
@@ -7465,7 +7466,7 @@ function isValidExtension(extension) {
|
|
|
7465
7466
|
function addExtension$1({
|
|
7466
7467
|
element,
|
|
7467
7468
|
extension
|
|
7468
|
-
}) {
|
|
7469
|
+
} = {}) {
|
|
7469
7470
|
if (!element) return {
|
|
7470
7471
|
error: MISSING_VALUE
|
|
7471
7472
|
};
|
|
@@ -7496,7 +7497,7 @@ function addExtension$1({
|
|
|
7496
7497
|
function removeExtension$1({
|
|
7497
7498
|
element,
|
|
7498
7499
|
name
|
|
7499
|
-
}) {
|
|
7500
|
+
} = {}) {
|
|
7500
7501
|
if (!element) return {
|
|
7501
7502
|
error: MISSING_VALUE
|
|
7502
7503
|
};
|
|
@@ -8703,6 +8704,7 @@ function filterMatchUps(params) {
|
|
|
8703
8704
|
roundNumbers,
|
|
8704
8705
|
matchUpIds,
|
|
8705
8706
|
// only applies to inContext matchUps and only when processContext boolean is true
|
|
8707
|
+
stageSequences,
|
|
8706
8708
|
scheduledDates,
|
|
8707
8709
|
scheduledDate,
|
|
8708
8710
|
processContext,
|
|
@@ -8718,6 +8720,7 @@ function filterMatchUps(params) {
|
|
|
8718
8720
|
} = params;
|
|
8719
8721
|
const targetMatchUpStatuses = Array.isArray(matchUpStatuses) ? matchUpStatuses.filter(Boolean) : [];
|
|
8720
8722
|
const targetStages = Array.isArray(stages) ? stages.filter(Boolean) : [];
|
|
8723
|
+
const targetStageSequences = Array.isArray(stageSequences) ? stageSequences.filter(Boolean) : [];
|
|
8721
8724
|
const targetCollectionIds = Array.isArray(collectionIds) ? collectionIds.filter(Boolean) : [];
|
|
8722
8725
|
const targetRoundNumbers = Array.isArray(roundNumbers) ? roundNumbers.filter(Boolean) : [];
|
|
8723
8726
|
const targetRoundPositions = Array.isArray(roundPositions) ? roundPositions.filter(Boolean) : [];
|
|
@@ -8758,6 +8761,10 @@ function filterMatchUps(params) {
|
|
|
8758
8761
|
return false;
|
|
8759
8762
|
}
|
|
8760
8763
|
|
|
8764
|
+
if (targetStageSequences.length && !targetStageSequences.includes(matchUp.stageSequence)) {
|
|
8765
|
+
return false;
|
|
8766
|
+
}
|
|
8767
|
+
|
|
8761
8768
|
if (targetCollectionIds.length && !targetCollectionIds.includes(matchUp.collectionId)) {
|
|
8762
8769
|
return false;
|
|
8763
8770
|
}
|
|
@@ -11946,8 +11953,8 @@ function getStructureLinks({
|
|
|
11946
11953
|
*/
|
|
11947
11954
|
|
|
11948
11955
|
function positionTargets({
|
|
11949
|
-
useTargetMatchUpIds = false,
|
|
11950
11956
|
inContextDrawMatchUps = [],
|
|
11957
|
+
useTargetMatchUpIds,
|
|
11951
11958
|
inContextMatchUp,
|
|
11952
11959
|
drawDefinition,
|
|
11953
11960
|
matchUpId
|
|
@@ -11992,15 +11999,16 @@ function targetByRoundOutcome({
|
|
|
11992
11999
|
structure,
|
|
11993
12000
|
matchUp
|
|
11994
12001
|
}) {
|
|
12002
|
+
var _winnerTargetLink$tar, _loserTargetLink$targ;
|
|
12003
|
+
|
|
11995
12004
|
const {
|
|
11996
|
-
links
|
|
11997
|
-
source
|
|
11998
|
-
}
|
|
12005
|
+
links
|
|
11999
12006
|
} = getRoundLinks({
|
|
12000
12007
|
roundNumber: matchUp.roundNumber,
|
|
12001
12008
|
structureId: structure.structureId,
|
|
12002
12009
|
drawDefinition
|
|
12003
12010
|
});
|
|
12011
|
+
const source = links === null || links === void 0 ? void 0 : links.source;
|
|
12004
12012
|
const winnerTargetLink = getTargetLink({
|
|
12005
12013
|
source,
|
|
12006
12014
|
linkType: WINNER
|
|
@@ -12013,86 +12021,75 @@ function targetByRoundOutcome({
|
|
|
12013
12021
|
winnerMatchUpId,
|
|
12014
12022
|
loserMatchUpId
|
|
12015
12023
|
} = matchUp;
|
|
12024
|
+
const winnerFeedProfile = winnerTargetLink === null || winnerTargetLink === void 0 ? void 0 : (_winnerTargetLink$tar = winnerTargetLink.target) === null || _winnerTargetLink$tar === void 0 ? void 0 : _winnerTargetLink$tar.feedProfile;
|
|
12025
|
+
const loserFeedProfile = loserTargetLink === null || loserTargetLink === void 0 ? void 0 : (_loserTargetLink$targ = loserTargetLink.target) === null || _loserTargetLink$targ === void 0 ? void 0 : _loserTargetLink$targ.feedProfile;
|
|
12016
12026
|
let loserMatchUp, loserTargetDrawPosition, loserMatchUpDrawPositionIndex;
|
|
12017
12027
|
let winnerMatchUp, winnerTargetDrawPosition, winnerMatchUpDrawPositionIndex;
|
|
12018
12028
|
let structureMatchUps;
|
|
12019
12029
|
|
|
12020
|
-
if (useTargetMatchUpIds) {
|
|
12021
|
-
winnerMatchUp = winnerMatchUpId && inContextDrawMatchUps.find(({
|
|
12030
|
+
if (useTargetMatchUpIds && (winnerMatchUpId || loserMatchUpId)) {
|
|
12031
|
+
winnerMatchUp = winnerMatchUpId && winnerFeedProfile !== DRAW && inContextDrawMatchUps.find(({
|
|
12022
12032
|
matchUpId
|
|
12023
12033
|
}) => matchUpId === winnerMatchUpId);
|
|
12024
|
-
loserMatchUp = loserMatchUpId && inContextDrawMatchUps.find(({
|
|
12034
|
+
loserMatchUp = loserMatchUpId && loserFeedProfile !== DRAW && inContextDrawMatchUps.find(({
|
|
12025
12035
|
matchUpId
|
|
12026
12036
|
}) => matchUpId === loserMatchUpId);
|
|
12027
|
-
}
|
|
12028
12037
|
|
|
12029
|
-
|
|
12030
|
-
|
|
12031
|
-
|
|
12032
|
-
|
|
12033
|
-
|
|
12034
|
-
|
|
12035
|
-
|
|
12036
|
-
|
|
12037
|
-
|
|
12038
|
+
if (winnerMatchUp || loserMatchUp) {
|
|
12039
|
+
return {
|
|
12040
|
+
matchUp,
|
|
12041
|
+
targetLinks: {
|
|
12042
|
+
loserTargetLink,
|
|
12043
|
+
winnerTargetLink
|
|
12044
|
+
},
|
|
12045
|
+
targetMatchUps: {
|
|
12046
|
+
loserMatchUp,
|
|
12047
|
+
winnerMatchUp
|
|
12048
|
+
}
|
|
12049
|
+
};
|
|
12038
12050
|
}
|
|
12051
|
+
}
|
|
12039
12052
|
|
|
12040
|
-
|
|
12041
|
-
|
|
12042
|
-
|
|
12043
|
-
|
|
12044
|
-
|
|
12045
|
-
|
|
12046
|
-
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
if (loserTargetLink) {
|
|
12050
|
-
({
|
|
12051
|
-
matchUp: loserMatchUp,
|
|
12052
|
-
matchUpDrawPositionIndex: loserMatchUpDrawPositionIndex,
|
|
12053
|
-
targetDrawPosition: loserTargetDrawPosition
|
|
12054
|
-
} = getTargetMatchUp({
|
|
12055
|
-
targetLink: loserTargetLink,
|
|
12056
|
-
sourceRoundMatchUpCount,
|
|
12057
|
-
inContextDrawMatchUps,
|
|
12058
|
-
sourceRoundPosition,
|
|
12059
|
-
drawDefinition
|
|
12060
|
-
}));
|
|
12061
|
-
}
|
|
12053
|
+
const {
|
|
12054
|
+
roundPosition: sourceRoundPosition
|
|
12055
|
+
} = matchUp;
|
|
12056
|
+
structureMatchUps = structureMatchUps || inContextDrawMatchUps.filter(matchUp => matchUp.structureId === structure.structureId);
|
|
12057
|
+
const sourceRoundMatchUpCount = structureMatchUps.reduce((count, currentMatchUp) => {
|
|
12058
|
+
return currentMatchUp.roundNumber === matchUp.roundNumber && !currentMatchUp.matchUpTieId // exclude tieMatchUps
|
|
12059
|
+
? count + 1 : count;
|
|
12060
|
+
}, 0);
|
|
12062
12061
|
|
|
12063
|
-
|
|
12064
|
-
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12062
|
+
if (loserTargetLink && !loserMatchUp && loserFeedProfile !== DRAW) {
|
|
12063
|
+
({
|
|
12064
|
+
matchUp: loserMatchUp,
|
|
12065
|
+
matchUpDrawPositionIndex: loserMatchUpDrawPositionIndex,
|
|
12066
|
+
targetDrawPosition: loserTargetDrawPosition
|
|
12067
|
+
} = getTargetMatchUp({
|
|
12068
|
+
targetLink: loserTargetLink,
|
|
12069
|
+
sourceRoundMatchUpCount,
|
|
12070
|
+
inContextDrawMatchUps,
|
|
12071
|
+
sourceRoundPosition,
|
|
12072
|
+
drawDefinition
|
|
12073
|
+
}));
|
|
12074
|
+
}
|
|
12076
12075
|
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12076
|
+
if (winnerTargetLink && !winnerMatchUp && winnerFeedProfile !== DRAW) {
|
|
12077
|
+
({
|
|
12078
|
+
matchUp: winnerMatchUp,
|
|
12079
|
+
matchUpDrawPositionIndex: winnerMatchUpDrawPositionIndex,
|
|
12080
|
+
targetDrawPosition: winnerTargetDrawPosition
|
|
12081
|
+
} = getTargetMatchUp({
|
|
12082
|
+
drawDefinition,
|
|
12083
|
+
inContextDrawMatchUps,
|
|
12084
|
+
sourceRoundPosition,
|
|
12085
|
+
sourceRoundMatchUpCount,
|
|
12086
|
+
targetLink: winnerTargetLink
|
|
12087
|
+
}));
|
|
12082
12088
|
}
|
|
12083
12089
|
|
|
12084
12090
|
if (!winnerMatchUp) {
|
|
12085
12091
|
// if there is no winnerTargetLink then find targetMatchUp in next round
|
|
12086
12092
|
structureMatchUps = structureMatchUps || inContextDrawMatchUps.filter(matchUp => matchUp.structureId === structure.structureId);
|
|
12087
|
-
|
|
12088
|
-
if (getDevContext({
|
|
12089
|
-
qualifying: true
|
|
12090
|
-
})) {
|
|
12091
|
-
console.log('no winner matcnUp', {
|
|
12092
|
-
structureMatchUps
|
|
12093
|
-
});
|
|
12094
|
-
}
|
|
12095
|
-
|
|
12096
12093
|
({
|
|
12097
12094
|
matchUp: winnerMatchUp
|
|
12098
12095
|
} = nextRoundMatchUp({
|
|
@@ -12368,7 +12365,7 @@ function getNextToBePlayedMatchUp({
|
|
|
12368
12365
|
|
|
12369
12366
|
function getUpcomingInfo({
|
|
12370
12367
|
upcomingMatchUp
|
|
12371
|
-
}) {
|
|
12368
|
+
} = {}) {
|
|
12372
12369
|
if (!upcomingMatchUp) return;
|
|
12373
12370
|
return (({
|
|
12374
12371
|
matchUpId,
|
|
@@ -14813,7 +14810,7 @@ const POLICY_POSITION_ACTIONS_DEFAULT = {
|
|
|
14813
14810
|
// stages: [] => applies to all stages
|
|
14814
14811
|
stageSequences: [],
|
|
14815
14812
|
// stageSequences: [] => applies to all stageSequences
|
|
14816
|
-
enabledActions: [
|
|
14813
|
+
enabledActions: [ADD_NICKNAME, ADD_PENALTY, QUALIFYING_PARTICIPANT, SEED_VALUE],
|
|
14817
14814
|
disabledActions: [] // disabledActions: [] => no actions are disabled
|
|
14818
14815
|
|
|
14819
14816
|
}],
|
|
@@ -15436,7 +15433,7 @@ function getMatchUpFormatMap({
|
|
|
15436
15433
|
}
|
|
15437
15434
|
const baseAttributeKeys = ['collectionId', 'collectionPosition', 'drawPositions', 'extensions', 'finishingPositionRange', 'finishingRound', 'isMock', 'matchUpId', 'matchUpStatus', 'matchUpStatusCodes', 'orderOfFinish', 'processCodes', 'roundNumber', 'tieFormat', 'tieMatchUps', 'roundPosition', 'score', 'sides', // can be removed only if drawPositions is present and is not a TEAM matchUp
|
|
15438
15435
|
'winnerMatchUpId', 'loserMatchUpId', 'matchUpDuration', 'winningSide'];
|
|
15439
|
-
function removeExtraneousAttributes(matchUps, matchUpFormatMap) {
|
|
15436
|
+
function removeExtraneousAttributes(matchUps, matchUpFormatMap = {}) {
|
|
15440
15437
|
for (const matchUp of matchUps) {
|
|
15441
15438
|
const {
|
|
15442
15439
|
structureId,
|
|
@@ -17737,7 +17734,7 @@ function tournamentRelevantSchedulingIds({
|
|
|
17737
17734
|
tournamentRecord = {},
|
|
17738
17735
|
tournamentMap = {},
|
|
17739
17736
|
requireCourts
|
|
17740
|
-
}) {
|
|
17737
|
+
} = {}) {
|
|
17741
17738
|
const drawIds = [];
|
|
17742
17739
|
const eventIds = [];
|
|
17743
17740
|
const structureIds = [];
|
|
@@ -17805,7 +17802,7 @@ function tournamentRelevantSchedulingIds({
|
|
|
17805
17802
|
}
|
|
17806
17803
|
function getAllRelevantSchedulingIds({
|
|
17807
17804
|
tournamentRecords = {}
|
|
17808
|
-
}) {
|
|
17805
|
+
} = {}) {
|
|
17809
17806
|
const records = tournamentRecords && Object.values(tournamentRecords) || [];
|
|
17810
17807
|
const tournamentsMap = {};
|
|
17811
17808
|
const {
|
|
@@ -19245,10 +19242,17 @@ function removeDrawPosition({
|
|
|
19245
19242
|
}
|
|
19246
19243
|
}
|
|
19247
19244
|
|
|
19248
|
-
if (winnerMatchUp && winnerMatchUp.structureId !== targetData.matchUp.structureId
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19245
|
+
if (winnerMatchUp && winnerMatchUp.structureId !== targetData.matchUp.structureId && // does not apply to traversals that are based on QUALIFYING
|
|
19246
|
+
winnerTargetLink.target.feedProfile !== DRAW) {
|
|
19247
|
+
const {
|
|
19248
|
+
structure
|
|
19249
|
+
} = findStructure({
|
|
19250
|
+
drawDefinition,
|
|
19251
|
+
structureId: targetData.matchUp.structureId
|
|
19252
|
+
});
|
|
19253
|
+
if (structure.structureType !== QUALIFYING) console.log('linked structure winnerMatchUp removal', {
|
|
19254
|
+
winnerMatchUpDrawPositionIndex,
|
|
19255
|
+
winnerTargetLink
|
|
19252
19256
|
});
|
|
19253
19257
|
}
|
|
19254
19258
|
}
|
|
@@ -20246,7 +20250,7 @@ function assignDrawPositionBye$1({
|
|
|
20246
20250
|
structureId
|
|
20247
20251
|
});
|
|
20248
20252
|
const currentAssignment = positionAssignments.find(assignment => assignment.drawPosition === drawPosition);
|
|
20249
|
-
if (currentAssignment.bye) return { ...SUCCESS
|
|
20253
|
+
if (currentAssignment !== null && currentAssignment !== void 0 && currentAssignment.bye) return { ...SUCCESS
|
|
20250
20254
|
}; // ################### Check error conditions ######################
|
|
20251
20255
|
|
|
20252
20256
|
const drawPositionIsActive = activeDrawPositions === null || activeDrawPositions === void 0 ? void 0 : activeDrawPositions.includes(drawPosition);
|
|
@@ -22380,6 +22384,7 @@ function assignSeed({
|
|
|
22380
22384
|
seedValue,
|
|
22381
22385
|
eventId
|
|
22382
22386
|
}) {
|
|
22387
|
+
const stack = 'assignSeed';
|
|
22383
22388
|
const {
|
|
22384
22389
|
structure
|
|
22385
22390
|
} = findStructure({
|
|
@@ -22402,11 +22407,15 @@ function assignSeed({
|
|
|
22402
22407
|
drawDefinition,
|
|
22403
22408
|
participantId
|
|
22404
22409
|
});
|
|
22405
|
-
if (participantId && !validParticipantId) return {
|
|
22406
|
-
|
|
22407
|
-
|
|
22408
|
-
|
|
22409
|
-
|
|
22410
|
+
if (participantId && !validParticipantId) return decorateResult({
|
|
22411
|
+
result: {
|
|
22412
|
+
error: INVALID_PARTICIPANT_ID
|
|
22413
|
+
},
|
|
22414
|
+
context: {
|
|
22415
|
+
participantId
|
|
22416
|
+
},
|
|
22417
|
+
stack
|
|
22418
|
+
});
|
|
22410
22419
|
const relevantAssignment = positionAssignments.find(assignment => assignment.participantId === participantId);
|
|
22411
22420
|
const assignedDrawPosition = relevantAssignment === null || relevantAssignment === void 0 ? void 0 : relevantAssignment.drawPosition;
|
|
22412
22421
|
|
|
@@ -22417,9 +22426,16 @@ function assignSeed({
|
|
|
22417
22426
|
structureId,
|
|
22418
22427
|
seedNumber
|
|
22419
22428
|
});
|
|
22420
|
-
if (!positionIsValid) return {
|
|
22421
|
-
|
|
22422
|
-
|
|
22429
|
+
if (!positionIsValid) return decorateResult({
|
|
22430
|
+
result: {
|
|
22431
|
+
error: INVALID_DRAW_POSITION_FOR_SEEDING
|
|
22432
|
+
},
|
|
22433
|
+
context: {
|
|
22434
|
+
assignedDrawPosition
|
|
22435
|
+
},
|
|
22436
|
+
info: 'invalid seed position',
|
|
22437
|
+
stack
|
|
22438
|
+
});
|
|
22423
22439
|
}
|
|
22424
22440
|
|
|
22425
22441
|
if (!seedNumbers.includes(seedNumber)) {
|
|
@@ -22457,9 +22473,12 @@ function assignSeed({
|
|
|
22457
22473
|
};
|
|
22458
22474
|
}
|
|
22459
22475
|
|
|
22460
|
-
return {
|
|
22461
|
-
|
|
22462
|
-
|
|
22476
|
+
return decorateResult({
|
|
22477
|
+
result: {
|
|
22478
|
+
error: INVALID_SEED_NUMBER
|
|
22479
|
+
},
|
|
22480
|
+
stack
|
|
22481
|
+
});
|
|
22463
22482
|
}
|
|
22464
22483
|
|
|
22465
22484
|
function getTargetMatchUps({
|
|
@@ -22556,6 +22575,7 @@ function assignDrawPosition$1({
|
|
|
22556
22575
|
structureId,
|
|
22557
22576
|
event
|
|
22558
22577
|
}) {
|
|
22578
|
+
const stack = 'assignDrawPosition';
|
|
22559
22579
|
if (!participantId && !isQualifierPosition) return {
|
|
22560
22580
|
error: MISSING_PARTICIPANT_ID
|
|
22561
22581
|
};
|
|
@@ -22574,23 +22594,27 @@ function assignDrawPosition$1({
|
|
|
22574
22594
|
}));
|
|
22575
22595
|
}
|
|
22576
22596
|
|
|
22577
|
-
const {
|
|
22578
|
-
structure,
|
|
22579
|
-
error
|
|
22580
|
-
} = findStructure({
|
|
22597
|
+
const result = findStructure({
|
|
22581
22598
|
drawDefinition,
|
|
22582
22599
|
structureId
|
|
22583
22600
|
});
|
|
22584
|
-
if (error) return {
|
|
22585
|
-
|
|
22586
|
-
|
|
22601
|
+
if (result.error) return decorateResult({
|
|
22602
|
+
result,
|
|
22603
|
+
stack
|
|
22604
|
+
});
|
|
22605
|
+
const {
|
|
22606
|
+
structure
|
|
22607
|
+
} = result; // there are no drawPositions assigned for ADHOC structures
|
|
22587
22608
|
|
|
22588
22609
|
if (isAdHoc({
|
|
22589
22610
|
drawDefinition,
|
|
22590
22611
|
structure
|
|
22591
|
-
})) return {
|
|
22592
|
-
|
|
22593
|
-
|
|
22612
|
+
})) return decorateResult({
|
|
22613
|
+
result: {
|
|
22614
|
+
error: INVALID_MATCHUP
|
|
22615
|
+
},
|
|
22616
|
+
stack
|
|
22617
|
+
});
|
|
22594
22618
|
const {
|
|
22595
22619
|
seedAssignments
|
|
22596
22620
|
} = getStructureSeedAssignments({
|
|
@@ -22607,9 +22631,15 @@ function assignDrawPosition$1({
|
|
|
22607
22631
|
drawPosition,
|
|
22608
22632
|
structureId
|
|
22609
22633
|
});
|
|
22610
|
-
if (!isValidDrawPosition) return {
|
|
22611
|
-
|
|
22612
|
-
|
|
22634
|
+
if (!isValidDrawPosition) return decorateResult({
|
|
22635
|
+
result: {
|
|
22636
|
+
error: INVALID_DRAW_POSITION_FOR_SEEDING
|
|
22637
|
+
},
|
|
22638
|
+
context: {
|
|
22639
|
+
drawPosition
|
|
22640
|
+
},
|
|
22641
|
+
stack
|
|
22642
|
+
});
|
|
22613
22643
|
}
|
|
22614
22644
|
|
|
22615
22645
|
const {
|
|
@@ -22618,15 +22648,27 @@ function assignDrawPosition$1({
|
|
|
22618
22648
|
structure
|
|
22619
22649
|
});
|
|
22620
22650
|
const positionAssignment = positionAssignments.find(assignment => assignment.drawPosition === drawPosition);
|
|
22621
|
-
if (!positionAssignment) return {
|
|
22622
|
-
|
|
22623
|
-
|
|
22651
|
+
if (!positionAssignment) return decorateResult({
|
|
22652
|
+
result: {
|
|
22653
|
+
error: INVALID_DRAW_POSITION
|
|
22654
|
+
},
|
|
22655
|
+
context: {
|
|
22656
|
+
drawPosition
|
|
22657
|
+
},
|
|
22658
|
+
stack
|
|
22659
|
+
});
|
|
22624
22660
|
const participantAlreadyAssigned = positionAssignments.map(getParticipantId).includes(participantId);
|
|
22625
22661
|
|
|
22626
22662
|
if (participantAlreadyAssigned) {
|
|
22627
|
-
return {
|
|
22628
|
-
|
|
22629
|
-
|
|
22663
|
+
return decorateResult({
|
|
22664
|
+
result: {
|
|
22665
|
+
error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT
|
|
22666
|
+
},
|
|
22667
|
+
context: {
|
|
22668
|
+
drawPosition
|
|
22669
|
+
},
|
|
22670
|
+
stack
|
|
22671
|
+
});
|
|
22630
22672
|
}
|
|
22631
22673
|
|
|
22632
22674
|
const {
|
|
@@ -22644,7 +22686,10 @@ function assignDrawPosition$1({
|
|
|
22644
22686
|
matchUpsMap,
|
|
22645
22687
|
event
|
|
22646
22688
|
});
|
|
22647
|
-
if (result.error) return
|
|
22689
|
+
if (result.error) return decorateResult({
|
|
22690
|
+
result,
|
|
22691
|
+
stack
|
|
22692
|
+
});
|
|
22648
22693
|
}
|
|
22649
22694
|
|
|
22650
22695
|
if (containsParticipant && positionAssignment.participantId !== participantId) {
|
|
@@ -22657,9 +22702,12 @@ function assignDrawPosition$1({
|
|
|
22657
22702
|
const drawPositionIsActive = activeDrawPositions.includes(drawPosition);
|
|
22658
22703
|
|
|
22659
22704
|
if (drawPositionIsActive) {
|
|
22660
|
-
return {
|
|
22661
|
-
|
|
22662
|
-
|
|
22705
|
+
return decorateResult({
|
|
22706
|
+
result: {
|
|
22707
|
+
error: DRAW_POSITION_ACTIVE
|
|
22708
|
+
},
|
|
22709
|
+
stack
|
|
22710
|
+
});
|
|
22663
22711
|
} // cleanup side[].lineUps of previous participantId in TEAM matchUps
|
|
22664
22712
|
|
|
22665
22713
|
|
|
@@ -22831,7 +22879,13 @@ function addDrawPositionToMatchUps({
|
|
|
22831
22879
|
drawPosition,
|
|
22832
22880
|
matchUpsMap
|
|
22833
22881
|
});
|
|
22834
|
-
if (result.error) return
|
|
22882
|
+
if (result.error) return decorateResult({
|
|
22883
|
+
stack: 'assignDrawPositionToMatchUps',
|
|
22884
|
+
context: {
|
|
22885
|
+
drawPosition
|
|
22886
|
+
},
|
|
22887
|
+
result
|
|
22888
|
+
});
|
|
22835
22889
|
}
|
|
22836
22890
|
}
|
|
22837
22891
|
|
|
@@ -23018,6 +23072,7 @@ function directLoser(params) {
|
|
|
23018
23072
|
matchUpsMap,
|
|
23019
23073
|
event
|
|
23020
23074
|
} = params;
|
|
23075
|
+
const stack = 'directLoser';
|
|
23021
23076
|
const loserLinkCondition = loserTargetLink.linkCondition;
|
|
23022
23077
|
const targetMatchUpDrawPositions = loserMatchUp.drawPositions || [];
|
|
23023
23078
|
const fedDrawPositionFMLC = loserLinkCondition === FIRST_MATCHUP && loserMatchUp.roundNumber === 2 && Math.min(...targetMatchUpDrawPositions.filter(Boolean));
|
|
@@ -23074,7 +23129,8 @@ function directLoser(params) {
|
|
|
23074
23129
|
const loserAlreadyDirected = targetMatchUpPositionAssignments.some(assignment => assignment.participantId === loserParticipantId);
|
|
23075
23130
|
|
|
23076
23131
|
if (loserAlreadyDirected) {
|
|
23077
|
-
return SUCCESS
|
|
23132
|
+
return { ...SUCCESS
|
|
23133
|
+
};
|
|
23078
23134
|
}
|
|
23079
23135
|
|
|
23080
23136
|
const unfilledTargetMatchUpDrawPositions = targetMatchUpPositionAssignments.filter(assignment => {
|
|
@@ -23088,10 +23144,16 @@ function directLoser(params) {
|
|
|
23088
23144
|
|
|
23089
23145
|
if (fedDrawPositionFMLC) {
|
|
23090
23146
|
const result = loserLinkFedFMLC();
|
|
23091
|
-
if (result.error) return
|
|
23147
|
+
if (result.error) return decorateResult({
|
|
23148
|
+
result,
|
|
23149
|
+
stack
|
|
23150
|
+
});
|
|
23092
23151
|
} else if (isFirstRoundValidDrawPosition) {
|
|
23093
23152
|
const result = asssignLoserDrawPosition();
|
|
23094
|
-
if (result.error) return
|
|
23153
|
+
if (result.error) return decorateResult({
|
|
23154
|
+
result,
|
|
23155
|
+
stack
|
|
23156
|
+
});
|
|
23095
23157
|
} else if (isFeedRound) {
|
|
23096
23158
|
// if target.roundNumber > 1 then it is a feed round and should always take the lower drawPosition
|
|
23097
23159
|
const fedDrawPosition = unfilledTargetMatchUpDrawPositions.sort(numericSort)[0];
|
|
@@ -23105,11 +23167,20 @@ function directLoser(params) {
|
|
|
23105
23167
|
drawDefinition,
|
|
23106
23168
|
matchUpsMap
|
|
23107
23169
|
});
|
|
23108
|
-
if (result.error) return
|
|
23170
|
+
if (result.error) return decorateResult({
|
|
23171
|
+
result,
|
|
23172
|
+
stack
|
|
23173
|
+
});
|
|
23109
23174
|
} else {
|
|
23110
|
-
return {
|
|
23111
|
-
|
|
23112
|
-
|
|
23175
|
+
return decorateResult({
|
|
23176
|
+
result: {
|
|
23177
|
+
error: INVALID_DRAW_POSITION
|
|
23178
|
+
},
|
|
23179
|
+
context: {
|
|
23180
|
+
loserDrawPosition
|
|
23181
|
+
},
|
|
23182
|
+
stack
|
|
23183
|
+
});
|
|
23113
23184
|
}
|
|
23114
23185
|
|
|
23115
23186
|
if (structure !== null && structure !== void 0 && structure.seedAssignments && structure.structureId !== targetStructureId) {
|
|
@@ -23177,24 +23248,36 @@ function directLoser(params) {
|
|
|
23177
23248
|
};
|
|
23178
23249
|
|
|
23179
23250
|
function loserLinkFedFMLC() {
|
|
23251
|
+
const stack = 'loserLinkFedFMLC';
|
|
23252
|
+
|
|
23180
23253
|
if (validForConsolation) {
|
|
23181
|
-
return
|
|
23254
|
+
return decorateResult({
|
|
23255
|
+
result: asssignLoserDrawPosition(),
|
|
23256
|
+
stack
|
|
23257
|
+
});
|
|
23182
23258
|
} else {
|
|
23183
|
-
return
|
|
23259
|
+
return decorateResult({
|
|
23260
|
+
result: assignWinnerPositionBye(),
|
|
23261
|
+
stack
|
|
23262
|
+
});
|
|
23184
23263
|
}
|
|
23185
23264
|
}
|
|
23186
23265
|
|
|
23187
23266
|
function assignWinnerPositionBye() {
|
|
23188
|
-
|
|
23267
|
+
const result = assignDrawPositionBye$1({
|
|
23189
23268
|
drawPosition: winnerBackdrawPosition,
|
|
23190
23269
|
structureId: targetStructureId,
|
|
23191
23270
|
tournamentRecord,
|
|
23192
23271
|
drawDefinition
|
|
23193
23272
|
});
|
|
23273
|
+
return decorateResult({
|
|
23274
|
+
result,
|
|
23275
|
+
stack: 'assignWinnerPositionBye'
|
|
23276
|
+
});
|
|
23194
23277
|
}
|
|
23195
23278
|
|
|
23196
23279
|
function asssignLoserDrawPosition() {
|
|
23197
|
-
|
|
23280
|
+
const result = assignDrawPosition$1({
|
|
23198
23281
|
drawPosition: targetMatchUpDrawPosition,
|
|
23199
23282
|
participantId: loserParticipantId,
|
|
23200
23283
|
structureId: targetStructureId,
|
|
@@ -23204,6 +23287,10 @@ function directLoser(params) {
|
|
|
23204
23287
|
drawDefinition,
|
|
23205
23288
|
matchUpsMap
|
|
23206
23289
|
});
|
|
23290
|
+
return decorateResult({
|
|
23291
|
+
result,
|
|
23292
|
+
stack: 'assignLoserDrawPosition'
|
|
23293
|
+
});
|
|
23207
23294
|
}
|
|
23208
23295
|
}
|
|
23209
23296
|
|
|
@@ -23227,6 +23314,7 @@ function directParticipants(params) {
|
|
|
23227
23314
|
event,
|
|
23228
23315
|
score
|
|
23229
23316
|
} = params;
|
|
23317
|
+
const stack = 'directParticipants';
|
|
23230
23318
|
const isCollectionMatchUp = Boolean(matchUp.collectionId);
|
|
23231
23319
|
const isAdHocMatchUp = isAdHoc({
|
|
23232
23320
|
drawDefinition,
|
|
@@ -23338,7 +23426,10 @@ function directParticipants(params) {
|
|
|
23338
23426
|
dualMatchUp,
|
|
23339
23427
|
event
|
|
23340
23428
|
});
|
|
23341
|
-
if (result.error) return
|
|
23429
|
+
if (result.error) return decorateResult({
|
|
23430
|
+
result,
|
|
23431
|
+
stack
|
|
23432
|
+
});
|
|
23342
23433
|
}
|
|
23343
23434
|
} else {
|
|
23344
23435
|
return {
|
|
@@ -23368,6 +23459,7 @@ function drawPositionsAssignedParticipantIds({
|
|
|
23368
23459
|
}
|
|
23369
23460
|
|
|
23370
23461
|
function attemptToSetWinningSide(params) {
|
|
23462
|
+
const stack = 'attemptToSetWinningSide';
|
|
23371
23463
|
const {
|
|
23372
23464
|
drawDefinition,
|
|
23373
23465
|
winningSide,
|
|
@@ -23401,7 +23493,10 @@ function attemptToSetWinningSide(params) {
|
|
|
23401
23493
|
}
|
|
23402
23494
|
|
|
23403
23495
|
const result = directParticipants(params);
|
|
23404
|
-
if (result.error) return
|
|
23496
|
+
if (result.error) return decorateResult({
|
|
23497
|
+
result,
|
|
23498
|
+
stack
|
|
23499
|
+
});
|
|
23405
23500
|
return { ...SUCCESS,
|
|
23406
23501
|
connectedStructures
|
|
23407
23502
|
};
|
|
@@ -23582,7 +23677,7 @@ function noDownstreamDependencies(params) {
|
|
|
23582
23677
|
|
|
23583
23678
|
const removeDirected = ({
|
|
23584
23679
|
removeScore
|
|
23585
|
-
}) => {
|
|
23680
|
+
} = {}) => {
|
|
23586
23681
|
let connectedStructures;
|
|
23587
23682
|
const {
|
|
23588
23683
|
structure,
|
|
@@ -23619,7 +23714,7 @@ function noDownstreamDependencies(params) {
|
|
|
23619
23714
|
return scoreModification(params);
|
|
23620
23715
|
}
|
|
23621
23716
|
|
|
23622
|
-
|
|
23717
|
+
const result = winningSide && attemptToSetWinningSide(params) || scoreWithNoWinningSide && removeDirected({
|
|
23623
23718
|
removeScore
|
|
23624
23719
|
}) || statusNotTBP && attemptToSetMatchUpStatus(params) || removeWinningSide && removeDirected({
|
|
23625
23720
|
removeScore
|
|
@@ -23627,6 +23722,10 @@ function noDownstreamDependencies(params) {
|
|
|
23627
23722
|
removeScore: true
|
|
23628
23723
|
}) || console.log('unknown condition') && { ...SUCCESS
|
|
23629
23724
|
};
|
|
23725
|
+
return decorateResult({
|
|
23726
|
+
result,
|
|
23727
|
+
stack: 'noDownStreamDependencies'
|
|
23728
|
+
});
|
|
23630
23729
|
}
|
|
23631
23730
|
|
|
23632
23731
|
function scoreModification(params) {
|
|
@@ -23667,6 +23766,7 @@ function scoreModification(params) {
|
|
|
23667
23766
|
function isActiveDownstream(params) {
|
|
23668
23767
|
var _targetData$matchUp, _winnerMatchUp$drawPo;
|
|
23669
23768
|
|
|
23769
|
+
// relevantLink is passed in iterative calls (see below)
|
|
23670
23770
|
const {
|
|
23671
23771
|
inContextDrawMatchUps,
|
|
23672
23772
|
targetData,
|
|
@@ -23682,11 +23782,6 @@ function isActiveDownstream(params) {
|
|
|
23682
23782
|
},
|
|
23683
23783
|
targetLinks
|
|
23684
23784
|
} = targetData;
|
|
23685
|
-
if (getDevContext({
|
|
23686
|
-
qualifying: true
|
|
23687
|
-
})) console.log({
|
|
23688
|
-
targetData
|
|
23689
|
-
});
|
|
23690
23785
|
const loserMatchUpWalkover = [WALKOVER$2].includes(loserMatchUp === null || loserMatchUp === void 0 ? void 0 : loserMatchUp.matchUpStatus);
|
|
23691
23786
|
const winnerDrawPositionsCount = (winnerMatchUp === null || winnerMatchUp === void 0 ? void 0 : (_winnerMatchUp$drawPo = winnerMatchUp.drawPositions) === null || _winnerMatchUp$drawPo === void 0 ? void 0 : _winnerMatchUp$drawPo.filter(Boolean).length) || 0;
|
|
23692
23787
|
|
|
@@ -23844,7 +23939,8 @@ function swapWinnerLoser(params) {
|
|
|
23844
23939
|
function setMatchUpStatus$2(params) {
|
|
23845
23940
|
var _inContextMatchUp$dra, _matchUp$sides;
|
|
23846
23941
|
|
|
23847
|
-
// always clear score if DOUBLE_WALKOVER or WALKOVER
|
|
23942
|
+
const stack = 'setMatchUpStatus'; // always clear score if DOUBLE_WALKOVER or WALKOVER
|
|
23943
|
+
|
|
23848
23944
|
if ([WALKOVER$2, DOUBLE_WALKOVER].includes(params.matchUpStatus)) params.score = undefined; // matchUpStatus in params is the new status
|
|
23849
23945
|
// winningSide in params is new winningSide
|
|
23850
23946
|
|
|
@@ -23892,13 +23988,17 @@ function setMatchUpStatus$2(params) {
|
|
|
23892
23988
|
winnerMatchUpId,
|
|
23893
23989
|
loserMatchUpId
|
|
23894
23990
|
}) => winnerMatchUpId || loserMatchUpId);
|
|
23895
|
-
|
|
23896
|
-
|
|
23897
|
-
|
|
23898
|
-
|
|
23899
|
-
|
|
23900
|
-
|
|
23901
|
-
|
|
23991
|
+
|
|
23992
|
+
if (!hasGoesTo) {
|
|
23993
|
+
({
|
|
23994
|
+
inContextDrawMatchUps
|
|
23995
|
+
} = addGoesTo({
|
|
23996
|
+
inContextDrawMatchUps,
|
|
23997
|
+
drawDefinition,
|
|
23998
|
+
matchUpsMap
|
|
23999
|
+
}));
|
|
24000
|
+
} // Find target matchUp ------------------------------------------------------
|
|
24001
|
+
|
|
23902
24002
|
|
|
23903
24003
|
const matchUp = matchUpsMap.drawMatchUps.find(matchUp => matchUp.matchUpId === matchUpId);
|
|
23904
24004
|
const inContextMatchUp = inContextDrawMatchUps.find(matchUp => matchUp.matchUpId === matchUpId);
|
|
@@ -23929,9 +24029,6 @@ function setMatchUpStatus$2(params) {
|
|
|
23929
24029
|
const targetData = positionTargets({
|
|
23930
24030
|
matchUpId: matchUpTieId || matchUpId,
|
|
23931
24031
|
// get targets for TEAM matchUp if tieMatchUp
|
|
23932
|
-
useTargetMatchUpIds: getDevContext({
|
|
23933
|
-
useTargetMatchUpIds: true
|
|
23934
|
-
}),
|
|
23935
24032
|
inContextDrawMatchUps,
|
|
23936
24033
|
drawDefinition
|
|
23937
24034
|
});
|
|
@@ -24068,7 +24165,10 @@ function setMatchUpStatus$2(params) {
|
|
|
24068
24165
|
const result = !activeDownstream && noDownstreamDependencies(params) || matchUpWinner && winningSideWithDownstreamDependencies(params) || directingMatchUpStatus && applyMatchUpValues(params) || {
|
|
24069
24166
|
error: NO_VALID_ACTIONS
|
|
24070
24167
|
};
|
|
24071
|
-
return
|
|
24168
|
+
return decorateResult({
|
|
24169
|
+
result,
|
|
24170
|
+
stack
|
|
24171
|
+
});
|
|
24072
24172
|
}
|
|
24073
24173
|
|
|
24074
24174
|
function winningSideWithDownstreamDependencies(params) {
|
|
@@ -24670,7 +24770,7 @@ function deletionMessage({
|
|
|
24670
24770
|
function validTimePeriod({
|
|
24671
24771
|
startTime,
|
|
24672
24772
|
endTime
|
|
24673
|
-
}) {
|
|
24773
|
+
} = {}) {
|
|
24674
24774
|
if (!timeValidation.test(startTime) || !timeValidation.test(endTime)) return false;
|
|
24675
24775
|
const [startHour, startMinute] = startTime.split(':');
|
|
24676
24776
|
const [endHour, endMinute] = endTime.split(':');
|
|
@@ -40504,7 +40604,7 @@ function getAssignedParticipantIds({
|
|
|
40504
40604
|
|
|
40505
40605
|
function refreshEntryPositions({
|
|
40506
40606
|
entries = []
|
|
40507
|
-
}) {
|
|
40607
|
+
} = {}) {
|
|
40508
40608
|
const stagedEntries = entries.filter(Boolean).reduce((stages, entry) => {
|
|
40509
40609
|
const {
|
|
40510
40610
|
entryStage,
|
|
@@ -45066,7 +45166,7 @@ function newDrawDefinition({
|
|
|
45066
45166
|
drawId = UUID(),
|
|
45067
45167
|
matchUpType,
|
|
45068
45168
|
drawType
|
|
45069
|
-
}) {
|
|
45169
|
+
} = {}) {
|
|
45070
45170
|
const drawDefinition = definitionTemplate();
|
|
45071
45171
|
return Object.assign(drawDefinition, {
|
|
45072
45172
|
drawId,
|
|
@@ -45388,7 +45488,7 @@ function getState$1({
|
|
|
45388
45488
|
convertExtensions,
|
|
45389
45489
|
removeExtensions,
|
|
45390
45490
|
tournamentId
|
|
45391
|
-
}) {
|
|
45491
|
+
} = {}) {
|
|
45392
45492
|
if (typeof tournamentId !== 'string') return {};
|
|
45393
45493
|
const tournamentRecord = getTournamentRecord(tournamentId);
|
|
45394
45494
|
return {
|
|
@@ -46251,7 +46351,7 @@ function getState({
|
|
|
46251
46351
|
convertExtensions,
|
|
46252
46352
|
removeExtensions,
|
|
46253
46353
|
tournamentId
|
|
46254
|
-
}) {
|
|
46354
|
+
} = {}) {
|
|
46255
46355
|
if (typeof tournamentId !== 'string') return {};
|
|
46256
46356
|
const tournamentRecord = getTournamentRecord(tournamentId);
|
|
46257
46357
|
return {
|
|
@@ -56846,7 +56946,7 @@ function generatePersons({
|
|
|
56846
56946
|
count = 1,
|
|
56847
56947
|
category,
|
|
56848
56948
|
sex
|
|
56849
|
-
}) {
|
|
56949
|
+
} = {}) {
|
|
56850
56950
|
if (isNaN(count)) return {
|
|
56851
56951
|
error: INVALID_VALUES
|
|
56852
56952
|
};
|
|
@@ -57027,7 +57127,7 @@ var namesData = [
|
|
|
57027
57127
|
function nameMocks({
|
|
57028
57128
|
nameRoot = 'TEAM',
|
|
57029
57129
|
count = 1
|
|
57030
|
-
}) {
|
|
57130
|
+
} = {}) {
|
|
57031
57131
|
const shuffledTeamNames = shuffleArray(namesData);
|
|
57032
57132
|
const names = shuffledTeamNames.slice(0, count);
|
|
57033
57133
|
|
|
@@ -57401,7 +57501,7 @@ var citiesData = [
|
|
|
57401
57501
|
function cityMocks({
|
|
57402
57502
|
count = 1,
|
|
57403
57503
|
participantsCount = 32
|
|
57404
|
-
}) {
|
|
57504
|
+
} = {}) {
|
|
57405
57505
|
const shuffledCities = shuffleArray(citiesData);
|
|
57406
57506
|
const candidateCities = shuffledCities.slice(0, count); // the following ensures that all of the generated items are used at least once
|
|
57407
57507
|
|
|
@@ -57413,7 +57513,7 @@ function cityMocks({
|
|
|
57413
57513
|
function stateMocks({
|
|
57414
57514
|
count = 1,
|
|
57415
57515
|
participantsCount = 32
|
|
57416
|
-
}) {
|
|
57516
|
+
} = {}) {
|
|
57417
57517
|
const shuffledStates = shuffleArray(statesData);
|
|
57418
57518
|
const candidateStates = shuffledStates.slice(0, count).map(state => Object.keys(state)).flat(); // the following ensures that all of the generated items are used at least once
|
|
57419
57519
|
|
|
@@ -57425,7 +57525,7 @@ function stateMocks({
|
|
|
57425
57525
|
function postalCodeMocks({
|
|
57426
57526
|
count = 1,
|
|
57427
57527
|
participantsCount = 32
|
|
57428
|
-
}) {
|
|
57528
|
+
} = {}) {
|
|
57429
57529
|
const candidatePostalCodes = generateRange(0, count).map(() => generateRange(0, 5).map(() => randomInt(0, 9)).join('')); // the following ensures that all of the generated items are used at least once
|
|
57430
57530
|
|
|
57431
57531
|
const postalCodes = generateRange(0, participantsCount).map(i => i < count ? candidatePostalCodes[i] : randomMember(candidatePostalCodes));
|
|
@@ -57457,7 +57557,7 @@ function anonymizeTournamentRecord({
|
|
|
57457
57557
|
|
|
57458
57558
|
return element === null || element === void 0 ? void 0 : (_element$extensions = element.extensions) === null || _element$extensions === void 0 ? void 0 : _element$extensions.filter(extension => extensionsToKeep.includes(extension.name));
|
|
57459
57559
|
} else {
|
|
57460
|
-
return element.extensions;
|
|
57560
|
+
return element === null || element === void 0 ? void 0 : element.extensions;
|
|
57461
57561
|
}
|
|
57462
57562
|
}; // create mapping from original element IDs to newly generated UUIDs
|
|
57463
57563
|
|
|
@@ -57709,7 +57809,7 @@ function anonymizeTournamentRecord({
|
|
|
57709
57809
|
delete generatedPerson.lastName;
|
|
57710
57810
|
generatedPerson.extensions = filterExtensions(person);
|
|
57711
57811
|
individualParticipant.person = generatedPerson;
|
|
57712
|
-
idMap[person.personId] = generatedPerson.personId;
|
|
57812
|
+
idMap[person === null || person === void 0 ? void 0 : person.personId] = generatedPerson.personId;
|
|
57713
57813
|
});
|
|
57714
57814
|
const pairParticipants = (tournamentRecord.participants || []).filter(({
|
|
57715
57815
|
participantType
|
|
@@ -60540,13 +60640,7 @@ function generateTournamentRecord({
|
|
|
60540
60640
|
let drawIndex = 0;
|
|
60541
60641
|
|
|
60542
60642
|
for (const drawProfile of drawProfiles) {
|
|
60543
|
-
|
|
60544
|
-
drawId,
|
|
60545
|
-
eventId,
|
|
60546
|
-
event,
|
|
60547
|
-
error,
|
|
60548
|
-
uniqueParticipantIds
|
|
60549
|
-
} = generateEventWithDraw({
|
|
60643
|
+
let result = generateEventWithDraw({
|
|
60550
60644
|
allUniqueParticipantIds,
|
|
60551
60645
|
matchUpStatusProfile,
|
|
60552
60646
|
participantsProfile,
|
|
@@ -60562,10 +60656,14 @@ function generateTournamentRecord({
|
|
|
60562
60656
|
goesTo,
|
|
60563
60657
|
uuids
|
|
60564
60658
|
});
|
|
60565
|
-
if (error) return
|
|
60566
|
-
|
|
60567
|
-
|
|
60568
|
-
|
|
60659
|
+
if (result.error) return result;
|
|
60660
|
+
const {
|
|
60661
|
+
drawId,
|
|
60662
|
+
eventId,
|
|
60663
|
+
event,
|
|
60664
|
+
uniqueParticipantIds
|
|
60665
|
+
} = result;
|
|
60666
|
+
result = addEvent({
|
|
60569
60667
|
suppressNotifications: false,
|
|
60570
60668
|
tournamentRecord,
|
|
60571
60669
|
event
|