tods-competition-factory 1.8.34 → 1.8.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge/generate.mjs +20 -5
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/index.mjs +84 -37
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +206 -139
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +3 -3
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.35';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -5628,14 +5628,14 @@ var ROUTINE = 'ROUTINE';
|
|
|
5628
5628
|
var DECISIVE = 'DECISIVE';
|
|
5629
5629
|
var WIN_RATIO$1 = 'winRatio';
|
|
5630
5630
|
|
|
5631
|
-
var _a$j, _b$
|
|
5631
|
+
var _a$j, _b$7;
|
|
5632
5632
|
var POLICY_COMPETITIVE_BANDS_DEFAULT = (_a$j = {},
|
|
5633
5633
|
_a$j[POLICY_TYPE_COMPETITIVE_BANDS] = {
|
|
5634
5634
|
policyName: 'Competitive Bands Default',
|
|
5635
|
-
profileBands: (_b$
|
|
5636
|
-
_b$
|
|
5637
|
-
_b$
|
|
5638
|
-
_b$
|
|
5635
|
+
profileBands: (_b$7 = {},
|
|
5636
|
+
_b$7[DECISIVE] = 20,
|
|
5637
|
+
_b$7[ROUTINE] = 50,
|
|
5638
|
+
_b$7),
|
|
5639
5639
|
},
|
|
5640
5640
|
_a$j);
|
|
5641
5641
|
|
|
@@ -7827,7 +7827,7 @@ function getMatchUpType(params) {
|
|
|
7827
7827
|
return { matchUpType: matchUpType };
|
|
7828
7828
|
}
|
|
7829
7829
|
|
|
7830
|
-
var _a$i, _b$
|
|
7830
|
+
var _a$i, _b$6, _c$1;
|
|
7831
7831
|
// stage types
|
|
7832
7832
|
var MAIN = 'MAIN';
|
|
7833
7833
|
var QUALIFYING = 'QUALIFYING';
|
|
@@ -7850,13 +7850,13 @@ var stageOrder$1 = (_a$i = {},
|
|
|
7850
7850
|
_a$i);
|
|
7851
7851
|
var FINISHING_POSITIONS = 'finishingPositions';
|
|
7852
7852
|
var AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
7853
|
-
var finishOrder = (_b$
|
|
7854
|
-
_b$
|
|
7855
|
-
_b$
|
|
7856
|
-
_b$
|
|
7857
|
-
_b$
|
|
7858
|
-
_b$
|
|
7859
|
-
_b$
|
|
7853
|
+
var finishOrder = (_b$6 = {},
|
|
7854
|
+
_b$6[MAIN] = 1,
|
|
7855
|
+
_b$6[PLAY_OFF] = 2,
|
|
7856
|
+
_b$6[CONSOLATION] = 3,
|
|
7857
|
+
_b$6[QUALIFYING] = 4,
|
|
7858
|
+
_b$6[VOLUNTARY_CONSOLATION] = 5,
|
|
7859
|
+
_b$6);
|
|
7860
7860
|
// for aggregateOrder { stage: MAIN, stageSequence: 1 } is always first
|
|
7861
7861
|
var aggregateOrder = (_c$1 = {},
|
|
7862
7862
|
_c$1[PLAY_OFF] = 1,
|
|
@@ -9318,7 +9318,7 @@ function isAdHoc(_a) {
|
|
|
9318
9318
|
!hasDrawPosition);
|
|
9319
9319
|
}
|
|
9320
9320
|
|
|
9321
|
-
var _a$h, _b$
|
|
9321
|
+
var _a$h, _b$5;
|
|
9322
9322
|
var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
9323
9323
|
_a$h[POLICY_TYPE_ROUND_NAMING] = {
|
|
9324
9324
|
policyName: 'Round Naming Default',
|
|
@@ -9345,12 +9345,12 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9345
9345
|
preFeedRound: 'Q',
|
|
9346
9346
|
preQualifying: 'P',
|
|
9347
9347
|
},
|
|
9348
|
-
stageConstants: (_b$
|
|
9349
|
-
_b$
|
|
9350
|
-
_b$
|
|
9351
|
-
_b$
|
|
9352
|
-
_b$
|
|
9353
|
-
_b$
|
|
9348
|
+
stageConstants: (_b$5 = {},
|
|
9349
|
+
_b$5[MAIN] = '',
|
|
9350
|
+
_b$5[PLAY_OFF] = 'P',
|
|
9351
|
+
_b$5[QUALIFYING] = 'Q',
|
|
9352
|
+
_b$5[CONSOLATION] = 'C',
|
|
9353
|
+
_b$5),
|
|
9354
9354
|
},
|
|
9355
9355
|
_a$h);
|
|
9356
9356
|
|
|
@@ -16851,7 +16851,7 @@ var POLICY_PRIVACY_DEFAULT = (_a$a = {},
|
|
|
16851
16851
|
},
|
|
16852
16852
|
_a$a);
|
|
16853
16853
|
|
|
16854
|
-
var _a$9, _b$
|
|
16854
|
+
var _a$9, _b$4, _c, _d, _e;
|
|
16855
16855
|
// categoryTypes
|
|
16856
16856
|
var ADULT = 'ADULT';
|
|
16857
16857
|
var JUNIOR = 'JUNIOR';
|
|
@@ -16863,7 +16863,7 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
|
|
|
16863
16863
|
_a$9[POLICY_TYPE_SCHEDULING] = {
|
|
16864
16864
|
defaultTimes: {
|
|
16865
16865
|
averageTimes: [{ categoryNames: [], minutes: { default: 90 } }],
|
|
16866
|
-
recoveryTimes: [{ minutes: (_b$
|
|
16866
|
+
recoveryTimes: [{ minutes: (_b$4 = {}, _b$4[DOUBLES$1] = 30, _b$4.default = 60, _b$4) }],
|
|
16867
16867
|
},
|
|
16868
16868
|
defaultDailyLimits: (_c = {},
|
|
16869
16869
|
_c[SINGLES$1] = 2,
|
|
@@ -17032,19 +17032,19 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
|
|
|
17032
17032
|
},
|
|
17033
17033
|
_a$9);
|
|
17034
17034
|
|
|
17035
|
-
var _a$8, _b$
|
|
17035
|
+
var _a$8, _b$3;
|
|
17036
17036
|
var POLICY_SCORING_USTA = (_a$8 = {},
|
|
17037
17037
|
_a$8[POLICY_TYPE_SCORING] = {
|
|
17038
17038
|
requireAllPositionsAssigned: false,
|
|
17039
|
-
stage: (_b$
|
|
17040
|
-
_b$
|
|
17039
|
+
stage: (_b$3 = {},
|
|
17040
|
+
_b$3[MAIN] = {
|
|
17041
17041
|
stageSequence: {
|
|
17042
17042
|
1: {
|
|
17043
17043
|
requireAllPositionsAssigned: true,
|
|
17044
17044
|
},
|
|
17045
17045
|
},
|
|
17046
17046
|
},
|
|
17047
|
-
_b$
|
|
17047
|
+
_b$3),
|
|
17048
17048
|
defaultMatchUpFormat: FORMAT_STANDARD,
|
|
17049
17049
|
matchUpFormats: [
|
|
17050
17050
|
{
|
|
@@ -17129,7 +17129,7 @@ var POLICY_SCORING_USTA = (_a$8 = {},
|
|
|
17129
17129
|
},
|
|
17130
17130
|
_a$8);
|
|
17131
17131
|
|
|
17132
|
-
var _a$7, _b$
|
|
17132
|
+
var _a$7, _b$2;
|
|
17133
17133
|
/**
|
|
17134
17134
|
* without a SCORING_POLICY which sets { requireAllPositionsAssigned: false }, all stage:MAIN, stageSequence:1 drawPositions must be assigned **BEFORE** scoring is enabled,
|
|
17135
17135
|
* scoring is enabled in consolation and compass/playoff structures when not all drawPositions have been filled
|
|
@@ -17141,15 +17141,15 @@ var POLICY_SCORING_DEFAULT = (_a$7 = {},
|
|
|
17141
17141
|
processCodes: {
|
|
17142
17142
|
incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
|
|
17143
17143
|
},
|
|
17144
|
-
stage: (_b$
|
|
17145
|
-
_b$
|
|
17144
|
+
stage: (_b$2 = {},
|
|
17145
|
+
_b$2[MAIN] = {
|
|
17146
17146
|
stageSequence: {
|
|
17147
17147
|
1: {
|
|
17148
17148
|
requireAllPositionsAssigned: true,
|
|
17149
17149
|
},
|
|
17150
17150
|
},
|
|
17151
17151
|
},
|
|
17152
|
-
_b$
|
|
17152
|
+
_b$2),
|
|
17153
17153
|
},
|
|
17154
17154
|
_a$7);
|
|
17155
17155
|
|
|
@@ -17172,13 +17172,19 @@ var POLICY_SEEDING_ITF = (_a$6 = {},
|
|
|
17172
17172
|
},
|
|
17173
17173
|
_a$6);
|
|
17174
17174
|
|
|
17175
|
-
var _a$5;
|
|
17175
|
+
var _a$5, _b$1;
|
|
17176
17176
|
var POLICY_SEEDING_USTA = (_a$5 = {},
|
|
17177
17177
|
_a$5[POLICY_TYPE_SEEDING] = {
|
|
17178
17178
|
validSeedPositions: { ignore: true },
|
|
17179
17179
|
duplicateSeedNumbers: true,
|
|
17180
17180
|
drawSizeProgression: true,
|
|
17181
|
-
seedingProfile: {
|
|
17181
|
+
seedingProfile: {
|
|
17182
|
+
drawTypes: (_b$1 = {},
|
|
17183
|
+
_b$1[ROUND_ROBIN_WITH_PLAYOFF] = { positioning: WATERFALL },
|
|
17184
|
+
_b$1[ROUND_ROBIN] = { positioning: WATERFALL },
|
|
17185
|
+
_b$1),
|
|
17186
|
+
positioning: SEPARATE,
|
|
17187
|
+
},
|
|
17182
17188
|
policyName: 'USTA SEEDING',
|
|
17183
17189
|
seedsCountThresholds: [
|
|
17184
17190
|
{ drawSize: 4, minimumParticipantCount: 3, seedsCount: 2 },
|
|
@@ -21675,6 +21681,23 @@ function tidyScore(params) {
|
|
|
21675
21681
|
};
|
|
21676
21682
|
}
|
|
21677
21683
|
|
|
21684
|
+
function capitalizeFirst(str) {
|
|
21685
|
+
return !isString(str)
|
|
21686
|
+
? str
|
|
21687
|
+
: str
|
|
21688
|
+
.split(' ')
|
|
21689
|
+
.map(function (name) {
|
|
21690
|
+
return name
|
|
21691
|
+
.split('')
|
|
21692
|
+
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
21693
|
+
.join('');
|
|
21694
|
+
})
|
|
21695
|
+
.join(' ');
|
|
21696
|
+
}
|
|
21697
|
+
function constantToString(str) {
|
|
21698
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
21699
|
+
}
|
|
21700
|
+
|
|
21678
21701
|
var FACTORY = extensionConstants.FACTORY;
|
|
21679
21702
|
function updateFactoryExtension(_a) {
|
|
21680
21703
|
var tournamentRecord = _a.tournamentRecord, value = _a.value;
|
|
@@ -25557,23 +25580,6 @@ function getNumericSeedValue(seedValue) {
|
|
|
25557
25580
|
return Infinity;
|
|
25558
25581
|
}
|
|
25559
25582
|
|
|
25560
|
-
function capitalizeFirst(str) {
|
|
25561
|
-
return !isString(str)
|
|
25562
|
-
? str
|
|
25563
|
-
: str
|
|
25564
|
-
.split(' ')
|
|
25565
|
-
.map(function (name) {
|
|
25566
|
-
return name
|
|
25567
|
-
.split('')
|
|
25568
|
-
.map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
|
|
25569
|
-
.join('');
|
|
25570
|
-
})
|
|
25571
|
-
.join(' ');
|
|
25572
|
-
}
|
|
25573
|
-
function constantToString(str) {
|
|
25574
|
-
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, ' '));
|
|
25575
|
-
}
|
|
25576
|
-
|
|
25577
25583
|
var structureTemplate = function (_a) {
|
|
25578
25584
|
var _b = _a.finishingPosition, finishingPosition = _b === void 0 ? ROUND_OUTCOME : _b, qualifyingRoundNumber = _a.qualifyingRoundNumber, structureAbbreviation = _a.structureAbbreviation, _c = _a.seedAssignments, seedAssignments = _c === void 0 ? [] : _c, _d = _a.stageSequence, stageSequence = _d === void 0 ? 1 : _d, structureOrder = _a.structureOrder, seedingProfile = _a.seedingProfile, matchUpFormat = _a.matchUpFormat, structureType = _a.structureType, structureName = _a.structureName, matchUpType = _a.matchUpType, _e = _a.matchUps, matchUps = _e === void 0 ? [] : _e, structureId = _a.structureId, roundOffset = _a.roundOffset, roundLimit = _a.roundLimit, stageOrder = _a.stageOrder, structures = _a.structures, stage = _a.stage;
|
|
25579
25585
|
var structure = {
|
|
@@ -49588,9 +49594,6 @@ function removeEventEntries(_a) {
|
|
|
49588
49594
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: participantIdsRemoved });
|
|
49589
49595
|
}
|
|
49590
49596
|
|
|
49591
|
-
/**
|
|
49592
|
-
* Add entries into an event; optionally add to specified drawDefinition/flightProfile, if possible.
|
|
49593
|
-
*/
|
|
49594
49597
|
function addEventEntries(params) {
|
|
49595
49598
|
var _a, _b, _c, _d, _e;
|
|
49596
49599
|
var _f = params.entryStatus, entryStatus = _f === void 0 ? DIRECT_ACCEPTANCE : _f, _g = params.autoEntryPositions, autoEntryPositions = _g === void 0 ? true : _g, _h = params.enforceGender, enforceGender = _h === void 0 ? true : _h, _j = params.participantIds, participantIds = _j === void 0 ? [] : _j, entryStageSequence = params.entryStageSequence, policyDefinitions = params.policyDefinitions, _k = params.entryStage, entryStage = _k === void 0 ? MAIN : _k, tournamentRecord = params.tournamentRecord, ignoreStageSpace = params.ignoreStageSpace, drawDefinition = params.drawDefinition, roundTarget = params.roundTarget, extensions = params.extensions, extension = params.extension, drawId = params.drawId, event = params.event;
|
|
@@ -49612,7 +49615,8 @@ function addEventEntries(params) {
|
|
|
49612
49615
|
var addedParticipantIdEntries = [];
|
|
49613
49616
|
var removedEntries = [];
|
|
49614
49617
|
if ((extensions &&
|
|
49615
|
-
(!Array.isArray(extensions) ||
|
|
49618
|
+
(!Array.isArray(extensions) ||
|
|
49619
|
+
!extensions.every(function (extension) { return isValidExtension({ extension: extension }); }))) ||
|
|
49616
49620
|
(extension && !isValidExtension({ extension: extension }))) {
|
|
49617
49621
|
return decorateResult({
|
|
49618
49622
|
context: definedAttributes({ extension: extension, extensions: extensions }),
|
|
@@ -49689,7 +49693,7 @@ function addEventEntries(params) {
|
|
|
49689
49693
|
if (entryStageSequence)
|
|
49690
49694
|
entry.entryStageSequence = entryStageSequence;
|
|
49691
49695
|
addedParticipantIdEntries.push(entry.participantId);
|
|
49692
|
-
event.entries.push(entry);
|
|
49696
|
+
event.entries && event.entries.push(entry);
|
|
49693
49697
|
}
|
|
49694
49698
|
});
|
|
49695
49699
|
if (drawId && !isUngrouped(entryStage)) {
|
|
@@ -49713,7 +49717,8 @@ function addEventEntries(params) {
|
|
|
49713
49717
|
}
|
|
49714
49718
|
}
|
|
49715
49719
|
// now remove any ungrouped participantIds which exist as part of added grouped participants
|
|
49716
|
-
if (
|
|
49720
|
+
if (event.eventType &&
|
|
49721
|
+
[TypeEnum.Doubles, TypeEnum.Team].includes(event.eventType)) {
|
|
49717
49722
|
var enteredParticipantIds_1 = (event.entries || []).map(function (entry) { return entry.participantId; });
|
|
49718
49723
|
var ungroupedIndividualParticipantIds = (event.entries || [])
|
|
49719
49724
|
.filter(function (entry) { return isUngrouped(entry.entryStatus); })
|
|
@@ -49722,6 +49727,7 @@ function addEventEntries(params) {
|
|
|
49722
49727
|
var groupedIndividualParticipantIds_1 = tournamentParticipants
|
|
49723
49728
|
.filter(function (participant) {
|
|
49724
49729
|
return enteredParticipantIds_1.includes(participant.participantId) &&
|
|
49730
|
+
participant.participantType &&
|
|
49725
49731
|
[PAIR, TEAM].includes(participant.participantType);
|
|
49726
49732
|
})
|
|
49727
49733
|
.map(function (participant) { return participant.individualParticipantIds; })
|
|
@@ -61080,7 +61086,7 @@ function getPositionAssignments(_a) {
|
|
|
61080
61086
|
function deleteDrawDefinitions(_a) {
|
|
61081
61087
|
var e_1, _b;
|
|
61082
61088
|
var _c, _d, _e;
|
|
61083
|
-
var _f = _a.autoPublish, autoPublish = _f === void 0 ? true : _f, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, _g = _a.drawIds, drawIds = _g === void 0 ? [] : _g, auditData = _a.auditData, eventId = _a.eventId, event = _a.event;
|
|
61089
|
+
var _f = _a.autoPublish, autoPublish = _f === void 0 ? true : _f, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, _g = _a.drawIds, drawIds = _g === void 0 ? [] : _g, auditData = _a.auditData, eventId = _a.eventId, event = _a.event, force = _a.force;
|
|
61084
61090
|
if (!tournamentRecord)
|
|
61085
61091
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61086
61092
|
var stack = 'deleteDrawDefinitions';
|
|
@@ -61123,21 +61129,31 @@ function deleteDrawDefinitions(_a) {
|
|
|
61123
61129
|
var participantId = _a.participantId, drawPosition = _a.drawPosition, qualifier = _a.qualifier, bye = _a.bye;
|
|
61124
61130
|
return ({ bye: bye, qualifier: qualifier, drawPosition: drawPosition, participantId: participantId });
|
|
61125
61131
|
};
|
|
61132
|
+
var drawIdsWithScoresPresent = [];
|
|
61126
61133
|
var filteredDrawDefinitions = event.drawDefinitions.filter(function (drawDefinition) {
|
|
61127
|
-
var _a, _b, _c, _d, _e, _f;
|
|
61134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
61128
61135
|
if (drawIds.includes(drawDefinition.drawId)) {
|
|
61136
|
+
var matchUps = (_b = (_a = allDrawMatchUps$1({ event: event, drawDefinition: drawDefinition })) === null || _a === void 0 ? void 0 : _a.matchUps) !== null && _b !== void 0 ? _b : [];
|
|
61137
|
+
var scoresPresent = matchUps.some(function (_a) {
|
|
61138
|
+
var score = _a.score;
|
|
61139
|
+
return scoreHasValue({ score: score });
|
|
61140
|
+
});
|
|
61141
|
+
if (scoresPresent && !force) {
|
|
61142
|
+
drawIdsWithScoresPresent.push(drawDefinition.drawId);
|
|
61143
|
+
return true;
|
|
61144
|
+
}
|
|
61129
61145
|
var drawId_1 = drawDefinition.drawId, drawType = drawDefinition.drawType, drawName = drawDefinition.drawName;
|
|
61130
|
-
var flight = (
|
|
61146
|
+
var flight = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _c === void 0 ? void 0 : _c.find(function (flight) { return flight.drawId === drawDefinition.drawId; });
|
|
61131
61147
|
if (flight) {
|
|
61132
|
-
flight.drawEntries = (
|
|
61148
|
+
flight.drawEntries = (_d = flight.drawEntries) === null || _d === void 0 ? void 0 : _d.filter(function (entry) {
|
|
61133
61149
|
return STRUCTURE_ENTERED_TYPES.includes(entry.entryStatus);
|
|
61134
61150
|
});
|
|
61135
61151
|
}
|
|
61136
|
-
var mainStructure = (
|
|
61152
|
+
var mainStructure = (_f = (_e = getDrawStructures({
|
|
61137
61153
|
stageSequence: 1,
|
|
61138
61154
|
drawDefinition: drawDefinition,
|
|
61139
61155
|
stage: MAIN,
|
|
61140
|
-
})) === null ||
|
|
61156
|
+
})) === null || _e === void 0 ? void 0 : _e.structures) === null || _f === void 0 ? void 0 : _f[0];
|
|
61141
61157
|
var pa = mainStructure
|
|
61142
61158
|
? getPositionAssignments({
|
|
61143
61159
|
structureId: mainStructure.structureId,
|
|
@@ -61145,11 +61161,11 @@ function deleteDrawDefinitions(_a) {
|
|
|
61145
61161
|
drawDefinition: drawDefinition,
|
|
61146
61162
|
})
|
|
61147
61163
|
: undefined;
|
|
61148
|
-
var positionAssignments = (
|
|
61149
|
-
var qualifyingStructures = (
|
|
61164
|
+
var positionAssignments = (_g = pa === null || pa === void 0 ? void 0 : pa.positionAssignments) === null || _g === void 0 ? void 0 : _g.map(positionAssignmentMap);
|
|
61165
|
+
var qualifyingStructures = (_h = getDrawStructures({
|
|
61150
61166
|
stage: QUALIFYING,
|
|
61151
61167
|
drawDefinition: drawDefinition,
|
|
61152
|
-
})) === null ||
|
|
61168
|
+
})) === null || _h === void 0 ? void 0 : _h.structures;
|
|
61153
61169
|
var qualifyingPositionAssignments = (qualifyingStructures === null || qualifyingStructures === void 0 ? void 0 : qualifyingStructures.length)
|
|
61154
61170
|
? qualifyingStructures.map(function (qualifyingStructure) {
|
|
61155
61171
|
var stageSequence = qualifyingStructure.stageSequence;
|
|
@@ -61181,7 +61197,6 @@ function deleteDrawDefinitions(_a) {
|
|
|
61181
61197
|
drawName: drawName,
|
|
61182
61198
|
drawId: drawId_1,
|
|
61183
61199
|
}));
|
|
61184
|
-
var matchUps = allDrawMatchUps$1({ event: event, drawDefinition: drawDefinition }).matchUps;
|
|
61185
61200
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (_a) {
|
|
61186
61201
|
var matchUpId = _a.matchUpId;
|
|
61187
61202
|
return matchUpIds.push(matchUpId);
|
|
@@ -61189,6 +61204,13 @@ function deleteDrawDefinitions(_a) {
|
|
|
61189
61204
|
}
|
|
61190
61205
|
return !drawIds.includes(drawDefinition.drawId);
|
|
61191
61206
|
});
|
|
61207
|
+
if (drawIdsWithScoresPresent.length && !force) {
|
|
61208
|
+
return decorateResult({
|
|
61209
|
+
context: { drawIdsWithScoresPresent: drawIdsWithScoresPresent },
|
|
61210
|
+
result: { error: SCORES_PRESENT },
|
|
61211
|
+
stack: stack,
|
|
61212
|
+
});
|
|
61213
|
+
}
|
|
61192
61214
|
event.drawDefinitions = filteredDrawDefinitions;
|
|
61193
61215
|
if (flightProfile) {
|
|
61194
61216
|
var extension = {
|
|
@@ -61397,30 +61419,63 @@ function assignDrawPosition(_a) {
|
|
|
61397
61419
|
}
|
|
61398
61420
|
|
|
61399
61421
|
function addEventEntryPairs(_a) {
|
|
61400
|
-
var _b;
|
|
61401
|
-
var
|
|
61422
|
+
var e_1, _b;
|
|
61423
|
+
var _c;
|
|
61424
|
+
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, _d = _a.entryStage, entryStage = _d === void 0 ? StageTypeEnum.Main : _d, _e = _a.entryStatus, entryStatus = _e === void 0 ? ALTERNATE : _e, _f = _a.participantIdPairs, participantIdPairs = _f === void 0 ? [] : _f, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, event = _a.event, uuids = _a.uuids;
|
|
61402
61425
|
if (!tournamentRecord)
|
|
61403
61426
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61404
61427
|
if (!event)
|
|
61405
61428
|
return { error: MISSING_EVENT };
|
|
61406
61429
|
if (event.eventType !== DOUBLES$1)
|
|
61407
61430
|
return { error: INVALID_EVENT_TYPE };
|
|
61408
|
-
var
|
|
61409
|
-
var
|
|
61410
|
-
|
|
61411
|
-
|
|
61412
|
-
|
|
61413
|
-
|
|
61414
|
-
|
|
61415
|
-
|
|
61431
|
+
var existingParticipantIdPairs = [];
|
|
61432
|
+
var genderMap = new Map();
|
|
61433
|
+
try {
|
|
61434
|
+
for (var _g = __values((_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
61435
|
+
var participant = _h.value;
|
|
61436
|
+
var participantType = participant.participantType, participantId = participant.participantId, person = participant.person, individualParticipantIds = participant.individualParticipantIds;
|
|
61437
|
+
if (participantType === INDIVIDUAL && (person === null || person === void 0 ? void 0 : person.sex)) {
|
|
61438
|
+
genderMap.set(participantId, person.sex);
|
|
61439
|
+
}
|
|
61440
|
+
else if (participantType === PAIR && individualParticipantIds) {
|
|
61441
|
+
existingParticipantIdPairs.push(individualParticipantIds);
|
|
61442
|
+
}
|
|
61443
|
+
}
|
|
61444
|
+
}
|
|
61445
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61446
|
+
finally {
|
|
61447
|
+
try {
|
|
61448
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
61449
|
+
}
|
|
61450
|
+
finally { if (e_1) throw e_1.error; }
|
|
61451
|
+
}
|
|
61416
61452
|
// ensure all participantIdPairs have two individual participantIds
|
|
61417
|
-
var invalidParticipantIdPairs = participantIdPairs.filter(function (pair) {
|
|
61453
|
+
var invalidParticipantIdPairs = participantIdPairs.filter(function (pair) {
|
|
61454
|
+
// invalid if not two participantIds
|
|
61455
|
+
if (pair.length !== 2)
|
|
61456
|
+
return true;
|
|
61457
|
+
// invalid if either participantId does not exist
|
|
61458
|
+
if (!genderMap.has(pair[0]) || !genderMap.has(pair[1]))
|
|
61459
|
+
return true;
|
|
61460
|
+
// NOT invalid if event.gender is ANY or no gender is specified
|
|
61461
|
+
if (!event.gender || event.gender === ANY)
|
|
61462
|
+
return false;
|
|
61463
|
+
var participantGenders = pair.map(function (id) { return genderMap.get(id); });
|
|
61464
|
+
// invalid if event.gender is MALE/FEMALE and both participants do not match
|
|
61465
|
+
var invalidParticiapntGenders = (event.gender === MALE &&
|
|
61466
|
+
(participantGenders[0] !== MALE || participantGenders[1] !== MALE)) ||
|
|
61467
|
+
(event.gender === FEMALE &&
|
|
61468
|
+
(participantGenders[0] !== FEMALE || participantGenders[1] !== FEMALE));
|
|
61469
|
+
// invalid if event.gender is MIXED and participant genders are not different
|
|
61470
|
+
if (event.gender === MIXED) {
|
|
61471
|
+
participantGenders.sort();
|
|
61472
|
+
if (participantGenders[0] !== FEMALE || participantGenders[1] !== MALE)
|
|
61473
|
+
invalidParticiapntGenders = true;
|
|
61474
|
+
}
|
|
61475
|
+
return invalidParticiapntGenders;
|
|
61476
|
+
});
|
|
61418
61477
|
if (invalidParticipantIdPairs.length)
|
|
61419
61478
|
return { error: INVALID_PARTICIPANT_IDS, invalidParticipantIdPairs: invalidParticipantIdPairs };
|
|
61420
|
-
// make an array of all existing PAIR participantIds
|
|
61421
|
-
var existingParticipantIdPairs = tournamentParticipants
|
|
61422
|
-
.filter(function (participant) { return participant.participantType === PAIR; })
|
|
61423
|
-
.map(function (participant) { return participant.individualParticipantIds; });
|
|
61424
61479
|
// create provisional participant objects
|
|
61425
61480
|
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
61426
61481
|
var _a;
|
|
@@ -64396,43 +64451,53 @@ function prepareStage(params) {
|
|
|
64396
64451
|
|
|
64397
64452
|
function generateDrawDefinition(params) {
|
|
64398
64453
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, _e, e_5, _f, e_6, _g, _h;
|
|
64399
|
-
var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
64454
|
+
var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
|
|
64400
64455
|
var stack = 'generateDrawDefinition';
|
|
64401
|
-
var
|
|
64402
|
-
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections,
|
|
64456
|
+
var _34 = params.considerEventEntries, considerEventEntries = _34 === void 0 ? true : _34, // in the absence of drawSize and drawEntries, look to event.entries
|
|
64457
|
+
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
|
|
64403
64458
|
var appliedPolicies = (_j = getAppliedPolicies({
|
|
64404
64459
|
tournamentRecord: tournamentRecord,
|
|
64405
64460
|
event: event,
|
|
64406
64461
|
}).appliedPolicies) !== null && _j !== void 0 ? _j : {};
|
|
64407
|
-
var
|
|
64462
|
+
var policyDefinitions = (_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {};
|
|
64463
|
+
var drawTypeCoercion = (_q = (_o = (_l = params.drawTypeCoercion) !== null && _l !== void 0 ? _l : (_m = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _m === void 0 ? void 0 : _m.drawTypeCoercion) !== null && _o !== void 0 ? _o : (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _p === void 0 ? void 0 : _p.drawTypeCoercion) !== null && _q !== void 0 ? _q : true;
|
|
64408
64464
|
var drawType = (drawTypeCoercion &&
|
|
64409
64465
|
params.drawSize === 2 &&
|
|
64410
64466
|
DrawTypeEnum.SingleElimination) ||
|
|
64411
64467
|
params.drawType ||
|
|
64412
64468
|
DrawTypeEnum.SingleElimination;
|
|
64469
|
+
var seedingPolicy = (_r = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_SEEDING]) !== null && _r !== void 0 ? _r : appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SEEDING];
|
|
64470
|
+
var seedingProfile = (_v = (_s = params.seedingProfile) !== null && _s !== void 0 ? _s : (_u = (_t = seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile) === null || _t === void 0 ? void 0 : _t.drawTypes) === null || _u === void 0 ? void 0 : _u[drawType]) !== null && _v !== void 0 ? _v : seedingPolicy === null || seedingPolicy === void 0 ? void 0 : seedingPolicy.seedingProfile;
|
|
64471
|
+
// extend policyDefinitions only if a seedingProfile was specified in params
|
|
64472
|
+
if (params.seedingProfile) {
|
|
64473
|
+
if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
64474
|
+
policyDefinitions[POLICY_TYPE_SEEDING] = __assign({}, POLICY_SEEDING_USTA[POLICY_TYPE_SEEDING]);
|
|
64475
|
+
}
|
|
64476
|
+
policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
|
|
64477
|
+
}
|
|
64413
64478
|
// get participants both for entry validation and for automated placement
|
|
64414
64479
|
// automated placement requires them to be "inContext" for avoidance policies to work
|
|
64415
|
-
var
|
|
64480
|
+
var _35 = getParticipants$1({
|
|
64416
64481
|
withIndividualParticipants: true,
|
|
64417
64482
|
tournamentRecord: tournamentRecord,
|
|
64418
|
-
}), participants =
|
|
64419
|
-
var enforceGender = (
|
|
64483
|
+
}), participants = _35.participants, participantMap = _35.participantMap;
|
|
64484
|
+
var enforceGender = (_z = (_w = params.enforceGender) !== null && _w !== void 0 ? _w : (_y = (_x = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _x === void 0 ? void 0 : _x.participants) === null || _y === void 0 ? void 0 : _y.enforceGender) !== null && _z !== void 0 ? _z : (_1 = (_0 = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _0 === void 0 ? void 0 : _0.participants) === null || _1 === void 0 ? void 0 : _1.enforceGender;
|
|
64420
64485
|
// if tournamentRecord is provided, and unless instructed to ignore valid types,
|
|
64421
64486
|
// check for restrictions on allowed drawTypes
|
|
64422
64487
|
var allowedDrawTypes = !ignoreAllowedDrawTypes &&
|
|
64423
64488
|
tournamentRecord &&
|
|
64424
64489
|
getAllowedDrawTypes({
|
|
64425
64490
|
tournamentRecord: tournamentRecord,
|
|
64426
|
-
categoryType: (
|
|
64427
|
-
categoryName: (
|
|
64491
|
+
categoryType: (_2 = event === null || event === void 0 ? void 0 : event.category) === null || _2 === void 0 ? void 0 : _2.categoryType,
|
|
64492
|
+
categoryName: (_3 = event === null || event === void 0 ? void 0 : event.category) === null || _3 === void 0 ? void 0 : _3.categoryName,
|
|
64428
64493
|
});
|
|
64429
64494
|
if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
|
|
64430
64495
|
return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
|
|
64431
64496
|
}
|
|
64432
|
-
var eventEntries = (
|
|
64497
|
+
var eventEntries = (_5 = (_4 = event === null || event === void 0 ? void 0 : event.entries) === null || _4 === void 0 ? void 0 : _4.filter(function (entry) {
|
|
64433
64498
|
return entry.entryStatus &&
|
|
64434
64499
|
__spreadArray(__spreadArray([], __read(STRUCTURE_ENTERED_TYPES), false), [QUALIFIER], false).includes(entry.entryStatus);
|
|
64435
|
-
})) !== null &&
|
|
64500
|
+
})) !== null && _5 !== void 0 ? _5 : [];
|
|
64436
64501
|
var consideredEntries = ((qualifyingOnly && []) ||
|
|
64437
64502
|
drawEntries ||
|
|
64438
64503
|
(considerEventEntries ? eventEntries : [])).filter(function (_a) {
|
|
@@ -64476,12 +64541,12 @@ function generateDrawDefinition(params) {
|
|
|
64476
64541
|
});
|
|
64477
64542
|
}
|
|
64478
64543
|
var seedsCount = typeof params.seedsCount !== 'number'
|
|
64479
|
-
? ensureInt((
|
|
64480
|
-
: (
|
|
64544
|
+
? ensureInt((_6 = params.seedsCount) !== null && _6 !== void 0 ? _6 : 0)
|
|
64545
|
+
: (_7 = params.seedsCount) !== null && _7 !== void 0 ? _7 : 0;
|
|
64481
64546
|
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
64482
|
-
var matchUpType = (
|
|
64547
|
+
var matchUpType = (_8 = params.matchUpType) !== null && _8 !== void 0 ? _8 : eventType;
|
|
64483
64548
|
var existingDrawDefinition = params.drawId
|
|
64484
|
-
? (
|
|
64549
|
+
? (_9 = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _9 === void 0 ? void 0 : _9.find(function (d) { return d.drawId === params.drawId; })
|
|
64485
64550
|
: undefined;
|
|
64486
64551
|
// drawDefinition cannot have both tieFormat and matchUpFormat
|
|
64487
64552
|
var tieFormat = params.tieFormat, matchUpFormat = params.matchUpFormat;
|
|
@@ -64489,16 +64554,16 @@ function generateDrawDefinition(params) {
|
|
|
64489
64554
|
if (matchUpType === TEAM$2 && eventType === TEAM$2) {
|
|
64490
64555
|
// if there is an existingDrawDefinition which has a tieFormat on MAIN structure
|
|
64491
64556
|
// use this tieFormat ONLY when no tieFormat is specified in params
|
|
64492
|
-
var existingMainTieFormat = (
|
|
64557
|
+
var existingMainTieFormat = (_11 = (_10 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _10 === void 0 ? void 0 : _10.find(function (_a) {
|
|
64493
64558
|
var stage = _a.stage;
|
|
64494
64559
|
return stage === MAIN;
|
|
64495
|
-
})) === null ||
|
|
64560
|
+
})) === null || _11 === void 0 ? void 0 : _11.tieFormat;
|
|
64496
64561
|
tieFormat =
|
|
64497
64562
|
tieFormat ||
|
|
64498
64563
|
existingMainTieFormat ||
|
|
64499
64564
|
// if tieFormatName is provided and it matches the name of the tieFormat attached to parent event...
|
|
64500
64565
|
(tieFormatName &&
|
|
64501
|
-
((
|
|
64566
|
+
((_12 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _12 === void 0 ? void 0 : _12.tieFormatName) === tieFormatName &&
|
|
64502
64567
|
event.tieFormat) ||
|
|
64503
64568
|
// if the tieFormatName is not found in the factory then will use default
|
|
64504
64569
|
(tieFormatName &&
|
|
@@ -64554,7 +64619,7 @@ function generateDrawDefinition(params) {
|
|
|
64554
64619
|
var result = checkTieFormat(tieFormat);
|
|
64555
64620
|
if (result.error)
|
|
64556
64621
|
return decorateResult({ result: result, stack: stack });
|
|
64557
|
-
drawDefinition.tieFormat = (
|
|
64622
|
+
drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
|
|
64558
64623
|
}
|
|
64559
64624
|
else if (matchUpFormat) {
|
|
64560
64625
|
var result = setMatchUpFormat$1({
|
|
@@ -64585,8 +64650,8 @@ function generateDrawDefinition(params) {
|
|
|
64585
64650
|
else {
|
|
64586
64651
|
var policiesToAttach = {};
|
|
64587
64652
|
try {
|
|
64588
|
-
for (var
|
|
64589
|
-
var key =
|
|
64653
|
+
for (var _36 = __values(Object.keys(policyDefinitions)), _37 = _36.next(); !_37.done; _37 = _36.next()) {
|
|
64654
|
+
var key = _37.value;
|
|
64590
64655
|
if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !==
|
|
64591
64656
|
JSON.stringify(policyDefinitions[key])) {
|
|
64592
64657
|
policiesToAttach[key] = policyDefinitions[key];
|
|
@@ -64596,7 +64661,7 @@ function generateDrawDefinition(params) {
|
|
|
64596
64661
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
64597
64662
|
finally {
|
|
64598
64663
|
try {
|
|
64599
|
-
if (
|
|
64664
|
+
if (_37 && !_37.done && (_a = _36.return)) _a.call(_36);
|
|
64600
64665
|
}
|
|
64601
64666
|
finally { if (e_1) throw e_1.error; }
|
|
64602
64667
|
}
|
|
@@ -64607,24 +64672,25 @@ function generateDrawDefinition(params) {
|
|
|
64607
64672
|
}
|
|
64608
64673
|
}
|
|
64609
64674
|
}
|
|
64610
|
-
if (!appliedPolicies[POLICY_TYPE_SEEDING]
|
|
64675
|
+
if (!appliedPolicies[POLICY_TYPE_SEEDING] &&
|
|
64676
|
+
!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
64611
64677
|
attachPolicies({ drawDefinition: drawDefinition, policyDefinitions: POLICY_SEEDING_USTA });
|
|
64612
64678
|
Object.assign(appliedPolicies, POLICY_SEEDING_USTA);
|
|
64613
64679
|
}
|
|
64614
64680
|
// find existing MAIN structureId if existingDrawDefinition
|
|
64615
|
-
var structureId = (
|
|
64681
|
+
var structureId = (_15 = (_14 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _14 === void 0 ? void 0 : _14.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _15 === void 0 ? void 0 : _15.structureId;
|
|
64616
64682
|
var entries = drawEntries !== null && drawEntries !== void 0 ? drawEntries : eventEntries;
|
|
64617
64683
|
var positioningReports = [];
|
|
64618
64684
|
var drawTypeResult;
|
|
64619
64685
|
var conflicts = [];
|
|
64620
64686
|
var generateQualifyingPlaceholder = params.qualifyingPlaceholder &&
|
|
64621
|
-
!((
|
|
64687
|
+
!((_16 = params.qualifyingProfiles) === null || _16 === void 0 ? void 0 : _16.length) &&
|
|
64622
64688
|
!existingDrawDefinition;
|
|
64623
64689
|
var existingQualifyingStructures = existingDrawDefinition
|
|
64624
|
-
? (
|
|
64690
|
+
? (_17 = existingDrawDefinition.structures) === null || _17 === void 0 ? void 0 : _17.filter(function (structure) { return structure.stage === QUALIFYING; })
|
|
64625
64691
|
: [];
|
|
64626
64692
|
var existingQualifyingPlaceholderStructureId = (existingQualifyingStructures === null || existingQualifyingStructures === void 0 ? void 0 : existingQualifyingStructures.length) === 1 &&
|
|
64627
|
-
!((
|
|
64693
|
+
!((_18 = existingQualifyingStructures[0].matchUps) === null || _18 === void 0 ? void 0 : _18.length) &&
|
|
64628
64694
|
existingQualifyingStructures[0].structureId;
|
|
64629
64695
|
if (existingQualifyingPlaceholderStructureId) {
|
|
64630
64696
|
var qualifyingProfiles = params.qualifyingProfiles;
|
|
@@ -64640,24 +64706,24 @@ function generateDrawDefinition(params) {
|
|
|
64640
64706
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.error) {
|
|
64641
64707
|
return qualifyingResult;
|
|
64642
64708
|
}
|
|
64643
|
-
drawDefinition.structures = (
|
|
64709
|
+
drawDefinition.structures = (_19 = drawDefinition.structures) === null || _19 === void 0 ? void 0 : _19.filter(function (_a) {
|
|
64644
64710
|
var structureId = _a.structureId;
|
|
64645
64711
|
return structureId !== existingQualifyingPlaceholderStructureId;
|
|
64646
64712
|
});
|
|
64647
|
-
drawDefinition.links = (
|
|
64713
|
+
drawDefinition.links = (_20 = drawDefinition.links) === null || _20 === void 0 ? void 0 : _20.filter(function (_a) {
|
|
64648
64714
|
var source = _a.source;
|
|
64649
64715
|
return source.structureId !== existingQualifyingPlaceholderStructureId;
|
|
64650
64716
|
});
|
|
64651
|
-
var
|
|
64717
|
+
var _38 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _38.qualifiersCount, qualifyingDrawPositionsCount = _38.qualifyingDrawPositionsCount, qualifyingDetails = _38.qualifyingDetails;
|
|
64652
64718
|
if (qualifyingDrawPositionsCount) {
|
|
64653
64719
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
|
|
64654
|
-
(
|
|
64720
|
+
(_21 = drawDefinition.structures) === null || _21 === void 0 ? void 0 : _21.push.apply(_21, __spreadArray([], __read(qualifyingResult.structures), false));
|
|
64655
64721
|
}
|
|
64656
64722
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.links) {
|
|
64657
|
-
(
|
|
64723
|
+
(_22 = drawDefinition.links) === null || _22 === void 0 ? void 0 : _22.push.apply(_22, __spreadArray([], __read(qualifyingResult.links), false));
|
|
64658
64724
|
}
|
|
64659
64725
|
}
|
|
64660
|
-
var mainStructure = (
|
|
64726
|
+
var mainStructure = (_23 = drawDefinition.structures) === null || _23 === void 0 ? void 0 : _23.find(function (_a) {
|
|
64661
64727
|
var stage = _a.stage, stageSequence = _a.stageSequence;
|
|
64662
64728
|
return stage === MAIN && stageSequence === 1;
|
|
64663
64729
|
});
|
|
@@ -64683,12 +64749,12 @@ function generateDrawDefinition(params) {
|
|
|
64683
64749
|
if (result.error)
|
|
64684
64750
|
return result;
|
|
64685
64751
|
try {
|
|
64686
|
-
for (var
|
|
64752
|
+
for (var _39 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
|
|
64687
64753
|
var entryStage = _a.entryStage;
|
|
64688
64754
|
return entryStage === StageTypeEnum.Qualifying;
|
|
64689
|
-
})),
|
|
64690
|
-
var entry =
|
|
64691
|
-
var entryData = __assign(__assign({}, entry), { entryStage: (
|
|
64755
|
+
})), _40 = _39.next(); !_40.done; _40 = _39.next()) {
|
|
64756
|
+
var entry = _40.value;
|
|
64757
|
+
var entryData = __assign(__assign({}, entry), { entryStage: (_24 = entry.entryStage) !== null && _24 !== void 0 ? _24 : StageTypeEnum.Main, drawDefinition: drawDefinition });
|
|
64692
64758
|
// ignore errors (EXITING_PARTICIPANT)
|
|
64693
64759
|
addDrawEntry(entryData);
|
|
64694
64760
|
}
|
|
@@ -64696,23 +64762,23 @@ function generateDrawDefinition(params) {
|
|
|
64696
64762
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64697
64763
|
finally {
|
|
64698
64764
|
try {
|
|
64699
|
-
if (
|
|
64765
|
+
if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
|
|
64700
64766
|
}
|
|
64701
64767
|
finally { if (e_2) throw e_2.error; }
|
|
64702
64768
|
}
|
|
64703
64769
|
try {
|
|
64704
|
-
for (var
|
|
64705
|
-
var qualifyingDetail =
|
|
64770
|
+
for (var _41 = __values(qualifyingDetails || []), _42 = _41.next(); !_42.done; _42 = _41.next()) {
|
|
64771
|
+
var qualifyingDetail = _42.value;
|
|
64706
64772
|
var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
|
|
64707
64773
|
var link = mainStructure &&
|
|
64708
|
-
((
|
|
64774
|
+
((_25 = generateQualifyingLink({
|
|
64709
64775
|
targetStructureId: mainStructure.structureId,
|
|
64710
64776
|
sourceStructureId: qualifyingStructureId,
|
|
64711
64777
|
sourceRoundNumber: qualifyingRoundNumber,
|
|
64712
64778
|
finishingPositions: finishingPositions,
|
|
64713
64779
|
targetEntryRound: targetEntryRound,
|
|
64714
64780
|
linkType: linkType,
|
|
64715
|
-
})) === null ||
|
|
64781
|
+
})) === null || _25 === void 0 ? void 0 : _25.link);
|
|
64716
64782
|
if (link === null || link === void 0 ? void 0 : link.error)
|
|
64717
64783
|
return link;
|
|
64718
64784
|
if (link) {
|
|
@@ -64725,7 +64791,7 @@ function generateDrawDefinition(params) {
|
|
|
64725
64791
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
64726
64792
|
finally {
|
|
64727
64793
|
try {
|
|
64728
|
-
if (
|
|
64794
|
+
if (_42 && !_42.done && (_c = _41.return)) _c.call(_41);
|
|
64729
64795
|
}
|
|
64730
64796
|
finally { if (e_3) throw e_3.error; }
|
|
64731
64797
|
}
|
|
@@ -64746,7 +64812,7 @@ function generateDrawDefinition(params) {
|
|
|
64746
64812
|
entry.entryStage &&
|
|
64747
64813
|
entry.entryStage !== StageTypeEnum.Main)
|
|
64748
64814
|
continue;
|
|
64749
|
-
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (
|
|
64815
|
+
var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_26 = entry.entryStage) !== null && _26 !== void 0 ? _26 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
|
|
64750
64816
|
var result = addDrawEntry(entryData);
|
|
64751
64817
|
if (drawEntries && result.error) {
|
|
64752
64818
|
// only report errors with drawEntries
|
|
@@ -64770,13 +64836,13 @@ function generateDrawDefinition(params) {
|
|
|
64770
64836
|
if (structureResult.error && !structureResult.conflicts) {
|
|
64771
64837
|
return structureResult;
|
|
64772
64838
|
}
|
|
64773
|
-
if ((
|
|
64839
|
+
if ((_27 = structureResult.positioningReport) === null || _27 === void 0 ? void 0 : _27.length)
|
|
64774
64840
|
positioningReports.push((_e = {}, _e[MAIN] = structureResult.positioningReport, _e));
|
|
64775
64841
|
structureId = structureResult.structureId;
|
|
64776
64842
|
if (structureResult.conflicts)
|
|
64777
64843
|
conflicts = structureResult.conflicts;
|
|
64778
64844
|
if (drawType === AD_HOC && params.roundsCount) {
|
|
64779
|
-
var entries_2 = (
|
|
64845
|
+
var entries_2 = (_28 = event === null || event === void 0 ? void 0 : event.entries) === null || _28 === void 0 ? void 0 : _28.filter(function (_a) {
|
|
64780
64846
|
var entryStage = _a.entryStage, entryStatus = _a.entryStatus;
|
|
64781
64847
|
return (!entryStage || entryStage === MAIN) &&
|
|
64782
64848
|
entryStatus &&
|
|
@@ -64823,8 +64889,8 @@ function generateDrawDefinition(params) {
|
|
|
64823
64889
|
var roundTarget = 1;
|
|
64824
64890
|
params.qualifyingProfiles.sort(roundTargetSort);
|
|
64825
64891
|
try {
|
|
64826
|
-
for (var
|
|
64827
|
-
var roundTargetProfile =
|
|
64892
|
+
for (var _43 = __values(params.qualifyingProfiles), _44 = _43.next(); !_44.done; _44 = _43.next()) {
|
|
64893
|
+
var roundTargetProfile = _44.value;
|
|
64828
64894
|
if (!Array.isArray(roundTargetProfile.structureProfiles))
|
|
64829
64895
|
return decorateResult({
|
|
64830
64896
|
info: mustBeAnArray('structureProfiles'),
|
|
@@ -64832,13 +64898,13 @@ function generateDrawDefinition(params) {
|
|
|
64832
64898
|
stack: stack,
|
|
64833
64899
|
});
|
|
64834
64900
|
roundTarget = roundTargetProfile.roundTarget || roundTarget;
|
|
64835
|
-
var sortedStructureProfiles = ((
|
|
64901
|
+
var sortedStructureProfiles = ((_29 = roundTargetProfile.structureProfiles) === null || _29 === void 0 ? void 0 : _29.sort(sequenceSort)) || [];
|
|
64836
64902
|
var sequence = 1;
|
|
64837
64903
|
try {
|
|
64838
64904
|
for (var sortedStructureProfiles_1 = (e_6 = void 0, __values(sortedStructureProfiles)), sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next(); !sortedStructureProfiles_1_1.done; sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next()) {
|
|
64839
64905
|
var structureProfile = sortedStructureProfiles_1_1.value;
|
|
64840
|
-
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName,
|
|
64841
|
-
var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (
|
|
64906
|
+
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _45 = structureProfile.seedsCount, seedsCount_1 = _45 === void 0 ? 0 : _45, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
|
|
64907
|
+
var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_30 = structureProfile.seedingProfile) !== null && _30 !== void 0 ? _30 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
|
|
64842
64908
|
if (qualifyingStageResult.error) {
|
|
64843
64909
|
return qualifyingStageResult;
|
|
64844
64910
|
}
|
|
@@ -64846,9 +64912,9 @@ function generateDrawDefinition(params) {
|
|
|
64846
64912
|
preparedStructureIds.push(qualifyingStageResult.structureId);
|
|
64847
64913
|
}
|
|
64848
64914
|
sequence += 1;
|
|
64849
|
-
if ((
|
|
64915
|
+
if ((_31 = qualifyingStageResult.conflicts) === null || _31 === void 0 ? void 0 : _31.length)
|
|
64850
64916
|
qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
|
|
64851
|
-
if ((
|
|
64917
|
+
if ((_32 = qualifyingStageResult.positioningReport) === null || _32 === void 0 ? void 0 : _32.length)
|
|
64852
64918
|
positioningReports.push((_h = {},
|
|
64853
64919
|
_h[QUALIFYING] = qualifyingStageResult.positioningReport,
|
|
64854
64920
|
_h));
|
|
@@ -64867,7 +64933,7 @@ function generateDrawDefinition(params) {
|
|
|
64867
64933
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
64868
64934
|
finally {
|
|
64869
64935
|
try {
|
|
64870
|
-
if (
|
|
64936
|
+
if (_44 && !_44.done && (_f = _43.return)) _f.call(_43);
|
|
64871
64937
|
}
|
|
64872
64938
|
finally { if (e_5) throw e_5.error; }
|
|
64873
64939
|
}
|
|
@@ -64891,7 +64957,7 @@ function generateDrawDefinition(params) {
|
|
|
64891
64957
|
drawDefinition.links.push(link);
|
|
64892
64958
|
}
|
|
64893
64959
|
drawDefinition.drawName =
|
|
64894
|
-
(
|
|
64960
|
+
(_33 = params.drawName) !== null && _33 !== void 0 ? _33 : (drawType && constantToString(drawType));
|
|
64895
64961
|
if (typeof voluntaryConsolation === 'object') {
|
|
64896
64962
|
addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
|
|
64897
64963
|
}
|
|
@@ -69788,8 +69854,8 @@ function generateFlight(_a) {
|
|
|
69788
69854
|
var result_1 = addEventEntries({
|
|
69789
69855
|
participantIds: drawParticipantIds,
|
|
69790
69856
|
autoEntryPositions: autoEntryPositions,
|
|
69857
|
+
entryStage: stage,
|
|
69791
69858
|
tournamentRecord: tournamentRecord,
|
|
69792
|
-
stage: stage,
|
|
69793
69859
|
event: event,
|
|
69794
69860
|
});
|
|
69795
69861
|
if (result_1.error)
|
|
@@ -69986,9 +70052,9 @@ function generateEventWithFlights(params) {
|
|
|
69986
70052
|
if (eventParticipantIds.length) {
|
|
69987
70053
|
var result = addEventEntries({
|
|
69988
70054
|
participantIds: eventParticipantIds,
|
|
70055
|
+
entryStage: StageTypeEnum.Main,
|
|
69989
70056
|
autoEntryPositions: autoEntryPositions,
|
|
69990
70057
|
tournamentRecord: tournamentRecord,
|
|
69991
|
-
stage: MAIN,
|
|
69992
70058
|
event: event,
|
|
69993
70059
|
});
|
|
69994
70060
|
if (result.error)
|
|
@@ -70214,7 +70280,7 @@ function generateEventWithDraw(params) {
|
|
|
70214
70280
|
var participantsCount_1 = drawSize_1 - (qualifyingPositions_1 || 0); // minus qualifyingPositions
|
|
70215
70281
|
var participantIds_1 = qualifyingParticipantIds.slice(qualifyingIndex, qualifyingIndex + participantsCount_1);
|
|
70216
70282
|
var result_5 = addEventEntries({
|
|
70217
|
-
entryStage:
|
|
70283
|
+
entryStage: StageTypeEnum.Qualifying,
|
|
70218
70284
|
entryStageSequence: entryStageSequence,
|
|
70219
70285
|
autoEntryPositions: autoEntryPositions,
|
|
70220
70286
|
tournamentRecord: tournamentRecord,
|
|
@@ -71181,6 +71247,7 @@ var utilities = {
|
|
|
71181
71247
|
categoryCanContain: categoryCanContain,
|
|
71182
71248
|
chunkArray: chunkArray,
|
|
71183
71249
|
compareTieFormats: compareTieFormats,
|
|
71250
|
+
constantToString: constantToString,
|
|
71184
71251
|
countValues: countValues,
|
|
71185
71252
|
createMap: createMap,
|
|
71186
71253
|
dateRange: dateRange,
|