tods-competition-factory 1.8.22 → 1.8.24
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/README.md +1 -1
- package/dist/forge/generate.mjs +58 -38
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +121 -26
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.d.ts +1 -1
- package/dist/forge/transform.mjs +31 -21
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +416 -330
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +772 -634
- 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 +2 -2
|
@@ -2905,7 +2905,7 @@ var matchUpFormatCode = {
|
|
|
2905
2905
|
};
|
|
2906
2906
|
|
|
2907
2907
|
function factoryVersion() {
|
|
2908
|
-
return '1.8.
|
|
2908
|
+
return '1.8.24';
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -4904,7 +4904,7 @@ function getTallyReport(_a) {
|
|
|
4904
4904
|
var readable = [];
|
|
4905
4905
|
if (Array.isArray(report)) {
|
|
4906
4906
|
report.forEach(function (step, i) {
|
|
4907
|
-
var _a;
|
|
4907
|
+
var _a, _b, _c;
|
|
4908
4908
|
if ((_a = step.excludedDirectives) === null || _a === void 0 ? void 0 : _a.length) {
|
|
4909
4909
|
var attributes = step.excludedDirectives
|
|
4910
4910
|
.map(function (_a) {
|
|
@@ -4921,20 +4921,24 @@ function getTallyReport(_a) {
|
|
|
4921
4921
|
var floatSort_1 = function (a, b) {
|
|
4922
4922
|
return parseFloat(step.reversed ? a : b) - parseFloat(step.reversed ? b : a);
|
|
4923
4923
|
};
|
|
4924
|
+
var participantsCount = step.groups
|
|
4925
|
+
? Object.values(step.groups).flat(Infinity).length
|
|
4926
|
+
: (_c = (_b = step.participantIds) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0;
|
|
4924
4927
|
var getExplanation = function (step) {
|
|
4925
|
-
|
|
4926
|
-
.
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4928
|
+
step.groups &&
|
|
4929
|
+
Object.keys(step.groups)
|
|
4930
|
+
.sort(floatSort_1)
|
|
4931
|
+
.forEach(function (key) {
|
|
4932
|
+
var participantNames = step.groups[key]
|
|
4933
|
+
.map(function (participantId) { return participants[participantId]; })
|
|
4934
|
+
.join(', ');
|
|
4935
|
+
var explanation = "".concat(key, " ").concat(step.attribute, ": ").concat(participantNames);
|
|
4936
|
+
readable.push(explanation);
|
|
4937
|
+
});
|
|
4934
4938
|
};
|
|
4935
4939
|
var reversed = step.reversed ? ' in reverse order' : '';
|
|
4936
|
-
var
|
|
4937
|
-
var description = "Step ".concat(i + 1, ": ").concat(participantsCount, " particiants were
|
|
4940
|
+
var action = step.groups ? 'grouped' : 'separated';
|
|
4941
|
+
var description = "Step ".concat(i + 1, ": ").concat(participantsCount, " particiants were ").concat(action).concat(reversed, " by ").concat(step.attribute);
|
|
4938
4942
|
readable.push(description);
|
|
4939
4943
|
if (step.idsFilter) {
|
|
4940
4944
|
var note = "".concat(step.attribute, " was calculated considering ONLY TIED PARTICIPANTS");
|
|
@@ -4949,7 +4953,7 @@ function getTallyReport(_a) {
|
|
|
4949
4953
|
order.forEach(function (orderEntry) {
|
|
4950
4954
|
var participantId = orderEntry.participantId, resolved = orderEntry.resolved;
|
|
4951
4955
|
var pOrder = orderEntry.groupOrder || orderEntry.provisionalOrder;
|
|
4952
|
-
readable.push("".concat(pOrder, ": ").concat(participants[participantId], " => resolved: ").concat(resolved));
|
|
4956
|
+
readable.push("".concat(pOrder, ": ").concat(participants[participantId], " => resolved: ").concat(!!resolved));
|
|
4953
4957
|
});
|
|
4954
4958
|
return readable.join('\r\n');
|
|
4955
4959
|
}
|
|
@@ -5073,7 +5077,7 @@ function getGroupOrder(params) {
|
|
|
5073
5077
|
.map(function (key) { return orderedTallyGroups[key]; })
|
|
5074
5078
|
.map(function (participantIds) {
|
|
5075
5079
|
var result = groupSubSort(__assign({ participantIds: participantIds }, params));
|
|
5076
|
-
report.push(result.report);
|
|
5080
|
+
report.push.apply(report, __spreadArray([], __read((result.report || [])), false));
|
|
5077
5081
|
return result.order;
|
|
5078
5082
|
})
|
|
5079
5083
|
.flat(Infinity);
|
|
@@ -5182,7 +5186,7 @@ function processAttribute(_a) {
|
|
|
5182
5186
|
tallyPolicy: tallyPolicy,
|
|
5183
5187
|
matchUps: matchUps,
|
|
5184
5188
|
});
|
|
5185
|
-
report.push(result.report);
|
|
5189
|
+
report.push.apply(report, __spreadArray([], __read((result.report || [])), false));
|
|
5186
5190
|
return result.order;
|
|
5187
5191
|
})
|
|
5188
5192
|
.flat(Infinity);
|
|
@@ -5191,6 +5195,9 @@ function processAttribute(_a) {
|
|
|
5191
5195
|
}
|
|
5192
5196
|
function groupSubSort(_a) {
|
|
5193
5197
|
var participantResults = _a.participantResults, disableHeadToHead = _a.disableHeadToHead, participantIds = _a.participantIds, matchUpFormat = _a.matchUpFormat, tallyPolicy = _a.tallyPolicy, matchUps = _a.matchUps;
|
|
5198
|
+
var excludedDirectives = [];
|
|
5199
|
+
var report = [];
|
|
5200
|
+
var result;
|
|
5194
5201
|
if ((participantIds === null || participantIds === void 0 ? void 0 : participantIds.length) === 1) {
|
|
5195
5202
|
var participantId = participantIds[0];
|
|
5196
5203
|
return {
|
|
@@ -5201,13 +5208,13 @@ function groupSubSort(_a) {
|
|
|
5201
5208
|
(!(tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.headToHead) ||
|
|
5202
5209
|
(!tallyPolicy.headToHead.disabled && !disableHeadToHead))) {
|
|
5203
5210
|
var result_1 = headToHeadWinner({ participantIds: participantIds, participantResults: participantResults });
|
|
5204
|
-
if (result_1)
|
|
5205
|
-
|
|
5211
|
+
if (result_1) {
|
|
5212
|
+
var headToHeadWinner_1 = result_1[0].participantId;
|
|
5213
|
+
report.push({ attribute: 'head2Head', participantIds: participantIds, headToHeadWinner: headToHeadWinner_1 });
|
|
5214
|
+
return { order: [result_1], headToHeadWinner: headToHeadWinner_1, report: report };
|
|
5215
|
+
}
|
|
5206
5216
|
}
|
|
5207
5217
|
var directives = (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.tallyDirectives) || headToHeadTallyDirectives;
|
|
5208
|
-
var excludedDirectives = [];
|
|
5209
|
-
var report = [];
|
|
5210
|
-
var result;
|
|
5211
5218
|
var filteredDirectives = directives.filter(function (directive) {
|
|
5212
5219
|
// if maxParticipants is defined, filter out the rule if # of participants is greater than maxParticipants
|
|
5213
5220
|
var keepDirective = isNumeric(directive.maxParticipants) &&
|
|
@@ -6007,11 +6014,12 @@ var scheduleConstants = {
|
|
|
6007
6014
|
};
|
|
6008
6015
|
|
|
6009
6016
|
function getMatchUpFormatTiming(_a) {
|
|
6010
|
-
var _b
|
|
6017
|
+
var _b;
|
|
6018
|
+
var _c = _a.defaultAverageMinutes, defaultAverageMinutes = _c === void 0 ? 90 : _c, _d = _a.defaultRecoveryMinutes, defaultRecoveryMinutes = _d === void 0 ? 0 : _d, tournamentRecord = _a.tournamentRecord, matchUpFormat = _a.matchUpFormat, categoryName = _a.categoryName, categoryType = _a.categoryType, eventType = _a.eventType, event = _a.event;
|
|
6011
6019
|
if (!tournamentRecord)
|
|
6012
6020
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
6013
6021
|
// event is optional, so eventType can also be passed in directly
|
|
6014
|
-
eventType = eventType
|
|
6022
|
+
eventType = (_b = eventType !== null && eventType !== void 0 ? eventType : event === null || event === void 0 ? void 0 : event.eventType) !== null && _b !== void 0 ? _b : TypeEnum.Singles;
|
|
6015
6023
|
var defaultTiming = {
|
|
6016
6024
|
averageTimes: [{ minutes: { default: defaultAverageMinutes } }],
|
|
6017
6025
|
recoveryTimes: [{ minutes: { default: defaultRecoveryMinutes } }],
|
|
@@ -6661,7 +6669,7 @@ function getVenuesAndCourts$1(_a) {
|
|
|
6661
6669
|
}
|
|
6662
6670
|
function findVenue(_a) {
|
|
6663
6671
|
var e_1, _b;
|
|
6664
|
-
var _c;
|
|
6672
|
+
var _c, _d;
|
|
6665
6673
|
var tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, venueId = _a.venueId;
|
|
6666
6674
|
if (!tournamentRecord)
|
|
6667
6675
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -6672,9 +6680,9 @@ function findVenue(_a) {
|
|
|
6672
6680
|
return venueRecord.venueId === venueId ? venueRecord : venue;
|
|
6673
6681
|
}, undefined);
|
|
6674
6682
|
if (!venue && tournamentRecords) {
|
|
6675
|
-
var linkedTournamentIds = getLinkedTournamentIds({
|
|
6683
|
+
var linkedTournamentIds = (_d = getLinkedTournamentIds({
|
|
6676
6684
|
tournamentRecords: tournamentRecords,
|
|
6677
|
-
}).linkedTournamentIds
|
|
6685
|
+
}).linkedTournamentIds) !== null && _d !== void 0 ? _d : [];
|
|
6678
6686
|
var relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
|
|
6679
6687
|
try {
|
|
6680
6688
|
// if there are linked tournaments search for court in all linked tournaments
|
|
@@ -7437,6 +7445,7 @@ var participantConstants = {
|
|
|
7437
7445
|
};
|
|
7438
7446
|
|
|
7439
7447
|
function getPairedParticipant(_a) {
|
|
7448
|
+
var _b;
|
|
7440
7449
|
var tournamentParticipants = _a.tournamentParticipants, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds;
|
|
7441
7450
|
var stack = 'getPairedParticipant';
|
|
7442
7451
|
if (!tournamentParticipants && !tournamentRecord)
|
|
@@ -7449,7 +7458,7 @@ function getPairedParticipant(_a) {
|
|
|
7449
7458
|
stack: stack,
|
|
7450
7459
|
});
|
|
7451
7460
|
tournamentParticipants =
|
|
7452
|
-
tournamentParticipants
|
|
7461
|
+
(_b = tournamentParticipants !== null && tournamentParticipants !== void 0 ? tournamentParticipants : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
7453
7462
|
var existingPairedParticipants = tournamentParticipants.filter(function (participant) {
|
|
7454
7463
|
return participant.participantType === PAIR &&
|
|
7455
7464
|
intersection(participantIds, participant.individualParticipantIds)
|
|
@@ -9239,6 +9248,7 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9239
9248
|
policyName: 'Round Naming Default',
|
|
9240
9249
|
namingConventions: {
|
|
9241
9250
|
round: 'Round',
|
|
9251
|
+
pre: 'Pre',
|
|
9242
9252
|
},
|
|
9243
9253
|
qualifyingFinishMap: {
|
|
9244
9254
|
1: 'Final',
|
|
@@ -9269,9 +9279,9 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9269
9279
|
_a$h);
|
|
9270
9280
|
|
|
9271
9281
|
function getRoundContextProfile(_a) {
|
|
9272
|
-
var _b, _c, _d, _e;
|
|
9282
|
+
var _b, _c, _d, _e, _f, _g;
|
|
9273
9283
|
var roundNamingPolicy = _a.roundNamingPolicy, drawDefinition = _a.drawDefinition, structure = _a.structure, matchUps = _a.matchUps;
|
|
9274
|
-
var
|
|
9284
|
+
var _h = getRoundMatchUps$1({ matchUps: matchUps }), roundProfile = _h.roundProfile, roundMatchUps = _h.roundMatchUps;
|
|
9275
9285
|
var structureAbbreviation = structure.structureAbbreviation, stage = structure.stage;
|
|
9276
9286
|
var isAdHocStructure = isAdHoc({ structure: structure });
|
|
9277
9287
|
var isLuckyStructure = isLucky({ structure: structure });
|
|
@@ -9279,10 +9289,6 @@ function getRoundContextProfile(_a) {
|
|
|
9279
9289
|
var roundNamingProfile = {};
|
|
9280
9290
|
var defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
|
|
9281
9291
|
var isQualifying = structure.stage === QUALIFYING;
|
|
9282
|
-
var qualifyingFinishgMap = isQualifying &&
|
|
9283
|
-
((roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.qualifyingFinishMap) ||
|
|
9284
|
-
(defaultRoundNamingPolicy === null || defaultRoundNamingPolicy === void 0 ? void 0 : defaultRoundNamingPolicy.qualifyingFinishMap) ||
|
|
9285
|
-
{});
|
|
9286
9292
|
var qualifyingStageSequences = isQualifying
|
|
9287
9293
|
? Math.max.apply(Math, __spreadArray(__spreadArray([], __read(((_b = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _b !== void 0 ? _b : [])
|
|
9288
9294
|
.filter(function (structure) { return structure.stage === QUALIFYING; })
|
|
@@ -9290,11 +9296,11 @@ function getRoundContextProfile(_a) {
|
|
|
9290
9296
|
var stageSequence = _a.stageSequence;
|
|
9291
9297
|
return stageSequence !== null && stageSequence !== void 0 ? stageSequence : 1;
|
|
9292
9298
|
})), false), [0], false)) : 0;
|
|
9293
|
-
var preQualifyingSequence = qualifyingStageSequences
|
|
9294
|
-
?
|
|
9299
|
+
var preQualifyingSequence = ((_c = structure.stageSequence) !== null && _c !== void 0 ? _c : 1) < qualifyingStageSequences
|
|
9300
|
+
? (_d = structure.stageSequence) !== null && _d !== void 0 ? _d : 1
|
|
9295
9301
|
: '';
|
|
9296
9302
|
var preQualifyingAffix = preQualifyingSequence
|
|
9297
|
-
? ((
|
|
9303
|
+
? ((_e = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _e === void 0 ? void 0 : _e.preQualifying) ||
|
|
9298
9304
|
defaultRoundNamingPolicy.affixes.preQualifying ||
|
|
9299
9305
|
''
|
|
9300
9306
|
: '';
|
|
@@ -9304,9 +9310,9 @@ function getRoundContextProfile(_a) {
|
|
|
9304
9310
|
var abbreviatedRoundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.abbreviatedRoundNamingMap) ||
|
|
9305
9311
|
defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
|
|
9306
9312
|
{};
|
|
9307
|
-
var preFeedAffix = ((
|
|
9313
|
+
var preFeedAffix = ((_f = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _f === void 0 ? void 0 : _f.preFeedRound) ||
|
|
9308
9314
|
defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
9309
|
-
var roundNumberAffix = ((
|
|
9315
|
+
var roundNumberAffix = ((_g = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _g === void 0 ? void 0 : _g.roundNumber) ||
|
|
9310
9316
|
defaultRoundNamingPolicy.affixes.roundNumber;
|
|
9311
9317
|
var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
|
|
9312
9318
|
defaultRoundNamingPolicy.namingConventions;
|
|
@@ -9329,14 +9335,18 @@ function getRoundContextProfile(_a) {
|
|
|
9329
9335
|
})), false));
|
|
9330
9336
|
}
|
|
9331
9337
|
else {
|
|
9338
|
+
var qualifyingFinishgMap_1 = isQualifying &&
|
|
9339
|
+
((roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.qualifyingFinishMap) ||
|
|
9340
|
+
(defaultRoundNamingPolicy === null || defaultRoundNamingPolicy === void 0 ? void 0 : defaultRoundNamingPolicy.qualifyingFinishMap) ||
|
|
9341
|
+
{});
|
|
9332
9342
|
Object.assign.apply(Object, __spreadArray([roundNamingProfile], __read(roundProfileKeys.map(function (round) {
|
|
9333
9343
|
var _a;
|
|
9334
9344
|
if (!(roundProfile === null || roundProfile === void 0 ? void 0 : roundProfile[round]))
|
|
9335
9345
|
return;
|
|
9336
9346
|
var _b = roundProfile[round], matchUpsCount = _b.matchUpsCount, preFeedRound = _b.preFeedRound;
|
|
9337
9347
|
var participantsCount = matchUpsCount * 2;
|
|
9338
|
-
var sizedRoundName = (
|
|
9339
|
-
(
|
|
9348
|
+
var sizedRoundName = (qualifyingFinishgMap_1 === null || qualifyingFinishgMap_1 === void 0 ? void 0 : qualifyingFinishgMap_1[roundProfile === null || roundProfile === void 0 ? void 0 : roundProfile[round].finishingRound]) ||
|
|
9349
|
+
(qualifyingFinishgMap_1 && "".concat(roundNumberAffix).concat(participantsCount)) ||
|
|
9340
9350
|
roundNamingMap[matchUpsCount] ||
|
|
9341
9351
|
"".concat(roundNumberAffix).concat(participantsCount);
|
|
9342
9352
|
var suffix = preFeedRound ? "-".concat(preFeedAffix) : '';
|
|
@@ -9625,7 +9635,13 @@ function getAllStructureMatchUps(_a) {
|
|
|
9625
9635
|
matchUps: matchUps,
|
|
9626
9636
|
}).collectionPositionMatchUps);
|
|
9627
9637
|
}
|
|
9628
|
-
return {
|
|
9638
|
+
return {
|
|
9639
|
+
collectionPositionMatchUps: collectionPositionMatchUps,
|
|
9640
|
+
roundMatchUps: roundMatchUps,
|
|
9641
|
+
roundProfile: roundProfile,
|
|
9642
|
+
matchUpsMap: matchUpsMap,
|
|
9643
|
+
matchUps: matchUps,
|
|
9644
|
+
};
|
|
9629
9645
|
function addMatchUpContext(_a) {
|
|
9630
9646
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
9631
9647
|
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, sourceDrawPositionRanges = _a.sourceDrawPositionRanges, drawPositionsRanges = _a.drawPositionsRanges, initialRoundOfPlay = _a.initialRoundOfPlay, additionalContext = _a.additionalContext, roundNamingProfile = _a.roundNamingProfile, tieDrawPositions = _a.tieDrawPositions, appliedPolicies = _a.appliedPolicies, isCollectionBye = _a.isCollectionBye, matchUpTieId = _a.matchUpTieId, isRoundRobin = _a.isRoundRobin, roundProfile = _a.roundProfile, sideLineUps = _a.sideLineUps, matchUp = _a.matchUp, event = _a.event;
|
|
@@ -11623,8 +11639,10 @@ function modifyMatchUpScore(_a) {
|
|
|
11623
11639
|
: undefined;
|
|
11624
11640
|
var matchUps = getAllStructureMatchUps({
|
|
11625
11641
|
afterRecoveryTimes: false,
|
|
11642
|
+
tournamentRecord: tournamentRecord,
|
|
11626
11643
|
inContext: true,
|
|
11627
11644
|
matchUpFilters: matchUpFilters,
|
|
11645
|
+
drawDefinition: drawDefinition,
|
|
11628
11646
|
structure: structure,
|
|
11629
11647
|
event: event,
|
|
11630
11648
|
}).matchUps;
|
|
@@ -19570,7 +19588,7 @@ function parseScoreString(_a) {
|
|
|
19570
19588
|
isSide1: winningSide === 2,
|
|
19571
19589
|
tiebreakTo: tiebreakTo,
|
|
19572
19590
|
});
|
|
19573
|
-
var setTiebreak = side1TiebreakPerspective
|
|
19591
|
+
var setTiebreak = side1TiebreakPerspective !== null && side1TiebreakPerspective !== void 0 ? side1TiebreakPerspective : [];
|
|
19574
19592
|
var _b = __read(setScores || [], 2), side1Score = _b[0], side2Score = _b[1];
|
|
19575
19593
|
var _c = __read(matchTiebreak || setTiebreak || [], 2), side1TiebreakScore = _c[0], side2TiebreakScore = _c[1];
|
|
19576
19594
|
return {
|
|
@@ -19739,7 +19757,9 @@ function getSuper(values, index) {
|
|
|
19739
19757
|
index ? values.slice(0, 1) : values.slice(2),
|
|
19740
19758
|
].map(function (n) { return parseInt(n.join('')); });
|
|
19741
19759
|
// preserve order
|
|
19742
|
-
|
|
19760
|
+
if (index)
|
|
19761
|
+
parts.reverse();
|
|
19762
|
+
var scores = parts;
|
|
19743
19763
|
var diff = Math.abs(scores.reduce(function (a, b) { return +a - +b; }));
|
|
19744
19764
|
if (diff >= 2)
|
|
19745
19765
|
return scores.join('-');
|
|
@@ -20880,7 +20900,6 @@ function handleNumeric(params) {
|
|
|
20880
20900
|
score = score.toString().toLowerCase();
|
|
20881
20901
|
if (allNumeric)
|
|
20882
20902
|
score = onlyNumbers.join('');
|
|
20883
|
-
// const numbers = score.split('').map((n) => parseInt(n));
|
|
20884
20903
|
var numbers = allNumeric
|
|
20885
20904
|
? onlyNumbers.map(function (n) { return parseInt(n); })
|
|
20886
20905
|
: score.split('').map(function (n) { return parseInt(n); });
|
|
@@ -20943,12 +20962,12 @@ function handleNumeric(params) {
|
|
|
20943
20962
|
getDiff(numbers.slice(2, 4)) === 1 &&
|
|
20944
20963
|
getDiff(numbers.slice(5, 7)) > 1) {
|
|
20945
20964
|
var _k = __read(numbers, 7), s1 = _k[0], s2 = _k[1], s3 = _k[2], s4 = _k[3], tb = _k[4], s5 = _k[5], s6 = _k[6];
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20965
|
+
/**
|
|
20966
|
+
if (tb === 1) {
|
|
20967
|
+
console.log('BOO');
|
|
20968
|
+
score = `${s1}-${s2} ${s3}-${s4} [${tb}${s5}-${s6}]`;
|
|
20969
|
+
applied.push('numericTiebreakPattern8');
|
|
20970
|
+
} else {
|
|
20952
20971
|
*/
|
|
20953
20972
|
score = "".concat(s1, "-").concat(s2, " ").concat(s3, "-").concat(s4, "(").concat(tb, ") ").concat(s5, "-").concat(s6);
|
|
20954
20973
|
applied.push('numericTiebreakPattern8');
|
|
@@ -21042,7 +21061,7 @@ function handleNumeric(params) {
|
|
|
21042
21061
|
if (superParse && score !== superParse) {
|
|
21043
21062
|
applied.push('parsedSuperPattern');
|
|
21044
21063
|
}
|
|
21045
|
-
score = superParse
|
|
21064
|
+
score = superParse !== null && superParse !== void 0 ? superParse : score;
|
|
21046
21065
|
}
|
|
21047
21066
|
}
|
|
21048
21067
|
return { score: score, applied: applied, matchUpStatus: matchUpStatus };
|
|
@@ -21081,6 +21100,7 @@ function sensibleSets(_a) {
|
|
|
21081
21100
|
var setsCount = sets.length;
|
|
21082
21101
|
score = sets
|
|
21083
21102
|
.map(function (set, index) {
|
|
21103
|
+
var _a;
|
|
21084
21104
|
if (new RegExp(tiebreakSet).test(set)) {
|
|
21085
21105
|
var tiebreak = set.slice(3);
|
|
21086
21106
|
var setScores = set.slice(0, 3);
|
|
@@ -21089,9 +21109,9 @@ function sensibleSets(_a) {
|
|
|
21089
21109
|
var maxSetScore = Math.max.apply(Math, __spreadArray([], __read(sideScores), false));
|
|
21090
21110
|
var maxIndex = setScores.indexOf(maxSetScore);
|
|
21091
21111
|
var sensibleSetScores = [maxSetScore, maxSetScore - 1];
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21112
|
+
if (maxIndex)
|
|
21113
|
+
sensibleSetScores.reverse();
|
|
21114
|
+
var sensibleSetScore = sensibleSetScores.join('-');
|
|
21095
21115
|
return sensibleSetScore + tiebreak;
|
|
21096
21116
|
}
|
|
21097
21117
|
}
|
|
@@ -21106,7 +21126,7 @@ function sensibleSets(_a) {
|
|
|
21106
21126
|
profile.push(setType);
|
|
21107
21127
|
// check for reasonable set scores in the first two sets
|
|
21108
21128
|
if (setsCount > 1 && setType === 'standard' && index < 2) {
|
|
21109
|
-
var
|
|
21129
|
+
var _b = __read(set.split('-'), 2), s1 = _b[0], s2 = _b[1];
|
|
21110
21130
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21111
21131
|
var max = Math.max(s1, s2);
|
|
21112
21132
|
var min_1 = Math.min(s1, s2);
|
|
@@ -21115,10 +21135,10 @@ function sensibleSets(_a) {
|
|
|
21115
21135
|
// coerce larger value to something reasonable
|
|
21116
21136
|
if (max > 9 && diff > 2) {
|
|
21117
21137
|
var splitMax = max.toString().split('');
|
|
21118
|
-
var reasonable = splitMax.find(function (value) {
|
|
21138
|
+
var reasonable = (_a = splitMax.find(function (value) {
|
|
21119
21139
|
return parseInt(value) > min_1 ||
|
|
21120
21140
|
(index && parseInt(value) <= maxSetValue);
|
|
21121
|
-
})
|
|
21141
|
+
})) !== null && _a !== void 0 ? _a : splitMax[0];
|
|
21122
21142
|
if (reasonable) {
|
|
21123
21143
|
set = minIndex
|
|
21124
21144
|
? [reasonable, min_1].join('-')
|
|
@@ -21130,7 +21150,7 @@ function sensibleSets(_a) {
|
|
|
21130
21150
|
}
|
|
21131
21151
|
// throw out any sets where the values are equal and there is no retirement
|
|
21132
21152
|
if (setType === 'standard') {
|
|
21133
|
-
var
|
|
21153
|
+
var _c = __read(set.split('-'), 2), s1 = _c[0], s2 = _c[1];
|
|
21134
21154
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21135
21155
|
if (!diff && matchUpStatus !== 'RETIRED') {
|
|
21136
21156
|
return '';
|
|
@@ -21690,7 +21710,6 @@ function getVenuesAndCourts(_a) {
|
|
|
21690
21710
|
try {
|
|
21691
21711
|
for (var _c = __values(tournamentRecord.venues || []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
21692
21712
|
var venue = _d.value;
|
|
21693
|
-
tournamentRecord.venues;
|
|
21694
21713
|
if (venueIds.length && !venueIds.includes(venue.venueId))
|
|
21695
21714
|
continue;
|
|
21696
21715
|
if (ignoreDisabled) {
|
|
@@ -23127,7 +23146,7 @@ function getContainedStructures(_a) {
|
|
|
23127
23146
|
.flat()
|
|
23128
23147
|
.filter(Boolean);
|
|
23129
23148
|
var _loop_1 = function (structureContainer) {
|
|
23130
|
-
var _c = structureContainer
|
|
23149
|
+
var _c = structureContainer !== null && structureContainer !== void 0 ? structureContainer : {}, structures = _c.structures, structureId = _c.structureId;
|
|
23131
23150
|
structures &&
|
|
23132
23151
|
structureId &&
|
|
23133
23152
|
(containedStructures[structureId] = structures === null || structures === void 0 ? void 0 : structures.map(function (structure) { return structure.structureId; })) &&
|
|
@@ -25317,7 +25336,7 @@ function allPlayoffPositionsFilled(params) {
|
|
|
25317
25336
|
participantIdsCount++;
|
|
25318
25337
|
return (assignment === null || assignment === void 0 ? void 0 : assignment.bye) || (assignment === null || assignment === void 0 ? void 0 : assignment.participantId);
|
|
25319
25338
|
}).length;
|
|
25320
|
-
return structurePositionsFilled && allFilled;
|
|
25339
|
+
return !!(structurePositionsFilled && allFilled);
|
|
25321
25340
|
}, !!playoffStructures.length);
|
|
25322
25341
|
// account for playoffStructure with only one participant
|
|
25323
25342
|
var allParticipantIdsPlaced = participantIdsCount === enteredParticipantsCount;
|
|
@@ -30200,10 +30219,11 @@ function filterParticipants(_a) {
|
|
|
30200
30219
|
var participantIds_1 = tournamentEvents
|
|
30201
30220
|
.filter(function (event) { return eventIds.includes(event.eventId); })
|
|
30202
30221
|
.map(function (event) {
|
|
30222
|
+
var _a;
|
|
30203
30223
|
var enteredParticipantIds = (event.entries || []).map(function (entry) { return entry.participantId; });
|
|
30204
30224
|
if (event.eventType === SINGLES)
|
|
30205
30225
|
return enteredParticipantIds;
|
|
30206
|
-
var individualParticipantIds = ((tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30226
|
+
var individualParticipantIds = ((_a = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _a !== void 0 ? _a : [])
|
|
30207
30227
|
.filter(function (participant) {
|
|
30208
30228
|
return enteredParticipantIds.includes(participant.participantId);
|
|
30209
30229
|
})
|
|
@@ -30574,6 +30594,7 @@ var penaltyTemplate = function (_a) {
|
|
|
30574
30594
|
};
|
|
30575
30595
|
|
|
30576
30596
|
function addPenalty$1(_a) {
|
|
30597
|
+
var _b;
|
|
30577
30598
|
var refereeParticipantId = _a.refereeParticipantId, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds, penaltyCode = _a.penaltyCode, penaltyType = _a.penaltyType, extensions = _a.extensions, penaltyId = _a.penaltyId, matchUpId = _a.matchUpId, issuedAt = _a.issuedAt, notes = _a.notes;
|
|
30578
30599
|
if (!tournamentRecord)
|
|
30579
30600
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30582,7 +30603,7 @@ function addPenalty$1(_a) {
|
|
|
30582
30603
|
if (!penaltyType)
|
|
30583
30604
|
return { error: MISSING_PENALTY_TYPE };
|
|
30584
30605
|
// TODO: add penalty timeItem to matchUp.timeItems[]
|
|
30585
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30606
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30586
30607
|
var relevantParticipants = participants.filter(function (participant) {
|
|
30587
30608
|
return participantIds.includes(participant.participantId);
|
|
30588
30609
|
});
|
|
@@ -30618,18 +30639,20 @@ function addPenalty$1(_a) {
|
|
|
30618
30639
|
return __assign(__assign({}, SUCCESS), { penaltyId: penaltyItem.penaltyId });
|
|
30619
30640
|
}
|
|
30620
30641
|
function removePenalty$1(_a) {
|
|
30642
|
+
var _b;
|
|
30621
30643
|
var tournamentRecord = _a.tournamentRecord, penaltyId = _a.penaltyId;
|
|
30622
30644
|
if (!tournamentRecord)
|
|
30623
30645
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30624
30646
|
if (!penaltyId)
|
|
30625
30647
|
return { error: MISSING_PENALTY_ID };
|
|
30626
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30648
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30627
30649
|
var modifiedParticipants = [];
|
|
30628
30650
|
var penaltyRemoved = false;
|
|
30629
30651
|
var removedPenalty;
|
|
30630
30652
|
participants.forEach(function (participant) {
|
|
30653
|
+
var _a;
|
|
30631
30654
|
var participantModified = false;
|
|
30632
|
-
participant.penalties = (participant.penalties
|
|
30655
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).filter(function (penalty) {
|
|
30633
30656
|
if (penalty.penaltyId === penaltyId) {
|
|
30634
30657
|
participantModified = true;
|
|
30635
30658
|
if (!penaltyRemoved) {
|
|
@@ -30655,13 +30678,15 @@ function removePenalty$1(_a) {
|
|
|
30655
30678
|
? __assign(__assign({}, SUCCESS), { penalty: removedPenalty }) : { error: PENALTY_NOT_FOUND };
|
|
30656
30679
|
}
|
|
30657
30680
|
function getTournamentPenalties(_a) {
|
|
30681
|
+
var _b;
|
|
30658
30682
|
var tournamentRecord = _a.tournamentRecord;
|
|
30659
30683
|
if (!tournamentRecord)
|
|
30660
30684
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30661
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30685
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30662
30686
|
var allPenalties = participants.reduce(function (penalties, participant) {
|
|
30687
|
+
var _a;
|
|
30663
30688
|
var participantId = participant.participantId;
|
|
30664
|
-
(participant.penalties
|
|
30689
|
+
((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).forEach(function (penalty) {
|
|
30665
30690
|
var penaltyId = (penalty || {}).penaltyId;
|
|
30666
30691
|
if (penalties[penaltyId]) {
|
|
30667
30692
|
penalties[penaltyId].participants.push(participantId);
|
|
@@ -30675,6 +30700,7 @@ function getTournamentPenalties(_a) {
|
|
|
30675
30700
|
return { penalties: Object.values(allPenalties) };
|
|
30676
30701
|
}
|
|
30677
30702
|
function modifyPenalty$1(_a) {
|
|
30703
|
+
var _b;
|
|
30678
30704
|
var tournamentRecord = _a.tournamentRecord, modifications = _a.modifications, penaltyId = _a.penaltyId;
|
|
30679
30705
|
if (!tournamentRecord)
|
|
30680
30706
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30682,7 +30708,7 @@ function modifyPenalty$1(_a) {
|
|
|
30682
30708
|
return { error: INVALID_VALUES, modifications: modifications };
|
|
30683
30709
|
if (!penaltyId)
|
|
30684
30710
|
return { error: MISSING_PENALTY_ID };
|
|
30685
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30711
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30686
30712
|
var validAttributes = Object.keys(penaltyTemplate()).filter(function (attribute) { return attribute !== 'penaltyId'; });
|
|
30687
30713
|
var validModificationAttributes = Object.keys(modifications).filter(function (attribute) { return validAttributes.includes(attribute); });
|
|
30688
30714
|
if (!validModificationAttributes.length)
|
|
@@ -30690,8 +30716,9 @@ function modifyPenalty$1(_a) {
|
|
|
30690
30716
|
var updatedPenalty;
|
|
30691
30717
|
var modifiedParticipants = [];
|
|
30692
30718
|
participants.forEach(function (participant) {
|
|
30719
|
+
var _a;
|
|
30693
30720
|
var participantModified = false;
|
|
30694
|
-
participant.penalties = (participant.penalties
|
|
30721
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).map(function (penalty) {
|
|
30695
30722
|
if (penalty.penaltyId === penaltyId) {
|
|
30696
30723
|
participantModified = true;
|
|
30697
30724
|
validModificationAttributes.forEach(function (attribute) {
|
|
@@ -30721,18 +30748,18 @@ function modifyPenalty$1(_a) {
|
|
|
30721
30748
|
|
|
30722
30749
|
function addPenalty(params) {
|
|
30723
30750
|
var e_1, _a;
|
|
30724
|
-
var _b;
|
|
30751
|
+
var _b, _c;
|
|
30725
30752
|
var tournamentRecords = params.tournamentRecords, participantIds = params.participantIds;
|
|
30726
30753
|
var penaltyId;
|
|
30727
30754
|
try {
|
|
30728
|
-
for (var
|
|
30729
|
-
var tournamentRecord =
|
|
30755
|
+
for (var _d = __values(Object.values(tournamentRecords)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
30756
|
+
var tournamentRecord = _e.value;
|
|
30730
30757
|
var participants = (_b = getParticipants$1({
|
|
30731
30758
|
tournamentRecord: tournamentRecord,
|
|
30732
30759
|
}).participants) !== null && _b !== void 0 ? _b : [];
|
|
30733
30760
|
var tournamentParticipantIds = participants === null || participants === void 0 ? void 0 : participants.map(extractAttributes('participantId')).filter(function (participantId) { return participantIds.includes(participantId); });
|
|
30734
30761
|
if (tournamentParticipantIds.length) {
|
|
30735
|
-
var result = addPenalty$1(__assign(__assign({}, params), { penaltyId: params.penaltyId
|
|
30762
|
+
var result = addPenalty$1(__assign(__assign({}, params), { penaltyId: (_c = params.penaltyId) !== null && _c !== void 0 ? _c : penaltyId, tournamentRecord: tournamentRecord, participantIds: tournamentParticipantIds }));
|
|
30736
30763
|
penaltyId = result.penaltyId;
|
|
30737
30764
|
}
|
|
30738
30765
|
}
|
|
@@ -30740,7 +30767,7 @@ function addPenalty(params) {
|
|
|
30740
30767
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
30741
30768
|
finally {
|
|
30742
30769
|
try {
|
|
30743
|
-
if (
|
|
30770
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
30744
30771
|
}
|
|
30745
30772
|
finally { if (e_1) throw e_1.error; }
|
|
30746
30773
|
}
|
|
@@ -30804,7 +30831,7 @@ function getCompetitionPenalties(_a) {
|
|
|
30804
30831
|
for (var _c = __values(Object.values(tournamentRecords)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
30805
30832
|
var tournamentRecord = _d.value;
|
|
30806
30833
|
var penalties = getTournamentPenalties({ tournamentRecord: tournamentRecord }).penalties;
|
|
30807
|
-
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties
|
|
30834
|
+
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties !== null && penalties !== void 0 ? penalties : [])), false));
|
|
30808
30835
|
}
|
|
30809
30836
|
}
|
|
30810
30837
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -36652,7 +36679,8 @@ function modifyPersonRequests(_a) {
|
|
|
36652
36679
|
|
|
36653
36680
|
function clearScheduledMatchUps$1(_a) {
|
|
36654
36681
|
var e_1, _b;
|
|
36655
|
-
var _c
|
|
36682
|
+
var _c, _d, _e;
|
|
36683
|
+
var _f = _a.scheduleAttributes, scheduleAttributes = _f === void 0 ? ['scheduledDate', 'scheduledTime'] : _f, _g = _a.ignoreMatchUpStatuses, ignoreMatchUpStatuses = _g === void 0 ? completedMatchUpStatuses : _g, tournamentRecord = _a.tournamentRecord, scheduledDates = _a.scheduledDates, _h = _a.venueIds, venueIds = _h === void 0 ? [] : _h;
|
|
36656
36684
|
if (typeof tournamentRecord !== 'object')
|
|
36657
36685
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36658
36686
|
if (!Array.isArray(ignoreMatchUpStatuses) || !Array.isArray(venueIds)) {
|
|
@@ -36660,10 +36688,10 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36660
36688
|
}
|
|
36661
36689
|
if (venueIds.length)
|
|
36662
36690
|
scheduleAttributes.push('venueId');
|
|
36663
|
-
var inContextMatchUps = allTournamentMatchUps({
|
|
36691
|
+
var inContextMatchUps = (_c = allTournamentMatchUps({
|
|
36664
36692
|
matchUpFilters: { scheduledDates: scheduledDates },
|
|
36665
36693
|
tournamentRecord: tournamentRecord,
|
|
36666
|
-
}).matchUps
|
|
36694
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
36667
36695
|
var relevantMatchUpIds = inContextMatchUps
|
|
36668
36696
|
.filter(function (matchUp) {
|
|
36669
36697
|
return matchUp.matchUpStatus &&
|
|
@@ -36672,16 +36700,16 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36672
36700
|
(!(venueIds === null || venueIds === void 0 ? void 0 : venueIds.length) || venueIds.includes(matchUp.schedule.venueId));
|
|
36673
36701
|
})
|
|
36674
36702
|
.map(getMatchUpId);
|
|
36675
|
-
var matchUps = allTournamentMatchUps({
|
|
36703
|
+
var matchUps = (_d = allTournamentMatchUps({
|
|
36676
36704
|
tournamentRecord: tournamentRecord,
|
|
36677
36705
|
inContext: false,
|
|
36678
|
-
}).matchUps
|
|
36706
|
+
}).matchUps) !== null && _d !== void 0 ? _d : [];
|
|
36679
36707
|
var clearedScheduleCount = 0;
|
|
36680
36708
|
try {
|
|
36681
36709
|
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
36682
36710
|
var matchUp = matchUps_1_1.value;
|
|
36683
36711
|
if (relevantMatchUpIds.includes(matchUp.matchUpId)) {
|
|
36684
|
-
matchUp.timeItems = (matchUp.timeItems
|
|
36712
|
+
matchUp.timeItems = ((_e = matchUp.timeItems) !== null && _e !== void 0 ? _e : []).filter(function (timeItem) {
|
|
36685
36713
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) &&
|
|
36686
36714
|
![
|
|
36687
36715
|
ALLOCATE_COURTS,
|
|
@@ -39721,18 +39749,19 @@ function getEventAlternateParticipantIds(_a) {
|
|
|
39721
39749
|
}
|
|
39722
39750
|
|
|
39723
39751
|
function matchUpActions$1(_a) {
|
|
39752
|
+
var _b, _c;
|
|
39724
39753
|
var policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, enforceGender = _a.enforceGender, participantId = _a.participantId, sideNumber = _a.sideNumber, matchUpId = _a.matchUpId, drawId = _a.drawId, event = _a.event;
|
|
39725
39754
|
if (!tournamentRecord)
|
|
39726
39755
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
39727
39756
|
if (!drawId) {
|
|
39728
39757
|
// if matchUp did not have context, find drawId by brute force
|
|
39729
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps
|
|
39758
|
+
var matchUps = (_b = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _b !== void 0 ? _b : [];
|
|
39730
39759
|
drawId = matchUps.reduce(function (drawId, candidate) {
|
|
39731
39760
|
return candidate.matchUpId === matchUpId ? candidate.drawId : drawId;
|
|
39732
39761
|
}, undefined);
|
|
39733
|
-
var events = tournamentRecord.events
|
|
39762
|
+
var events = (_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [];
|
|
39734
39763
|
var drawDefinitions = events
|
|
39735
|
-
.map(function (event) { return event.drawDefinitions
|
|
39764
|
+
.map(function (event) { var _a; return (_a = event.drawDefinitions) !== null && _a !== void 0 ? _a : []; })
|
|
39736
39765
|
.flat();
|
|
39737
39766
|
drawDefinition = drawDefinitions.reduce(function (drawDefinition, candidate) {
|
|
39738
39767
|
return candidate.drawId === drawId ? candidate : drawDefinition;
|
|
@@ -39744,7 +39773,7 @@ function matchUpActions$1(_a) {
|
|
|
39744
39773
|
drawDefinition: drawDefinition,
|
|
39745
39774
|
event: event,
|
|
39746
39775
|
}).policyDefinitions;
|
|
39747
|
-
policyDefinitions = policyDefinitions
|
|
39776
|
+
policyDefinitions = policyDefinitions !== null && policyDefinitions !== void 0 ? policyDefinitions : attachedPolicy;
|
|
39748
39777
|
if (drawDefinition) {
|
|
39749
39778
|
return matchUpActions$2({
|
|
39750
39779
|
tournamentParticipants: tournamentRecord.participants,
|
|
@@ -40231,16 +40260,17 @@ function deletionMessage(_a) {
|
|
|
40231
40260
|
|
|
40232
40261
|
function deleteVenue$1(_a) {
|
|
40233
40262
|
var e_1, _b;
|
|
40263
|
+
var _c, _d;
|
|
40234
40264
|
var tournamentRecord = _a.tournamentRecord, venueId = _a.venueId, force = _a.force;
|
|
40235
40265
|
if (!tournamentRecord)
|
|
40236
40266
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
40237
40267
|
if (typeof venueId !== 'string')
|
|
40238
40268
|
return { error: MISSING_VENUE_ID };
|
|
40239
40269
|
var contextFilters = { venueIds: [venueId] };
|
|
40240
|
-
var matchUpsToUnschedule = allTournamentMatchUps({
|
|
40270
|
+
var matchUpsToUnschedule = (_c = allTournamentMatchUps({
|
|
40241
40271
|
tournamentRecord: tournamentRecord,
|
|
40242
40272
|
contextFilters: contextFilters,
|
|
40243
|
-
}).matchUps
|
|
40273
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
40244
40274
|
if (!matchUpsToUnschedule.length || force) {
|
|
40245
40275
|
try {
|
|
40246
40276
|
// if no matchUpsToUnschedule this does nothing but avoid the deletionMessage
|
|
@@ -40267,7 +40297,7 @@ function deleteVenue$1(_a) {
|
|
|
40267
40297
|
return deletionMessage({ matchUpsCount: matchUpsToUnschedule.length });
|
|
40268
40298
|
}
|
|
40269
40299
|
var deleted;
|
|
40270
|
-
tournamentRecord.venues = (tournamentRecord.venues
|
|
40300
|
+
tournamentRecord.venues = ((_d = tournamentRecord.venues) !== null && _d !== void 0 ? _d : []).filter(function (venue) {
|
|
40271
40301
|
if ((venue === null || venue === void 0 ? void 0 : venue.venueId) !== venueId)
|
|
40272
40302
|
return true;
|
|
40273
40303
|
deleted = true;
|
|
@@ -40487,6 +40517,7 @@ function getScheduledVenueMatchUps(_a) {
|
|
|
40487
40517
|
|
|
40488
40518
|
function deleteCourt$1(_a) {
|
|
40489
40519
|
var e_1, _b;
|
|
40520
|
+
var _c;
|
|
40490
40521
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, disableNotice = _a.disableNotice, courtId = _a.courtId, force = _a.force;
|
|
40491
40522
|
var result = findCourt({ tournamentRecord: tournamentRecord, courtId: courtId });
|
|
40492
40523
|
if (result.error)
|
|
@@ -40498,8 +40529,8 @@ function deleteCourt$1(_a) {
|
|
|
40498
40529
|
}).matchUps;
|
|
40499
40530
|
if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length) || force) {
|
|
40500
40531
|
try {
|
|
40501
|
-
for (var
|
|
40502
|
-
var matchUp =
|
|
40532
|
+
for (var _d = __values(matchUps !== null && matchUps !== void 0 ? matchUps : []), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
40533
|
+
var matchUp = _e.value;
|
|
40503
40534
|
var result_1 = removeCourtAssignment({
|
|
40504
40535
|
matchUpId: matchUp.matchUpId,
|
|
40505
40536
|
drawId: matchUp.drawId,
|
|
@@ -40513,12 +40544,12 @@ function deleteCourt$1(_a) {
|
|
|
40513
40544
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40514
40545
|
finally {
|
|
40515
40546
|
try {
|
|
40516
|
-
if (
|
|
40547
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
40517
40548
|
}
|
|
40518
40549
|
finally { if (e_1) throw e_1.error; }
|
|
40519
40550
|
}
|
|
40520
40551
|
if (venue) {
|
|
40521
|
-
venue.courts = (venue.courts
|
|
40552
|
+
venue.courts = ((_c = venue.courts) !== null && _c !== void 0 ? _c : []).filter(function (courtRecord) {
|
|
40522
40553
|
return courtRecord.courtId !== courtId;
|
|
40523
40554
|
});
|
|
40524
40555
|
if (!disableNotice)
|
|
@@ -41930,7 +41961,7 @@ function treeMatchUps(_a) {
|
|
|
41930
41961
|
uuids: uuids,
|
|
41931
41962
|
}), roundNodes = _b.roundNodes, matchUps = _b.matchUps);
|
|
41932
41963
|
roundNumber++;
|
|
41933
|
-
roundLimit = roundLimit
|
|
41964
|
+
roundLimit = roundLimit !== null && roundLimit !== void 0 ? roundLimit : qualifyingRoundNumber;
|
|
41934
41965
|
while (roundNodes.length > 1) {
|
|
41935
41966
|
if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
|
|
41936
41967
|
roundLimit = roundNumber - 1;
|
|
@@ -41960,7 +41991,7 @@ function treeMatchUps(_a) {
|
|
|
41960
41991
|
roundLimit = roundNumber - 1;
|
|
41961
41992
|
}
|
|
41962
41993
|
else {
|
|
41963
|
-
matchUps = matchUps.filter(function (matchUp) { return roundLimit && (matchUp.roundNumber
|
|
41994
|
+
matchUps = matchUps.filter(function (matchUp) { var _a; return roundLimit && ((_a = matchUp.roundNumber) !== null && _a !== void 0 ? _a : 0) <= roundLimit; });
|
|
41964
41995
|
}
|
|
41965
41996
|
return { drawSize: drawSize, matchUps: matchUps, roundsCount: roundsCount, roundLimit: roundLimit };
|
|
41966
41997
|
}
|
|
@@ -42101,7 +42132,6 @@ function generateQualifyingStructures(_a) {
|
|
|
42101
42132
|
roundTarget: roundTarget,
|
|
42102
42133
|
linkType: linkType,
|
|
42103
42134
|
});
|
|
42104
|
-
targetRoundQualifiersCount = 0;
|
|
42105
42135
|
roundTarget += 1;
|
|
42106
42136
|
}
|
|
42107
42137
|
}
|
|
@@ -42116,16 +42146,19 @@ function generateQualifyingStructures(_a) {
|
|
|
42116
42146
|
}
|
|
42117
42147
|
|
|
42118
42148
|
function getStructureRoundProfile(_a) {
|
|
42119
|
-
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42149
|
+
var drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId;
|
|
42120
42150
|
var result = findStructure({
|
|
42121
42151
|
drawDefinition: drawDefinition,
|
|
42122
42152
|
structureId: structureId,
|
|
42123
42153
|
});
|
|
42124
42154
|
if (result.error)
|
|
42125
|
-
return result;
|
|
42155
|
+
return decorateResult({ result: result });
|
|
42126
42156
|
// DEV-NOTE cannot pass drawDefinition parameter in this scenario; callstack error
|
|
42127
|
-
var matchUps = getAllStructureMatchUps({
|
|
42128
|
-
|
|
42157
|
+
var matchUps = getAllStructureMatchUps({
|
|
42158
|
+
structure: result.structure,
|
|
42159
|
+
matchUpsMap: matchUpsMap,
|
|
42160
|
+
}).matchUps;
|
|
42161
|
+
return __assign(__assign({}, getRoundMatchUps$1({ matchUps: matchUps })), { matchUps: matchUps, matchUpsMap: matchUpsMap });
|
|
42129
42162
|
}
|
|
42130
42163
|
|
|
42131
42164
|
function getFinishingPositionSourceRoundsMap(_a) {
|
|
@@ -42172,23 +42205,24 @@ function roundValueRanges(values) {
|
|
|
42172
42205
|
}
|
|
42173
42206
|
|
|
42174
42207
|
function getPositionsPlayedOff(_a) {
|
|
42175
|
-
var
|
|
42208
|
+
var _b;
|
|
42209
|
+
var drawDefinition = _a.drawDefinition, structureIds = _a.structureIds, matchUpsMap = _a.matchUpsMap;
|
|
42176
42210
|
if (structureIds && !Array.isArray(structureIds))
|
|
42177
42211
|
return { error: INVALID_VALUES, context: { structureIds: structureIds } };
|
|
42178
42212
|
if (!drawDefinition)
|
|
42179
42213
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42180
42214
|
structureIds =
|
|
42181
|
-
structureIds
|
|
42182
|
-
(
|
|
42183
|
-
|
|
42184
|
-
|
|
42185
|
-
|
|
42186
|
-
|
|
42187
|
-
});
|
|
42215
|
+
structureIds !== null && structureIds !== void 0 ? structureIds : ((_b = drawDefinition.structures) !== null && _b !== void 0 ? _b : [])
|
|
42216
|
+
.filter(function (structure) { return structure.stage !== QUALIFYING; })
|
|
42217
|
+
.map(function (_a) {
|
|
42218
|
+
var structureId = _a.structureId;
|
|
42219
|
+
return structureId;
|
|
42220
|
+
});
|
|
42188
42221
|
var allFinishingPositionRanges = structureIds
|
|
42189
42222
|
.map(function (structureId) {
|
|
42190
42223
|
var roundProfile = getStructureRoundProfile({
|
|
42191
42224
|
drawDefinition: drawDefinition,
|
|
42225
|
+
matchUpsMap: matchUpsMap,
|
|
42192
42226
|
structureId: structureId,
|
|
42193
42227
|
}).roundProfile;
|
|
42194
42228
|
var values = roundProfile && Object.values(roundProfile);
|
|
@@ -42304,20 +42338,21 @@ function getAvailablePlayoffProfiles$1(_a) {
|
|
|
42304
42338
|
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42305
42339
|
if (!drawDefinition)
|
|
42306
42340
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42341
|
+
var _c = allDrawMatchUps$1({
|
|
42342
|
+
inContext: true,
|
|
42343
|
+
drawDefinition: drawDefinition,
|
|
42344
|
+
}), matchUps = _c.matchUps, matchUpsMap = _c.matchUpsMap;
|
|
42307
42345
|
// positions which are being played off by existing structure(s)
|
|
42308
|
-
var
|
|
42346
|
+
var _d = getPositionsPlayedOff({
|
|
42309
42347
|
drawDefinition: drawDefinition,
|
|
42310
|
-
|
|
42348
|
+
matchUpsMap: matchUpsMap,
|
|
42349
|
+
}), positionsNotPlayedOff = _d.positionsNotPlayedOff, positionsPlayedOff = _d.positionsPlayedOff;
|
|
42311
42350
|
var structures = getDrawStructures({ drawDefinition: drawDefinition }).structures;
|
|
42312
42351
|
var filteredStructures = structures.filter(function (structure) {
|
|
42313
42352
|
return (!structureId && structure.stage !== VOLUNTARY_CONSOLATION) ||
|
|
42314
42353
|
structure.structureId === structureId;
|
|
42315
42354
|
});
|
|
42316
42355
|
var available = {};
|
|
42317
|
-
var matchUps = allDrawMatchUps$1({
|
|
42318
|
-
inContext: true,
|
|
42319
|
-
drawDefinition: drawDefinition,
|
|
42320
|
-
}).matchUps;
|
|
42321
42356
|
try {
|
|
42322
42357
|
for (var filteredStructures_1 = __values(filteredStructures), filteredStructures_1_1 = filteredStructures_1.next(); !filteredStructures_1_1.done; filteredStructures_1_1 = filteredStructures_1.next()) {
|
|
42323
42358
|
var structure = filteredStructures_1_1.value;
|
|
@@ -46876,16 +46911,203 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
46876
46911
|
return __assign({ links: links, structures: structures }, SUCCESS);
|
|
46877
46912
|
}
|
|
46878
46913
|
|
|
46914
|
+
/**
|
|
46915
|
+
* return an array of arrays of grouped structureIds => structureGroups
|
|
46916
|
+
* the expectation is that all structures within a drawDefintion are linked
|
|
46917
|
+
* return a boolean whether this condition is met => allSructuresLinked
|
|
46918
|
+
*/
|
|
46919
|
+
function getStructureGroups(_a) {
|
|
46920
|
+
var e_1, _b, e_2, _c, e_3, _d;
|
|
46921
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
46922
|
+
var drawDefinition = _a.drawDefinition;
|
|
46923
|
+
var structures = drawDefinition.structures || [];
|
|
46924
|
+
var links = drawDefinition.links || [];
|
|
46925
|
+
var structureProfiles = new Map();
|
|
46926
|
+
var initStructureProfile = function (structureId) {
|
|
46927
|
+
var profile = structureProfiles.get(structureId) ||
|
|
46928
|
+
(structureProfiles.set(structureId, {
|
|
46929
|
+
drawSources: [],
|
|
46930
|
+
drawTargets: [],
|
|
46931
|
+
progeny: [],
|
|
46932
|
+
sources: [],
|
|
46933
|
+
targets: [],
|
|
46934
|
+
}) &&
|
|
46935
|
+
structureProfiles.get(structureId));
|
|
46936
|
+
if (profile && !(profile === null || profile === void 0 ? void 0 : profile.stage)) {
|
|
46937
|
+
var structure = structures.find(function (structure) { return structure.structureId === structureId; });
|
|
46938
|
+
profile.stage = structure === null || structure === void 0 ? void 0 : structure.stage;
|
|
46939
|
+
}
|
|
46940
|
+
return profile;
|
|
46941
|
+
};
|
|
46942
|
+
var sourceStructureIds = {};
|
|
46943
|
+
var hasDrawFeedProfile = {};
|
|
46944
|
+
var linkedStructureIds = links.map(function (link) {
|
|
46945
|
+
var sourceId = link.source.structureId;
|
|
46946
|
+
var targetId = link.target.structureId;
|
|
46947
|
+
var sourceProfile = initStructureProfile(sourceId);
|
|
46948
|
+
var targetProfile = initStructureProfile(targetId);
|
|
46949
|
+
if ([BOTTOM_UP, TOP_DOWN, RANDOM, WATERFALL].includes(link.target.feedProfile)) {
|
|
46950
|
+
sourceProfile === null || sourceProfile === void 0 ? void 0 : sourceProfile.targets.push(targetId);
|
|
46951
|
+
targetProfile === null || targetProfile === void 0 ? void 0 : targetProfile.sources.push(sourceId);
|
|
46952
|
+
}
|
|
46953
|
+
else if (link.target.feedProfile === DRAW) {
|
|
46954
|
+
targetProfile === null || targetProfile === void 0 ? void 0 : targetProfile.drawSources.push(sourceId);
|
|
46955
|
+
sourceProfile === null || sourceProfile === void 0 ? void 0 : sourceProfile.drawTargets.push(targetId);
|
|
46956
|
+
}
|
|
46957
|
+
hasDrawFeedProfile[targetId] =
|
|
46958
|
+
hasDrawFeedProfile[targetId] || link.target.feedProfile === DRAW;
|
|
46959
|
+
sourceStructureIds[targetId] = unique(__spreadArray(__spreadArray([], __read((sourceStructureIds[targetId] || [])), false), [
|
|
46960
|
+
sourceId,
|
|
46961
|
+
], false)).filter(Boolean);
|
|
46962
|
+
return [link.source.structureId, link.target.structureId];
|
|
46963
|
+
});
|
|
46964
|
+
try {
|
|
46965
|
+
for (var _p = __values(structureProfiles.keys()), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
46966
|
+
var structureId = _q.value;
|
|
46967
|
+
var profile = structureProfiles.get(structureId);
|
|
46968
|
+
if (profile) {
|
|
46969
|
+
var sourceIds = (_e = profile.targets) !== null && _e !== void 0 ? _e : [];
|
|
46970
|
+
while (sourceIds.length) {
|
|
46971
|
+
var sourceId = sourceIds.pop();
|
|
46972
|
+
var sourceProfile = sourceId && structureProfiles[sourceId];
|
|
46973
|
+
if ((_f = sourceProfile === null || sourceProfile === void 0 ? void 0 : sourceProfile.targets) === null || _f === void 0 ? void 0 : _f.length) {
|
|
46974
|
+
sourceIds.push.apply(sourceIds, __spreadArray([], __read(sourceProfile.targets), false));
|
|
46975
|
+
}
|
|
46976
|
+
else if (sourceProfile) {
|
|
46977
|
+
profile.rootStage = sourceProfile.stage;
|
|
46978
|
+
}
|
|
46979
|
+
}
|
|
46980
|
+
if (!profile.rootStage)
|
|
46981
|
+
profile.rootStage = profile.stage;
|
|
46982
|
+
if (!((_g = profile.targets) === null || _g === void 0 ? void 0 : _g.length)) {
|
|
46983
|
+
var targetIds = (_h = profile.sources) !== null && _h !== void 0 ? _h : [];
|
|
46984
|
+
while (targetIds.length) {
|
|
46985
|
+
var targetId = targetIds.pop();
|
|
46986
|
+
var targetProfile = targetId && structureProfiles[targetId];
|
|
46987
|
+
if ((_j = targetProfile === null || targetProfile === void 0 ? void 0 : targetProfile.sources) === null || _j === void 0 ? void 0 : _j.length) {
|
|
46988
|
+
try {
|
|
46989
|
+
for (var _r = (e_2 = void 0, __values(targetProfile.sources)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
46990
|
+
var id = _s.value;
|
|
46991
|
+
if (!((_k = profile.progeny) === null || _k === void 0 ? void 0 : _k.includes(id)))
|
|
46992
|
+
(_l = profile.progeny) === null || _l === void 0 ? void 0 : _l.push(id);
|
|
46993
|
+
}
|
|
46994
|
+
}
|
|
46995
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
46996
|
+
finally {
|
|
46997
|
+
try {
|
|
46998
|
+
if (_s && !_s.done && (_c = _r.return)) _c.call(_r);
|
|
46999
|
+
}
|
|
47000
|
+
finally { if (e_2) throw e_2.error; }
|
|
47001
|
+
}
|
|
47002
|
+
targetIds.push.apply(targetIds, __spreadArray([], __read(targetProfile.sources), false));
|
|
47003
|
+
}
|
|
47004
|
+
}
|
|
47005
|
+
}
|
|
47006
|
+
}
|
|
47007
|
+
}
|
|
47008
|
+
}
|
|
47009
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
47010
|
+
finally {
|
|
47011
|
+
try {
|
|
47012
|
+
if (_q && !_q.done && (_b = _p.return)) _b.call(_p);
|
|
47013
|
+
}
|
|
47014
|
+
finally { if (e_1) throw e_1.error; }
|
|
47015
|
+
}
|
|
47016
|
+
var maxQualifyingDepth = 0;
|
|
47017
|
+
try {
|
|
47018
|
+
for (var _t = __values(structureProfiles.keys()), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
47019
|
+
var structureId = _u.value;
|
|
47020
|
+
var profile = structureProfiles.get(structureId);
|
|
47021
|
+
if (profile && profile.rootStage === QUALIFYING) {
|
|
47022
|
+
var drawTargets = [(_m = profile.drawTargets) === null || _m === void 0 ? void 0 : _m[0]];
|
|
47023
|
+
var distanceFromMain = 0;
|
|
47024
|
+
while (drawTargets.length) {
|
|
47025
|
+
distanceFromMain += 1;
|
|
47026
|
+
var drawTarget = drawTargets.pop();
|
|
47027
|
+
var targetProfile = drawTarget
|
|
47028
|
+
? structureProfiles.get(drawTarget)
|
|
47029
|
+
: undefined;
|
|
47030
|
+
if ((_o = targetProfile === null || targetProfile === void 0 ? void 0 : targetProfile.drawTargets) === null || _o === void 0 ? void 0 : _o.length) {
|
|
47031
|
+
drawTargets.push(targetProfile.drawTargets[0]);
|
|
47032
|
+
}
|
|
47033
|
+
}
|
|
47034
|
+
profile.distanceFromMain = distanceFromMain;
|
|
47035
|
+
if (distanceFromMain > maxQualifyingDepth)
|
|
47036
|
+
maxQualifyingDepth = distanceFromMain;
|
|
47037
|
+
}
|
|
47038
|
+
}
|
|
47039
|
+
}
|
|
47040
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
47041
|
+
finally {
|
|
47042
|
+
try {
|
|
47043
|
+
if (_u && !_u.done && (_d = _t.return)) _d.call(_t);
|
|
47044
|
+
}
|
|
47045
|
+
finally { if (e_3) throw e_3.error; }
|
|
47046
|
+
}
|
|
47047
|
+
// iterate through all groups of structureIds to flatten tree of links between structures
|
|
47048
|
+
var iterations = linkedStructureIds.length;
|
|
47049
|
+
generateRange(0, Math.ceil(iterations / 2)).forEach(function () {
|
|
47050
|
+
linkedStructureIds = generateRange(0, iterations).map(function (index) {
|
|
47051
|
+
var structureIds = linkedStructureIds[index];
|
|
47052
|
+
var mergedWithOverlappingIds = linkedStructureIds.reduce(function (biggest, ids) {
|
|
47053
|
+
var hasOverlap = overlap(structureIds, ids);
|
|
47054
|
+
return hasOverlap ? biggest.concat.apply(biggest, __spreadArray([], __read(ids), false)) : biggest;
|
|
47055
|
+
}, []) || [];
|
|
47056
|
+
return unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(mergedWithOverlappingIds), false)));
|
|
47057
|
+
});
|
|
47058
|
+
});
|
|
47059
|
+
// at this point all linkedStructureIds arrays should be equivalent
|
|
47060
|
+
// use the first of these as the identity array
|
|
47061
|
+
var groupedStructureIds = linkedStructureIds[0];
|
|
47062
|
+
// utility method to recognize equivalent arrays of structureIds
|
|
47063
|
+
var identityLink = function (a, b) { return intersection(a, b).length === a.length; };
|
|
47064
|
+
// check that all arrays of linkedStructureIds are equivalent to identity array
|
|
47065
|
+
var allLinkStructuresLinked = linkedStructureIds
|
|
47066
|
+
.slice(1)
|
|
47067
|
+
.reduce(function (allLinkStructuresLinked, ids) {
|
|
47068
|
+
return allLinkStructuresLinked && identityLink(ids, groupedStructureIds);
|
|
47069
|
+
}, true);
|
|
47070
|
+
// if a drawDefinition contains no links then no structure groups will exist
|
|
47071
|
+
// filter out undefined when there are no links in a drawDefinition
|
|
47072
|
+
var structureGroups = [groupedStructureIds].filter(Boolean);
|
|
47073
|
+
// this is the same as structureGroups, but excludes VOLUNTARY_CONSOLATION
|
|
47074
|
+
var linkCheck = [groupedStructureIds].filter(Boolean);
|
|
47075
|
+
// iterate through all structures to add missing structureIds
|
|
47076
|
+
structures.forEach(function (structure) {
|
|
47077
|
+
var structureId = structure.structureId, stage = structure.stage;
|
|
47078
|
+
var existingGroup = structureGroups.find(function (group) {
|
|
47079
|
+
return group.includes(structureId);
|
|
47080
|
+
});
|
|
47081
|
+
if (!existingGroup) {
|
|
47082
|
+
structureGroups.push([structureId]);
|
|
47083
|
+
if (stage !== VOLUNTARY_CONSOLATION)
|
|
47084
|
+
linkCheck.push([structureId]);
|
|
47085
|
+
}
|
|
47086
|
+
});
|
|
47087
|
+
var allStructuresLinked = allLinkStructuresLinked && linkCheck.length === 1;
|
|
47088
|
+
if (!(links === null || links === void 0 ? void 0 : links.length) && structures.length === 1) {
|
|
47089
|
+
initStructureProfile(structures[0].structureId);
|
|
47090
|
+
}
|
|
47091
|
+
return {
|
|
47092
|
+
structureProfiles: Object.fromEntries(structureProfiles),
|
|
47093
|
+
allStructuresLinked: allStructuresLinked,
|
|
47094
|
+
maxQualifyingDepth: maxQualifyingDepth,
|
|
47095
|
+
sourceStructureIds: sourceStructureIds,
|
|
47096
|
+
hasDrawFeedProfile: hasDrawFeedProfile,
|
|
47097
|
+
structureGroups: structureGroups,
|
|
47098
|
+
};
|
|
47099
|
+
}
|
|
47100
|
+
|
|
46879
47101
|
// for use when adding a qualifying structure to an existing drawDefinition
|
|
46880
47102
|
// not for use when generating structures from qualifyingProfiles
|
|
46881
47103
|
function generateQualifyingStructure$1(params) {
|
|
46882
47104
|
var _a;
|
|
46883
|
-
var _b, _c, _d, _e;
|
|
47105
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
46884
47106
|
if (!params.drawDefinition)
|
|
46885
47107
|
return { error: MISSING_DRAW_DEFINITION };
|
|
46886
47108
|
var stack = 'generateQualifyingStructure';
|
|
46887
|
-
var drawSize = params.drawSize
|
|
46888
|
-
var qualifyingRoundNumber = params.qualifyingRoundNumber, qualifyingPositions = params.qualifyingPositions, targetStructureId = params.targetStructureId, structureOptions = params.structureOptions, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, structureName = params.structureName, structureId = params.structureId, roundTarget = params.roundTarget, drawType = params.drawType, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
47109
|
+
var drawSize = (_b = params.drawSize) !== null && _b !== void 0 ? _b : coerceEven(params.participantsCount);
|
|
47110
|
+
var qualifyingRoundNumber = params.qualifyingRoundNumber, qualifyingPositions = params.qualifyingPositions, targetStructureId = params.targetStructureId, structureOptions = params.structureOptions, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, matchUpFormat = params.matchUpFormat, structureName = params.structureName, structureId = params.structureId, roundTarget = params.roundTarget, drawType = params.drawType, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
|
|
46889
47111
|
var roundLimit, roundsCount, structure, matchUps;
|
|
46890
47112
|
var qualifiersCount = 0;
|
|
46891
47113
|
var finishingPositions;
|
|
@@ -46893,68 +47115,27 @@ function generateQualifyingStructure$1(params) {
|
|
|
46893
47115
|
if (!isConvertableInteger(drawSize)) {
|
|
46894
47116
|
return decorateResult({ result: { error: MISSING_DRAW_SIZE }, stack: stack });
|
|
46895
47117
|
}
|
|
46896
|
-
var
|
|
46897
|
-
|
|
46898
|
-
|
|
46899
|
-
});
|
|
46900
|
-
if (result.error) {
|
|
47118
|
+
var structureProfiles = getStructureGroups({ drawDefinition: drawDefinition }).structureProfiles;
|
|
47119
|
+
var structureProfile = structureProfiles[targetStructureId];
|
|
47120
|
+
if (!structureProfile) {
|
|
46901
47121
|
return decorateResult({
|
|
47122
|
+
result: { error: STRUCTURE_NOT_FOUND },
|
|
46902
47123
|
context: { targetStructureId: targetStructureId },
|
|
46903
|
-
result: result,
|
|
46904
47124
|
stack: stack,
|
|
46905
47125
|
});
|
|
46906
47126
|
}
|
|
46907
|
-
|
|
46908
|
-
return { error: STRUCTURE_NOT_FOUND };
|
|
46909
|
-
var targetStructure = result.structure;
|
|
46910
|
-
var matchUpType = targetStructure.matchUpType;
|
|
46911
|
-
if (targetStructure.stage === QUALIFYING) {
|
|
46912
|
-
if (targetStructure.stageSequence && targetStructure.stageSequence > 1) {
|
|
46913
|
-
stageSequence = targetStructure.stageSequence - 1;
|
|
46914
|
-
}
|
|
46915
|
-
else {
|
|
46916
|
-
// stageSequence must be modified for entire qualifying chain
|
|
46917
|
-
var nextStructureId_1 = targetStructureId;
|
|
46918
|
-
var nextStageSequence = 2;
|
|
46919
|
-
var chainModified = void 0;
|
|
46920
|
-
while (!chainModified && nextStructureId_1) {
|
|
46921
|
-
targetStructure.stageSequence = nextStageSequence;
|
|
46922
|
-
var targetTargetStructureId = (_d = (_c = (_b = drawDefinition.links) === null || _b === void 0 ? void 0 : _b.find(function (link) { return link.source.structureId === nextStructureId_1; })) === null || _c === void 0 ? void 0 : _c.target) === null || _d === void 0 ? void 0 : _d.structureId;
|
|
46923
|
-
nextStructureId_1 = targetTargetStructureId;
|
|
46924
|
-
nextStageSequence += 1;
|
|
46925
|
-
if (!targetTargetStructureId) {
|
|
46926
|
-
chainModified = true;
|
|
46927
|
-
}
|
|
46928
|
-
else {
|
|
46929
|
-
var result_1 = findStructure({
|
|
46930
|
-
structureId: targetTargetStructureId,
|
|
46931
|
-
drawDefinition: drawDefinition,
|
|
46932
|
-
});
|
|
46933
|
-
if (!result_1.structure)
|
|
46934
|
-
return { error: STRUCTURE_NOT_FOUND };
|
|
46935
|
-
if (result_1.error) {
|
|
46936
|
-
return decorateResult({
|
|
46937
|
-
context: { targetTargetStructureId: targetTargetStructureId },
|
|
46938
|
-
result: result_1,
|
|
46939
|
-
stack: stack,
|
|
46940
|
-
});
|
|
46941
|
-
}
|
|
46942
|
-
if (result_1.structure.stage !== QUALIFYING)
|
|
46943
|
-
chainModified = true;
|
|
46944
|
-
}
|
|
46945
|
-
}
|
|
46946
|
-
}
|
|
46947
|
-
}
|
|
47127
|
+
var matchUpType = drawDefinition.matchUpType;
|
|
46948
47128
|
var roundTargetName = roundTarget ? "".concat(roundTarget, "-") : '';
|
|
46949
|
-
var
|
|
46950
|
-
var
|
|
46951
|
-
|
|
46952
|
-
|
|
46953
|
-
|
|
47129
|
+
var isPreQualifying = structureProfile.stage === QUALIFYING;
|
|
47130
|
+
var preQualifyingNaming = (_e = (_d = (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_ROUND_NAMING]) === null || _c === void 0 ? void 0 : _c.namingConventions) === null || _d === void 0 ? void 0 : _d.pre) !== null && _e !== void 0 ? _e : (_g = (_f = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING]) === null || _f === void 0 ? void 0 : _f.namingConventions) === null || _g === void 0 ? void 0 : _g.pre;
|
|
47131
|
+
var pre = isPreQualifying && preQualifyingNaming ? "".concat(preQualifyingNaming, "-") : '';
|
|
47132
|
+
var qualifyingStructureName = structureName !== null && structureName !== void 0 ? structureName : (roundTargetName
|
|
47133
|
+
? "".concat(pre).concat(constantToString(QUALIFYING), " ").concat(roundTargetName)
|
|
47134
|
+
: "".concat(pre).concat(constantToString(QUALIFYING)));
|
|
46954
47135
|
if (drawType === ROUND_ROBIN) {
|
|
46955
|
-
var
|
|
46956
|
-
structureName: structureName
|
|
46957
|
-
structureId: structureId
|
|
47136
|
+
var _k = generateRoundRobin({
|
|
47137
|
+
structureName: structureName !== null && structureName !== void 0 ? structureName : qualifyingStructureName,
|
|
47138
|
+
structureId: structureId !== null && structureId !== void 0 ? structureId : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
46958
47139
|
stage: QUALIFYING,
|
|
46959
47140
|
structureOptions: structureOptions,
|
|
46960
47141
|
appliedPolicies: appliedPolicies,
|
|
@@ -46965,7 +47146,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46965
47146
|
drawSize: drawSize,
|
|
46966
47147
|
isMock: isMock,
|
|
46967
47148
|
uuids: uuids,
|
|
46968
|
-
}), maxRoundNumber =
|
|
47149
|
+
}), maxRoundNumber = _k.maxRoundNumber /*, groupSize*/, structures = _k.structures, groupCount = _k.groupCount;
|
|
46969
47150
|
qualifiersCount = groupCount;
|
|
46970
47151
|
roundLimit = maxRoundNumber;
|
|
46971
47152
|
structure = structures[0];
|
|
@@ -46984,10 +47165,11 @@ function generateQualifyingStructure$1(params) {
|
|
|
46984
47165
|
if (!roundLimit)
|
|
46985
47166
|
roundLimit = roundsCount;
|
|
46986
47167
|
structure = structureTemplate({
|
|
46987
|
-
structureName: structureName
|
|
46988
|
-
structureId: structureId
|
|
47168
|
+
structureName: structureName !== null && structureName !== void 0 ? structureName : qualifyingStructureName,
|
|
47169
|
+
structureId: structureId !== null && structureId !== void 0 ? structureId : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
46989
47170
|
qualifyingRoundNumber: roundLimit,
|
|
46990
47171
|
stage: QUALIFYING,
|
|
47172
|
+
matchUpFormat: matchUpFormat,
|
|
46991
47173
|
stageSequence: stageSequence,
|
|
46992
47174
|
matchUpType: matchUpType,
|
|
46993
47175
|
roundLimit: roundLimit,
|
|
@@ -46999,22 +47181,25 @@ function generateQualifyingStructure$1(params) {
|
|
|
46999
47181
|
extension: { name: ROUND_TARGET, value: roundTarget },
|
|
47000
47182
|
});
|
|
47001
47183
|
}
|
|
47002
|
-
qualifiersCount = (
|
|
47184
|
+
qualifiersCount = (_h = matchUps === null || matchUps === void 0 ? void 0 : matchUps.filter(function (matchUp) { return matchUp.roundNumber === roundLimit; })) === null || _h === void 0 ? void 0 : _h.length;
|
|
47003
47185
|
}
|
|
47004
47186
|
// order of operations is important here!! finalQualifier positions is not yet updated when this step occurs
|
|
47005
47187
|
var linkType = drawType === ROUND_ROBIN ? LinkTypeEnum.Position : LinkTypeEnum.Winner;
|
|
47006
|
-
var link =
|
|
47007
|
-
|
|
47008
|
-
|
|
47009
|
-
|
|
47010
|
-
|
|
47011
|
-
|
|
47012
|
-
|
|
47188
|
+
var link = structure &&
|
|
47189
|
+
roundLimit &&
|
|
47190
|
+
((_j = generateQualifyingLink({
|
|
47191
|
+
sourceStructureId: structure.structureId,
|
|
47192
|
+
sourceRoundNumber: roundLimit,
|
|
47193
|
+
targetStructureId: targetStructureId,
|
|
47194
|
+
finishingPositions: finishingPositions,
|
|
47195
|
+
linkType: linkType,
|
|
47196
|
+
})) === null || _j === void 0 ? void 0 : _j.link);
|
|
47013
47197
|
return __assign(__assign({ qualifyingDrawPositionsCount: drawSize, qualifiersCount: qualifiersCount }, SUCCESS), { structure: structure, link: link });
|
|
47014
47198
|
}
|
|
47015
47199
|
|
|
47016
47200
|
function attachQualifyingStructure$1(_a) {
|
|
47017
|
-
var _b;
|
|
47201
|
+
var e_1, _b;
|
|
47202
|
+
var _c;
|
|
47018
47203
|
var drawDefinition = _a.drawDefinition, tournamentId = _a.tournamentId, structure = _a.structure, eventId = _a.eventId, link = _a.link;
|
|
47019
47204
|
if (!drawDefinition)
|
|
47020
47205
|
return { error: MISSING_DRAW_DEFINITION };
|
|
@@ -47039,7 +47224,27 @@ function attachQualifyingStructure$1(_a) {
|
|
|
47039
47224
|
drawDefinition.links = [];
|
|
47040
47225
|
drawDefinition.structures.push(structure);
|
|
47041
47226
|
drawDefinition.links.push(link);
|
|
47042
|
-
var
|
|
47227
|
+
var _d = getStructureGroups({
|
|
47228
|
+
drawDefinition: drawDefinition,
|
|
47229
|
+
}), maxQualifyingDepth = _d.maxQualifyingDepth, structureProfiles = _d.structureProfiles;
|
|
47230
|
+
try {
|
|
47231
|
+
for (var _e = __values(drawDefinition.structures), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
47232
|
+
var structure_1 = _f.value;
|
|
47233
|
+
var profile = structureProfiles[structure_1.structureId];
|
|
47234
|
+
if (profile.distanceFromMain) {
|
|
47235
|
+
structure_1.stageSequence =
|
|
47236
|
+
maxQualifyingDepth + 1 - profile.distanceFromMain;
|
|
47237
|
+
}
|
|
47238
|
+
}
|
|
47239
|
+
}
|
|
47240
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
47241
|
+
finally {
|
|
47242
|
+
try {
|
|
47243
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
47244
|
+
}
|
|
47245
|
+
finally { if (e_1) throw e_1.error; }
|
|
47246
|
+
}
|
|
47247
|
+
var matchUps = ((_c = getAllStructureMatchUps({ structure: structure })) === null || _c === void 0 ? void 0 : _c.matchUps) || [];
|
|
47043
47248
|
addMatchUpsNotice({
|
|
47044
47249
|
drawDefinition: drawDefinition,
|
|
47045
47250
|
tournamentId: tournamentId,
|
|
@@ -47252,6 +47457,10 @@ function getAdvancingParticipantId(matchUp) {
|
|
|
47252
47457
|
|
|
47253
47458
|
function addQualifyingStructure$1(params) {
|
|
47254
47459
|
var _a, _b;
|
|
47460
|
+
if (!params.drawDefinition)
|
|
47461
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
47462
|
+
if (!params.targetStructureId)
|
|
47463
|
+
return { error: MISSING_STRUCTURE_ID };
|
|
47255
47464
|
var result = generateQualifyingStructure$1(params);
|
|
47256
47465
|
if (result.error)
|
|
47257
47466
|
return result;
|
|
@@ -47581,7 +47790,7 @@ function renameStructures$1(_a) {
|
|
|
47581
47790
|
}
|
|
47582
47791
|
|
|
47583
47792
|
function removeStructure(_a) {
|
|
47584
|
-
var _b, _c;
|
|
47793
|
+
var _b, _c, _d;
|
|
47585
47794
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, event = _a.event;
|
|
47586
47795
|
if (typeof structureId !== 'string')
|
|
47587
47796
|
return { error: INVALID_VALUES };
|
|
@@ -47596,13 +47805,16 @@ function removeStructure(_a) {
|
|
|
47596
47805
|
return stage === MAIN && stageSequence === 1;
|
|
47597
47806
|
});
|
|
47598
47807
|
var isMainStageSequence1 = structureId === mainStageSequence1.structureId;
|
|
47599
|
-
var
|
|
47808
|
+
var qualifyingStructureIds = structures
|
|
47809
|
+
.filter(function (_a) {
|
|
47600
47810
|
var stage = _a.stage;
|
|
47601
47811
|
return stage === QUALIFYING;
|
|
47602
|
-
})
|
|
47603
|
-
|
|
47812
|
+
})
|
|
47813
|
+
.map(extractAttributes('structureId'));
|
|
47814
|
+
if (isMainStageSequence1 && !qualifyingStructureIds.length) {
|
|
47604
47815
|
return { error: CANNOT_REMOVE_MAIN_STRUCTURE };
|
|
47605
47816
|
}
|
|
47817
|
+
var structureIds = structures.map(extractAttributes('structureId'));
|
|
47606
47818
|
var removedMatchUpIds = [];
|
|
47607
47819
|
var idsToRemove = [structureId];
|
|
47608
47820
|
var getTargetedStructureIds = function (structureId) {
|
|
@@ -47613,16 +47825,21 @@ function removeStructure(_a) {
|
|
|
47613
47825
|
link.target.structureId;
|
|
47614
47826
|
}).filter(Boolean);
|
|
47615
47827
|
};
|
|
47616
|
-
var
|
|
47617
|
-
var structureId = _a.structureId;
|
|
47618
|
-
return structureId;
|
|
47619
|
-
});
|
|
47620
|
-
var targetedStructureIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(structureIds.map(function (structureId) {
|
|
47828
|
+
var getQualifyingSourceStructureIds = function (structureId) {
|
|
47621
47829
|
var _a;
|
|
47622
|
-
return (_a = {
|
|
47623
|
-
|
|
47624
|
-
|
|
47625
|
-
|
|
47830
|
+
return (_a = drawDefinition.links) === null || _a === void 0 ? void 0 : _a.map(function (link) {
|
|
47831
|
+
return qualifyingStructureIds.includes(link.source.structureId) &&
|
|
47832
|
+
link.target.structureId === structureId &&
|
|
47833
|
+
link.source.structureId;
|
|
47834
|
+
}).filter(Boolean);
|
|
47835
|
+
};
|
|
47836
|
+
var isQualifyingStructure = qualifyingStructureIds.includes(structureId);
|
|
47837
|
+
var relatedStructureIdsMap = new Map();
|
|
47838
|
+
structureIds.forEach(function (id) {
|
|
47839
|
+
return relatedStructureIdsMap.set(id, isQualifyingStructure
|
|
47840
|
+
? getQualifyingSourceStructureIds(id)
|
|
47841
|
+
: getTargetedStructureIds(id));
|
|
47842
|
+
});
|
|
47626
47843
|
var _loop_1 = function () {
|
|
47627
47844
|
var idBeingRemoved = idsToRemove.pop();
|
|
47628
47845
|
var structure = findStructure({
|
|
@@ -47645,11 +47862,13 @@ function removeStructure(_a) {
|
|
|
47645
47862
|
});
|
|
47646
47863
|
}
|
|
47647
47864
|
var targetedStructureIds = idBeingRemoved &&
|
|
47648
|
-
|
|
47865
|
+
(
|
|
47866
|
+
// targetedStructureIdsMap[idBeingRemoved].filter(
|
|
47867
|
+
(_d = relatedStructureIdsMap.get(idBeingRemoved)) === null || _d === void 0 ? void 0 : _d.filter(function (id) {
|
|
47649
47868
|
// IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
|
|
47650
47869
|
return id !== mainStageSequence1.structureId ||
|
|
47651
47870
|
structureId === mainStageSequence1.structureId;
|
|
47652
|
-
});
|
|
47871
|
+
}));
|
|
47653
47872
|
if (targetedStructureIds === null || targetedStructureIds === void 0 ? void 0 : targetedStructureIds.length)
|
|
47654
47873
|
idsToRemove.push.apply(idsToRemove, __spreadArray([], __read(targetedStructureIds), false));
|
|
47655
47874
|
};
|
|
@@ -48477,8 +48696,8 @@ function isUngrouped(entryStatus) {
|
|
|
48477
48696
|
|
|
48478
48697
|
function modifyEntriesStatus(_a) {
|
|
48479
48698
|
var e_1, _b, e_2, _c;
|
|
48480
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
48481
|
-
var
|
|
48699
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
48700
|
+
var _w = _a.autoEntryPositions, autoEntryPositions = _w === void 0 ? true : _w, ignoreAssignment = _a.ignoreAssignment, // override check for existing assignments
|
|
48482
48701
|
tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, participantIds = _a.participantIds, entryStatus = _a.entryStatus, entryStage = _a.entryStage, extension = _a.extension, // modify the specified extension (remove if value undefined)
|
|
48483
48702
|
eventSync = _a.eventSync, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
48484
48703
|
if (!participantIds || !Array.isArray(participantIds))
|
|
@@ -48520,7 +48739,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48520
48739
|
}).assignedParticipantIds) !== null && _a !== void 0 ? _a : [];
|
|
48521
48740
|
assignedParticipantIds.push.apply(assignedParticipantIds, __spreadArray([], __read(participantIds), false));
|
|
48522
48741
|
});
|
|
48523
|
-
var tournamentParticipants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
48742
|
+
var tournamentParticipants = (_e = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _e !== void 0 ? _e : [];
|
|
48524
48743
|
var validEntryStatusForAllParticipantIds = participantIds.every(function (participantId) {
|
|
48525
48744
|
var _a;
|
|
48526
48745
|
var participantType = (_a = findParticipant({
|
|
@@ -48539,7 +48758,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48539
48758
|
if (!validEntryStatusForAllParticipantIds)
|
|
48540
48759
|
return { error: INVALID_ENTRY_STATUS };
|
|
48541
48760
|
var flightProfile = event && getFlightProfile({ event: event }).flightProfile;
|
|
48542
|
-
var flight = (
|
|
48761
|
+
var flight = (_f = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _f === void 0 ? void 0 : _f.find(function (flight) { return flight.drawId === drawId; });
|
|
48543
48762
|
// ------------------------------------------------------------------------
|
|
48544
48763
|
// reusable functions
|
|
48545
48764
|
var updateEntryStatus = function (entries) {
|
|
@@ -48586,10 +48805,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48586
48805
|
? __assign({}, SUCCESS) : { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
48587
48806
|
};
|
|
48588
48807
|
var autoPosition = function (_a) {
|
|
48808
|
+
var _b;
|
|
48589
48809
|
var flight = _a.flight, drawDefinition = _a.drawDefinition;
|
|
48590
48810
|
if (event) {
|
|
48591
48811
|
event.entries = refreshEntryPositions({
|
|
48592
|
-
entries: event.entries
|
|
48812
|
+
entries: (_b = event.entries) !== null && _b !== void 0 ? _b : [],
|
|
48593
48813
|
});
|
|
48594
48814
|
}
|
|
48595
48815
|
if (flight) {
|
|
@@ -48622,18 +48842,17 @@ function modifyEntriesStatus(_a) {
|
|
|
48622
48842
|
};
|
|
48623
48843
|
// ------------------------------------------------------------------------
|
|
48624
48844
|
// before modifying, if autoEntryPositions: true, pre-assign entryPositions
|
|
48625
|
-
var entryPositionsExist = ((
|
|
48845
|
+
var entryPositionsExist = (_h = (_g = event === null || event === void 0 ? void 0 : event.entries) === null || _g === void 0 ? void 0 : _g.find(function (_a) {
|
|
48846
|
+
var entryPosition = _a.entryPosition;
|
|
48847
|
+
return entryPosition;
|
|
48848
|
+
})) !== null && _h !== void 0 ? _h : (((_j = flight === null || flight === void 0 ? void 0 : flight.drawEntries) === null || _j === void 0 ? void 0 : _j.find(function (_a) {
|
|
48626
48849
|
var entryPosition = _a.entryPosition;
|
|
48627
48850
|
return entryPosition;
|
|
48628
48851
|
})) ||
|
|
48629
|
-
((
|
|
48630
|
-
var entryPosition = _a.entryPosition;
|
|
48631
|
-
return entryPosition;
|
|
48632
|
-
})) ||
|
|
48633
|
-
((_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) === null || _h === void 0 ? void 0 : _h.find(function (_a) {
|
|
48852
|
+
((_k = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) === null || _k === void 0 ? void 0 : _k.find(function (_a) {
|
|
48634
48853
|
var entryPosition = _a.entryPosition;
|
|
48635
48854
|
return entryPosition;
|
|
48636
|
-
}));
|
|
48855
|
+
})));
|
|
48637
48856
|
if (autoEntryPositions && !entryPositionsExist)
|
|
48638
48857
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48639
48858
|
// ------------------------------------------------------------------------
|
|
@@ -48645,11 +48864,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48645
48864
|
}
|
|
48646
48865
|
// ------------------------------------------------------------------------
|
|
48647
48866
|
// update any flights which have no draw generated to keep entries in sync
|
|
48648
|
-
var generatedDrawIds = ((
|
|
48867
|
+
var generatedDrawIds = (_m = (_l = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _l === void 0 ? void 0 : _l.map(function (_a) {
|
|
48649
48868
|
var drawId = _a.drawId;
|
|
48650
48869
|
return drawId;
|
|
48651
|
-
}))
|
|
48652
|
-
var flightsNoDraw = ((
|
|
48870
|
+
})) !== null && _m !== void 0 ? _m : [];
|
|
48871
|
+
var flightsNoDraw = ((_o = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _o === void 0 ? void 0 : _o.filter(function (flight) { return !generatedDrawIds.includes(flight.drawId); })) || [];
|
|
48653
48872
|
try {
|
|
48654
48873
|
for (var flightsNoDraw_1 = __values(flightsNoDraw), flightsNoDraw_1_1 = flightsNoDraw_1.next(); !flightsNoDraw_1_1.done; flightsNoDraw_1_1 = flightsNoDraw_1.next()) {
|
|
48655
48874
|
var flight_1 = flightsNoDraw_1_1.value;
|
|
@@ -48666,8 +48885,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48666
48885
|
finally { if (e_1) throw e_1.error; }
|
|
48667
48886
|
}
|
|
48668
48887
|
// ------------------------------------------------------------------------
|
|
48669
|
-
var singleDraw = ((
|
|
48670
|
-
(((
|
|
48888
|
+
var singleDraw = ((_p = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _p === void 0 ? void 0 : _p.length) === 1 &&
|
|
48889
|
+
((_r = (_q = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0) <= ((_s = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _s === void 0 ? void 0 : _s.length);
|
|
48671
48890
|
if (!flight &&
|
|
48672
48891
|
!drawDefinition &&
|
|
48673
48892
|
entryStatus &&
|
|
@@ -48684,7 +48903,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48684
48903
|
return decorateResult({ result: result, stack: stack });
|
|
48685
48904
|
var error_1;
|
|
48686
48905
|
if (entryStatus === WITHDRAWN) {
|
|
48687
|
-
(
|
|
48906
|
+
(_t = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _t === void 0 ? void 0 : _t.every(function (flight) {
|
|
48688
48907
|
var result = updateEntryStatus(flight.drawEntries);
|
|
48689
48908
|
if (result.error) {
|
|
48690
48909
|
error_1 = result.error;
|
|
@@ -48696,7 +48915,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48696
48915
|
});
|
|
48697
48916
|
return true;
|
|
48698
48917
|
});
|
|
48699
|
-
(
|
|
48918
|
+
(_u = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _u === void 0 ? void 0 : _u.every(function (drawDefinition) {
|
|
48700
48919
|
var _a;
|
|
48701
48920
|
var result = updateEntryStatus(drawDefinition.entries);
|
|
48702
48921
|
if (result.error) {
|
|
@@ -48716,8 +48935,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48716
48935
|
if (autoEntryPositions)
|
|
48717
48936
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48718
48937
|
try {
|
|
48719
|
-
for (var
|
|
48720
|
-
var drawDefinition_1 =
|
|
48938
|
+
for (var _x = __values((_v = event === null || event === void 0 ? void 0 : event.drawDefinitions) !== null && _v !== void 0 ? _v : []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
48939
|
+
var drawDefinition_1 = _y.value;
|
|
48721
48940
|
if (modifiedDrawIds.length &&
|
|
48722
48941
|
!modifiedDrawIds.includes(drawDefinition_1.drawId))
|
|
48723
48942
|
continue;
|
|
@@ -48731,7 +48950,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48731
48950
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
48732
48951
|
finally {
|
|
48733
48952
|
try {
|
|
48734
|
-
if (
|
|
48953
|
+
if (_y && !_y.done && (_c = _x.return)) _c.call(_x);
|
|
48735
48954
|
}
|
|
48736
48955
|
finally { if (e_2) throw e_2.error; }
|
|
48737
48956
|
}
|
|
@@ -49019,8 +49238,8 @@ function participantInFlightEntries(_a) {
|
|
|
49019
49238
|
}
|
|
49020
49239
|
|
|
49021
49240
|
function removeEventEntries(_a) {
|
|
49022
|
-
var _b, _c, _d, _e, _f;
|
|
49023
|
-
var
|
|
49241
|
+
var _b, _c, _d, _e, _f, _g;
|
|
49242
|
+
var _h = _a.autoEntryPositions, autoEntryPositions = _h === void 0 ? true : _h, _j = _a.participantIds, participantIds = _j === void 0 ? [] : _j, entryStatuses = _a.entryStatuses, stage = _a.stage, event = _a.event;
|
|
49024
49243
|
var stack = 'removeEventEntries';
|
|
49025
49244
|
if (!(event === null || event === void 0 ? void 0 : event.eventId))
|
|
49026
49245
|
return { error: MISSING_EVENT };
|
|
@@ -49070,7 +49289,7 @@ function removeEventEntries(_a) {
|
|
|
49070
49289
|
if (!(participantIds === null || participantIds === void 0 ? void 0 : participantIds.length))
|
|
49071
49290
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: [] });
|
|
49072
49291
|
var participantIdsRemoved = [];
|
|
49073
|
-
event.entries = (event.entries
|
|
49292
|
+
event.entries = ((_e = event.entries) !== null && _e !== void 0 ? _e : []).filter(function (entry) {
|
|
49074
49293
|
var keepEntry = !participantIds.includes(entry === null || entry === void 0 ? void 0 : entry.participantId);
|
|
49075
49294
|
if (!keepEntry)
|
|
49076
49295
|
participantIdsRemoved.push(entry.participantId);
|
|
@@ -49083,11 +49302,12 @@ function removeEventEntries(_a) {
|
|
|
49083
49302
|
}
|
|
49084
49303
|
// also remove entry from all flights and drawDefinitions
|
|
49085
49304
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
49086
|
-
(
|
|
49305
|
+
(_f = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _f === void 0 ? void 0 : _f.forEach(function (flight) {
|
|
49087
49306
|
flight.drawEntries = (flight.drawEntries || []).filter(function (entry) { return !participantIds.includes(entry.participantId); });
|
|
49088
49307
|
});
|
|
49089
|
-
(
|
|
49090
|
-
|
|
49308
|
+
(_g = event.drawDefinitions) === null || _g === void 0 ? void 0 : _g.forEach(function (drawDefinition) {
|
|
49309
|
+
var _a;
|
|
49310
|
+
drawDefinition.entries = ((_a = drawDefinition.entries) !== null && _a !== void 0 ? _a : []).filter(function (entry) { return !participantIds.includes(entry.participantId); });
|
|
49091
49311
|
});
|
|
49092
49312
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: participantIdsRemoved });
|
|
49093
49313
|
}
|
|
@@ -49264,6 +49484,7 @@ function addEventEntries(params) {
|
|
|
49264
49484
|
|
|
49265
49485
|
function removeIndividualParticipantIds(_a) {
|
|
49266
49486
|
var e_1, _b;
|
|
49487
|
+
var _c, _d, _e;
|
|
49267
49488
|
var addIndividualParticipantsToEvents = _a.addIndividualParticipantsToEvents, individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, tournamentRecord = _a.tournamentRecord, suppressErrors = _a.suppressErrors;
|
|
49268
49489
|
var stack = 'removeIndividualParticipantIds';
|
|
49269
49490
|
if (!tournamentRecord)
|
|
@@ -49273,7 +49494,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49273
49494
|
});
|
|
49274
49495
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
49275
49496
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
49276
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49497
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
49277
49498
|
var groupingParticipant = tournamentParticipants.find(function (participant) {
|
|
49278
49499
|
return participant.participantId === groupingParticipantId;
|
|
49279
49500
|
});
|
|
@@ -49299,7 +49520,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49299
49520
|
return decorateResult({ result: result, stack: stack });
|
|
49300
49521
|
if (addIndividualParticipantsToEvents) {
|
|
49301
49522
|
var _loop_1 = function (event_1) {
|
|
49302
|
-
var enteredIds = (event_1.entries
|
|
49523
|
+
var enteredIds = ((_e = event_1.entries) !== null && _e !== void 0 ? _e : [])
|
|
49303
49524
|
.map(function (_a) {
|
|
49304
49525
|
var participantId = _a.participantId;
|
|
49305
49526
|
return participantId;
|
|
@@ -49316,15 +49537,15 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49316
49537
|
}
|
|
49317
49538
|
};
|
|
49318
49539
|
try {
|
|
49319
|
-
for (var
|
|
49320
|
-
var event_1 =
|
|
49540
|
+
for (var _f = __values((_d = tournamentRecord.events) !== null && _d !== void 0 ? _d : []), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
49541
|
+
var event_1 = _g.value;
|
|
49321
49542
|
_loop_1(event_1);
|
|
49322
49543
|
}
|
|
49323
49544
|
}
|
|
49324
49545
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
49325
49546
|
finally {
|
|
49326
49547
|
try {
|
|
49327
|
-
if (
|
|
49548
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
49328
49549
|
}
|
|
49329
49550
|
finally { if (e_1) throw e_1.error; }
|
|
49330
49551
|
}
|
|
@@ -49342,8 +49563,8 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49342
49563
|
}
|
|
49343
49564
|
function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
49344
49565
|
var _b;
|
|
49345
|
-
var _c;
|
|
49346
|
-
var
|
|
49566
|
+
var _c, _d;
|
|
49567
|
+
var _e = _a.individualParticipantIds, individualParticipantIds = _e === void 0 ? [] : _e, groupingParticipant = _a.groupingParticipant, tournamentRecord = _a.tournamentRecord, suppressErrors = _a.suppressErrors, mappedMatchUps = _a.mappedMatchUps, participants = _a.participants;
|
|
49347
49568
|
var removed = [];
|
|
49348
49569
|
if (!groupingParticipant)
|
|
49349
49570
|
return { removed: removed };
|
|
@@ -49364,9 +49585,9 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49364
49585
|
var eventId = _a.eventId;
|
|
49365
49586
|
return eventId;
|
|
49366
49587
|
});
|
|
49367
|
-
var updatedIndividualParticipantIds = (groupingParticipant.individualParticipantIds
|
|
49588
|
+
var updatedIndividualParticipantIds = ((_d = groupingParticipant.individualParticipantIds) !== null && _d !== void 0 ? _d : []).filter(function (participantId) {
|
|
49368
49589
|
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
49369
|
-
var _e;
|
|
49590
|
+
var _e, _f, _g, _h, _j, _k;
|
|
49370
49591
|
var targetParticipant = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.includes(participantId);
|
|
49371
49592
|
var scoredParticipantGroupingMatchUps = targetParticipant &&
|
|
49372
49593
|
((_e = participants === null || participants === void 0 ? void 0 : participants.find(function (participant) { return participant.participantId === participantId; })) === null || _e === void 0 ? void 0 : _e.matchUps.filter(function (_a) {
|
|
@@ -49386,31 +49607,30 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49386
49607
|
if (removeParticipant) {
|
|
49387
49608
|
removed.push(participantId);
|
|
49388
49609
|
try {
|
|
49389
|
-
for (var
|
|
49390
|
-
var event_2 =
|
|
49610
|
+
for (var _l = __values((_f = tournamentRecord.events) !== null && _f !== void 0 ? _f : []), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
49611
|
+
var event_2 = _m.value;
|
|
49391
49612
|
try {
|
|
49392
|
-
for (var
|
|
49393
|
-
var drawDefinition =
|
|
49613
|
+
for (var _o = (e_3 = void 0, __values((_g = event_2.drawDefinitions) !== null && _g !== void 0 ? _g : [])), _p = _o.next(); !_p.done; _p = _o.next()) {
|
|
49614
|
+
var drawDefinition = _p.value;
|
|
49394
49615
|
var extension = findExtension$2({
|
|
49395
49616
|
element: drawDefinition,
|
|
49396
49617
|
name: LINEUPS,
|
|
49397
49618
|
}).extension;
|
|
49398
49619
|
var lineUp = extension === null || extension === void 0 ? void 0 : extension.value[groupingParticipant.participantId];
|
|
49399
49620
|
if (extension && lineUp) {
|
|
49400
|
-
|
|
49621
|
+
extension.value[groupingParticipant.participantId] = lineUp.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
49401
49622
|
addExtension$1({ element: drawDefinition, extension: extension });
|
|
49402
49623
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
49403
49624
|
}
|
|
49404
|
-
var matchUps = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps
|
|
49405
|
-
[];
|
|
49625
|
+
var matchUps = (_h = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps) !== null && _h !== void 0 ? _h : [];
|
|
49406
49626
|
try {
|
|
49407
49627
|
for (var matchUps_1 = (e_4 = void 0, __values(matchUps)), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
49408
49628
|
var matchUp = matchUps_1_1.value;
|
|
49409
|
-
var sides = matchUp.sides
|
|
49629
|
+
var sides = (_j = matchUp.sides) !== null && _j !== void 0 ? _j : [];
|
|
49410
49630
|
try {
|
|
49411
49631
|
for (var sides_1 = (e_5 = void 0, __values(sides)), sides_1_1 = sides_1.next(); !sides_1_1.done; sides_1_1 = sides_1.next()) {
|
|
49412
49632
|
var side = sides_1_1.value;
|
|
49413
|
-
var lineUp_1 = side.lineUp
|
|
49633
|
+
var lineUp_1 = (_k = side.lineUp) !== null && _k !== void 0 ? _k : [];
|
|
49414
49634
|
var containsParticipant = lineUp_1.find(function (assignment) { return assignment.participantId === participantId; });
|
|
49415
49635
|
if (containsParticipant) {
|
|
49416
49636
|
side.lineUp = lineUp_1.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
@@ -49443,7 +49663,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49443
49663
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
49444
49664
|
finally {
|
|
49445
49665
|
try {
|
|
49446
|
-
if (
|
|
49666
|
+
if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
|
|
49447
49667
|
}
|
|
49448
49668
|
finally { if (e_3) throw e_3.error; }
|
|
49449
49669
|
}
|
|
@@ -49452,7 +49672,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49452
49672
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
49453
49673
|
finally {
|
|
49454
49674
|
try {
|
|
49455
|
-
if (
|
|
49675
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
49456
49676
|
}
|
|
49457
49677
|
finally { if (e_2) throw e_2.error; }
|
|
49458
49678
|
}
|
|
@@ -49475,15 +49695,16 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49475
49695
|
result);
|
|
49476
49696
|
}
|
|
49477
49697
|
function removeParticipantIdsFromAllTeams(_a) {
|
|
49478
|
-
var _b
|
|
49698
|
+
var _b;
|
|
49699
|
+
var _c = _a.participantRole, participantRole = _c === void 0 ? ParticipantRoleEnum.Competitor : _c, _d = _a.individualParticipantIds, individualParticipantIds = _d === void 0 ? [] : _d, _e = _a.groupingTypes, groupingTypes = _e === void 0 ? [ParticipantTypeEnum.Team, ParticipantTypeEnum.Group] : _e, tournamentRecord = _a.tournamentRecord;
|
|
49479
49700
|
if (!tournamentRecord)
|
|
49480
49701
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
49481
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49482
|
-
var
|
|
49702
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49703
|
+
var _f = getParticipants$1({
|
|
49483
49704
|
withMatchUps: true,
|
|
49484
49705
|
tournamentRecord: tournamentRecord,
|
|
49485
49706
|
withEvents: true,
|
|
49486
|
-
}), participants =
|
|
49707
|
+
}), participants = _f.participants, mappedMatchUps = _f.mappedMatchUps;
|
|
49487
49708
|
var modifications = 0;
|
|
49488
49709
|
tournamentParticipants
|
|
49489
49710
|
.filter(function (participant) {
|
|
@@ -49538,10 +49759,11 @@ function deleteParticipants(params) {
|
|
|
49538
49759
|
withDraws: true,
|
|
49539
49760
|
}).participants) !== null && _f !== void 0 ? _f : [];
|
|
49540
49761
|
var getPlacedPairParticipantIds = function () {
|
|
49541
|
-
var
|
|
49762
|
+
var _a;
|
|
49763
|
+
var matchUps = (_a = allTournamentMatchUps({
|
|
49542
49764
|
matchUpFilters: { drawIds: teamDrawIds, matchUpTypes: [DOUBLES$1] },
|
|
49543
49765
|
tournamentRecord: tournamentRecord,
|
|
49544
|
-
}).matchUps
|
|
49766
|
+
}).matchUps) !== null && _a !== void 0 ? _a : [];
|
|
49545
49767
|
var placedPairParticipantIds = matchUps
|
|
49546
49768
|
.map(function (_a) {
|
|
49547
49769
|
var sides = _a.sides;
|
|
@@ -49697,7 +49919,7 @@ function getStageEntries(_a) {
|
|
|
49697
49919
|
}
|
|
49698
49920
|
|
|
49699
49921
|
function destroyGroupEntry(_a) {
|
|
49700
|
-
var _b;
|
|
49922
|
+
var _b, _c, _d;
|
|
49701
49923
|
var removeGroupParticipant = _a.removeGroupParticipant, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, participantId = _a.participantId, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
49702
49924
|
var stack = 'destroyGroupEntry';
|
|
49703
49925
|
if (!tournamentRecord)
|
|
@@ -49710,7 +49932,7 @@ function destroyGroupEntry(_a) {
|
|
|
49710
49932
|
![TypeEnum.Doubles, TypeEnum.Team].includes(event.eventType)) {
|
|
49711
49933
|
return decorateResult({ result: { error: INVALID_EVENT_TYPE }, stack: stack });
|
|
49712
49934
|
}
|
|
49713
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49935
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49714
49936
|
var participant = tournamentParticipants.find(function (participant) { return participant.participantId === participantId; });
|
|
49715
49937
|
if (!participant) {
|
|
49716
49938
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -49721,7 +49943,7 @@ function destroyGroupEntry(_a) {
|
|
|
49721
49943
|
(participant.participantType === PAIR && event.eventType !== DOUBLES)) {
|
|
49722
49944
|
return { error: INVALID_PARTICIPANT_TYPE };
|
|
49723
49945
|
}
|
|
49724
|
-
var eventEntries = event.entries
|
|
49946
|
+
var eventEntries = (_c = event.entries) !== null && _c !== void 0 ? _c : [];
|
|
49725
49947
|
var entry = eventEntries.find(function (entry) { return entry.participantId === participantId; });
|
|
49726
49948
|
if (!entry)
|
|
49727
49949
|
return { error: PARTICIPANT_ENTRY_NOT_FOUND };
|
|
@@ -49746,10 +49968,9 @@ function destroyGroupEntry(_a) {
|
|
|
49746
49968
|
.filter(Boolean);
|
|
49747
49969
|
// find only those individualParticipantIds which do not occur MULTIPLE TIMES in PAIRs/GROUPs in the event.entries or drawEntries
|
|
49748
49970
|
// this scenario can occur in e.g. ITA tournaments where an individual participant is paired multiple times across flights
|
|
49749
|
-
var individualParticipantIds = (
|
|
49971
|
+
var individualParticipantIds = (_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.filter(function (participantId) {
|
|
49750
49972
|
return arrayIndices(participantId, individualParticipantIdsInGroups).length === 1;
|
|
49751
49973
|
});
|
|
49752
|
-
// const individualParticipantIds = participant.individualParticipantIds;
|
|
49753
49974
|
// remove the group participant from event entries
|
|
49754
49975
|
var result = removeEventEntries({
|
|
49755
49976
|
participantIds: [participantId],
|
|
@@ -49820,16 +50041,6 @@ function destroyPairEntries(params) {
|
|
|
49820
50041
|
return destroyedCount ? __assign({ destroyedCount: destroyedCount }, SUCCESS) : { error: errors };
|
|
49821
50042
|
}
|
|
49822
50043
|
|
|
49823
|
-
/**
|
|
49824
|
-
*
|
|
49825
|
-
* @param {string} drawId - id of drawDefinition within which structure is found
|
|
49826
|
-
* @param {string} structureId - id of structure of drawPosition
|
|
49827
|
-
* @param {number} drawPosition - number of drawPosition for which actions are to be returned
|
|
49828
|
-
* @param {boolean} replaceWithBye - boolean whether or not to replace with BYE
|
|
49829
|
-
* @param {boolean} destroyPair - if { participantType: PAIR } it is possible to destroy pair entry before modifying entryStatus
|
|
49830
|
-
* @param {string} entryStatus - change the entry status of the removed participant to either ALTERNATE or WITHDRAWN
|
|
49831
|
-
*
|
|
49832
|
-
*/
|
|
49833
50044
|
function removeDrawPositionAssignment(params) {
|
|
49834
50045
|
var tournamentRecord = params.tournamentRecord, replaceWithBye = params.replaceWithBye, drawDefinition = params.drawDefinition, destroyPair = params.destroyPair, entryStatus = params.entryStatus, matchUpsMap = params.matchUpsMap, drawId = params.drawId;
|
|
49835
50046
|
var stack = 'removeDrawPositionAssignment';
|
|
@@ -49844,7 +50055,7 @@ function removeDrawPositionAssignment(params) {
|
|
|
49844
50055
|
tournamentRecord: tournamentRecord_1,
|
|
49845
50056
|
participantId: participantId,
|
|
49846
50057
|
}).participant;
|
|
49847
|
-
var _a = participant
|
|
50058
|
+
var _a = participant !== null && participant !== void 0 ? participant : {}, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
49848
50059
|
if (destroyPair && participantType === PAIR) {
|
|
49849
50060
|
var result_1 = destroyPairEntry({
|
|
49850
50061
|
tournamentRecord: tournamentRecord_1,
|
|
@@ -53766,13 +53977,14 @@ function getEligibleVoluntaryConsolationParticipants(params) {
|
|
|
53766
53977
|
}
|
|
53767
53978
|
|
|
53768
53979
|
function getParticipantEventDetails(_a) {
|
|
53980
|
+
var _b, _c;
|
|
53769
53981
|
var tournamentRecord = _a.tournamentRecord, participantId = _a.participantId;
|
|
53770
53982
|
if (!tournamentRecord)
|
|
53771
53983
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53772
53984
|
if (!participantId)
|
|
53773
53985
|
return { error: MISSING_PARTICIPANT_ID };
|
|
53774
53986
|
// relveantParticipantIds is the target participantId along with any TEAM or PAIR participantIds to which participantId belongs
|
|
53775
|
-
var relevantParticipantIds = [participantId].concat((tournamentRecord.participants
|
|
53987
|
+
var relevantParticipantIds = [participantId].concat(((_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [])
|
|
53776
53988
|
.filter(function (participant) {
|
|
53777
53989
|
var _a;
|
|
53778
53990
|
return (participant === null || participant === void 0 ? void 0 : participant.participantType) &&
|
|
@@ -53780,9 +53992,10 @@ function getParticipantEventDetails(_a) {
|
|
|
53780
53992
|
((_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId));
|
|
53781
53993
|
})
|
|
53782
53994
|
.map(function (participant) { return participant.participantId; }));
|
|
53783
|
-
var relevantEvents = (tournamentRecord.events
|
|
53995
|
+
var relevantEvents = ((_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [])
|
|
53784
53996
|
.filter(function (event) {
|
|
53785
|
-
var
|
|
53997
|
+
var _a;
|
|
53998
|
+
var enteredParticipantIds = ((_a = event === null || event === void 0 ? void 0 : event.entries) !== null && _a !== void 0 ? _a : []).map(function (entry) { return entry.participantId; });
|
|
53786
53999
|
return overlap(enteredParticipantIds, relevantParticipantIds);
|
|
53787
54000
|
})
|
|
53788
54001
|
.map(function (event) { return ({ eventName: event.eventName, eventId: event.eventId }); });
|
|
@@ -53811,6 +54024,7 @@ function getDerivedPositionAssignments(_a) {
|
|
|
53811
54024
|
}
|
|
53812
54025
|
|
|
53813
54026
|
function getRelevantParticipantIdsMap(_a) {
|
|
54027
|
+
var _b;
|
|
53814
54028
|
var processParticipantId = _a.processParticipantId, // optional method which is passed each participantId
|
|
53815
54029
|
tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord;
|
|
53816
54030
|
if (typeof tournamentRecord !== 'object' &&
|
|
@@ -53822,7 +54036,7 @@ function getRelevantParticipantIdsMap(_a) {
|
|
|
53822
54036
|
? Object.values(tournamentRecords)
|
|
53823
54037
|
.map(function (tournamentRecord) { return (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || []; })
|
|
53824
54038
|
.flat()
|
|
53825
|
-
: (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
54039
|
+
: (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
53826
54040
|
var relevantParticipantIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(allParticipants.map(function (_a) {
|
|
53827
54041
|
var _b;
|
|
53828
54042
|
var participantId = _a.participantId, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
@@ -53900,21 +54114,21 @@ function participantScheduledMatchUps(_a) {
|
|
|
53900
54114
|
|
|
53901
54115
|
function annotateParticipant(params) {
|
|
53902
54116
|
var e_1, _a, e_2, _b;
|
|
53903
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
53904
|
-
var
|
|
54117
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
54118
|
+
var _q = params.withScaleValues, withScaleValues = _q === void 0 ? true : _q, eventsPublishStatuses = params.eventsPublishStatuses, _r = params.withEvents, withEvents = _r === void 0 ? true : _r, _s = params.withDraws, withDraws = _s === void 0 ? true : _s, participantIdMap = params.participantIdMap, scheduleAnalysis = params.scheduleAnalysis, derivedDrawInfo = params.derivedDrawInfo, usePublishState = params.usePublishState, withStatistics = params.withStatistics, withOpponents = params.withOpponents, withMatchUps = params.withMatchUps, withSeeding = params.withSeeding, participant = params.participant, withISO2 = params.withISO2, withIOC = params.withIOC;
|
|
53905
54119
|
var scheduleConflicts = [];
|
|
53906
54120
|
var scheduleItems = [];
|
|
53907
54121
|
if (withIOC || withISO2)
|
|
53908
54122
|
addNationalityCode({ participant: participant, withIOC: withIOC, withISO2: withISO2 });
|
|
53909
54123
|
if (withScaleValues) {
|
|
53910
|
-
var
|
|
54124
|
+
var _t = getScaleValues({ participant: participant }), ratings = _t.ratings, rankings = _t.rankings;
|
|
53911
54125
|
participant.rankings = rankings;
|
|
53912
54126
|
participant.ratings = ratings;
|
|
53913
54127
|
}
|
|
53914
54128
|
var participantId = participant === null || participant === void 0 ? void 0 : participant.participantId;
|
|
53915
54129
|
if (!participantId || !participantIdMap[participantId])
|
|
53916
54130
|
return {};
|
|
53917
|
-
var
|
|
54131
|
+
var _u = participantIdMap[participantId], potentialMatchUps = _u.potentialMatchUps, opponents = _u.opponents, matchUps = _u.matchUps, events = _u.events, losses = _u.losses, draws = _u.draws, wins = _u.wins;
|
|
53918
54132
|
var denominator = wins + losses;
|
|
53919
54133
|
var numerator = wins;
|
|
53920
54134
|
var statValue = denominator && numerator / denominator;
|
|
@@ -53972,7 +54186,7 @@ function annotateParticipant(params) {
|
|
|
53972
54186
|
_b);
|
|
53973
54187
|
})), false));
|
|
53974
54188
|
var _loop_1 = function (participantEvent) {
|
|
53975
|
-
var e_3,
|
|
54189
|
+
var e_3, _v, e_4, _w, e_5, _x;
|
|
53976
54190
|
var getScaleAccessor = function (scaleName) {
|
|
53977
54191
|
return [SCALE$1, SEEDING$1, participantEvent.eventType, scaleName].join('.');
|
|
53978
54192
|
};
|
|
@@ -54024,15 +54238,15 @@ function annotateParticipant(params) {
|
|
|
54024
54238
|
participantEvent.seedAssignments = seedAssignments;
|
|
54025
54239
|
}
|
|
54026
54240
|
else {
|
|
54027
|
-
var
|
|
54241
|
+
var _y = participantEvent.category || {}, categoryName = _y.categoryName, ageCategoryCode = _y.ageCategoryCode;
|
|
54028
54242
|
var scaleItem = void 0;
|
|
54029
54243
|
try {
|
|
54030
|
-
for (var
|
|
54244
|
+
for (var _z = (e_3 = void 0, __values([
|
|
54031
54245
|
participantEvent.eventId,
|
|
54032
54246
|
ageCategoryCode,
|
|
54033
54247
|
categoryName,
|
|
54034
|
-
])),
|
|
54035
|
-
var scaleName =
|
|
54248
|
+
])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
54249
|
+
var scaleName = _0.value;
|
|
54036
54250
|
var scaleAttributes = {
|
|
54037
54251
|
eventType: participantEvent.eventType,
|
|
54038
54252
|
scaleType: SEEDING$1,
|
|
@@ -54051,7 +54265,7 @@ function annotateParticipant(params) {
|
|
|
54051
54265
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
54052
54266
|
finally {
|
|
54053
54267
|
try {
|
|
54054
|
-
if (
|
|
54268
|
+
if (_0 && !_0.done && (_v = _z.return)) _v.call(_z);
|
|
54055
54269
|
}
|
|
54056
54270
|
finally { if (e_3) throw e_3.error; }
|
|
54057
54271
|
}
|
|
@@ -54068,8 +54282,8 @@ function annotateParticipant(params) {
|
|
|
54068
54282
|
}
|
|
54069
54283
|
if ((_k = participantEvent.drawIds) === null || _k === void 0 ? void 0 : _k.length) {
|
|
54070
54284
|
try {
|
|
54071
|
-
for (var
|
|
54072
|
-
var flightDrawId =
|
|
54285
|
+
for (var _1 = (e_4 = void 0, __values(participantEvent.drawIds || [])), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
54286
|
+
var flightDrawId = _2.value;
|
|
54073
54287
|
var drawSeedPublishingDisabled = ((_l = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _l === void 0 ? void 0 : _l.length) &&
|
|
54074
54288
|
!((_m = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _m === void 0 ? void 0 : _m.includes(flightDrawId));
|
|
54075
54289
|
if (eventSeedingPublished && !drawSeedPublishingDisabled) {
|
|
@@ -54081,15 +54295,15 @@ function annotateParticipant(params) {
|
|
|
54081
54295
|
// preserve filtering of MAIN/QUALIFYING seedValues, if present
|
|
54082
54296
|
if (seedAssignments && participantEvent.seedAssignments) {
|
|
54083
54297
|
try {
|
|
54084
|
-
for (var
|
|
54085
|
-
var key =
|
|
54298
|
+
for (var _3 = (e_5 = void 0, __values(Object.keys(participantEvent.seedAssignments))), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
54299
|
+
var key = _4.value;
|
|
54086
54300
|
participantEvent.seedAssignments[key] = seedAssignments[key];
|
|
54087
54301
|
}
|
|
54088
54302
|
}
|
|
54089
54303
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
54090
54304
|
finally {
|
|
54091
54305
|
try {
|
|
54092
|
-
if (
|
|
54306
|
+
if (_4 && !_4.done && (_x = _3.return)) _x.call(_3);
|
|
54093
54307
|
}
|
|
54094
54308
|
finally { if (e_5) throw e_5.error; }
|
|
54095
54309
|
}
|
|
@@ -54103,7 +54317,7 @@ function annotateParticipant(params) {
|
|
|
54103
54317
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
54104
54318
|
finally {
|
|
54105
54319
|
try {
|
|
54106
|
-
if (
|
|
54320
|
+
if (_2 && !_2.done && (_w = _1.return)) _w.call(_1);
|
|
54107
54321
|
}
|
|
54108
54322
|
finally { if (e_4) throw e_4.error; }
|
|
54109
54323
|
}
|
|
@@ -54139,9 +54353,9 @@ function annotateParticipant(params) {
|
|
|
54139
54353
|
}
|
|
54140
54354
|
var allParticipantMatchUps = participantMatchUps.concat(participantPotentialMatchUps);
|
|
54141
54355
|
// scheduledMatchUps are a participant's matchUps separated by date and sorted by scheduledTime
|
|
54142
|
-
var scheduledMatchUps = ((_o = participantScheduledMatchUps({
|
|
54356
|
+
var scheduledMatchUps = (_p = (_o = participantScheduledMatchUps({
|
|
54143
54357
|
matchUps: allParticipantMatchUps,
|
|
54144
|
-
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps)
|
|
54358
|
+
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps) !== null && _p !== void 0 ? _p : [];
|
|
54145
54359
|
var scheduledMinutesDifference = (scheduleAnalysis || {}).scheduledMinutesDifference;
|
|
54146
54360
|
var dates = Object.keys(scheduledMatchUps);
|
|
54147
54361
|
dates.forEach(function (date) {
|
|
@@ -54967,7 +55181,7 @@ function getParticipantMembership(_a) {
|
|
|
54967
55181
|
participantFilters: { participantTypes: [TEAM, PAIR, GROUP] },
|
|
54968
55182
|
tournamentRecord: tournamentRecord,
|
|
54969
55183
|
}).participants;
|
|
54970
|
-
var memberOf = (participants
|
|
55184
|
+
var memberOf = (participants !== null && participants !== void 0 ? participants : []).filter(function (participant) {
|
|
54971
55185
|
var _a;
|
|
54972
55186
|
return (_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId);
|
|
54973
55187
|
});
|
|
@@ -54984,16 +55198,17 @@ function getParticipantMembership(_a) {
|
|
|
54984
55198
|
|
|
54985
55199
|
function getParticipantSchedules(_a) {
|
|
54986
55200
|
var e_1, _b;
|
|
54987
|
-
var _c
|
|
55201
|
+
var _c, _d, _e;
|
|
55202
|
+
var _f = _a.participantFilters, participantFilters = _f === void 0 ? {} : _f, tournamentRecord = _a.tournamentRecord;
|
|
54988
55203
|
if (!tournamentRecord)
|
|
54989
55204
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
54990
55205
|
if (typeof participantFilters !== 'object')
|
|
54991
55206
|
return { error: INVALID_OBJECT, context: { participantFilters: participantFilters } };
|
|
54992
55207
|
var contextFilters = { eventIds: participantFilters.eventIds };
|
|
54993
|
-
var matchUps = allTournamentMatchUps({
|
|
55208
|
+
var matchUps = (_c = allTournamentMatchUps({
|
|
54994
55209
|
tournamentRecord: tournamentRecord,
|
|
54995
55210
|
contextFilters: contextFilters,
|
|
54996
|
-
}).matchUps
|
|
55211
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
54997
55212
|
var matchUpsMap = Object.assign.apply(Object, __spreadArray([{}], __read(matchUps.map(function (matchUp) {
|
|
54998
55213
|
var _a;
|
|
54999
55214
|
return (_a = {}, _a[matchUp.matchUpId] = matchUp, _a);
|
|
@@ -55002,33 +55217,31 @@ function getParticipantSchedules(_a) {
|
|
|
55002
55217
|
var schedule = _a.schedule;
|
|
55003
55218
|
return schedule && Object.keys(schedule).length;
|
|
55004
55219
|
});
|
|
55005
|
-
var sourceMatchUpIds = getMatchUpDependencies({
|
|
55220
|
+
var sourceMatchUpIds = (_d = getMatchUpDependencies({
|
|
55006
55221
|
tournamentRecord: tournamentRecord,
|
|
55007
55222
|
matchUps: matchUps,
|
|
55008
|
-
}).sourceMatchUpIds
|
|
55223
|
+
}).sourceMatchUpIds) !== null && _d !== void 0 ? _d : [];
|
|
55009
55224
|
var participantAggregator = {};
|
|
55010
55225
|
var _loop_1 = function (matchUp) {
|
|
55011
|
-
var e_2,
|
|
55226
|
+
var e_2, _g, e_3, _h;
|
|
55012
55227
|
var sides = matchUp.sides;
|
|
55013
55228
|
var relevantSourceMatchUps;
|
|
55014
|
-
var participants = (sides === null || sides === void 0 ? void 0 : sides.map(function (side) {
|
|
55229
|
+
var participants = (_e = sides === null || sides === void 0 ? void 0 : sides.map(function (side) {
|
|
55015
55230
|
var _a;
|
|
55016
55231
|
if (side.participant) {
|
|
55017
55232
|
return (_a = [side.participant]).concat.apply(_a, __spreadArray([], __read((side.participant.individualParticipants || [])), false));
|
|
55018
55233
|
}
|
|
55019
|
-
else
|
|
55020
|
-
|
|
55021
|
-
|
|
55022
|
-
|
|
55023
|
-
|
|
55024
|
-
|
|
55025
|
-
|
|
55026
|
-
|
|
55027
|
-
});
|
|
55028
|
-
}
|
|
55234
|
+
else if (sourceMatchUpIds[matchUp.matchUpId] &&
|
|
55235
|
+
!relevantSourceMatchUps) {
|
|
55236
|
+
relevantSourceMatchUps = (sourceMatchUpIds[matchUp.matchUpId] || [])
|
|
55237
|
+
.map(function (matchUpId) { return matchUpsMap[matchUpId]; })
|
|
55238
|
+
.filter(function (_a) {
|
|
55239
|
+
var winningSide = _a.winningSide, bye = _a.bye;
|
|
55240
|
+
return !winningSide && !bye;
|
|
55241
|
+
});
|
|
55029
55242
|
}
|
|
55030
55243
|
return undefined;
|
|
55031
|
-
}).filter(Boolean).flat())
|
|
55244
|
+
}).filter(Boolean).flat()) !== null && _e !== void 0 ? _e : [];
|
|
55032
55245
|
try {
|
|
55033
55246
|
for (var participants_1 = (e_2 = void 0, __values(participants)), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
|
|
55034
55247
|
var participant = participants_1_1.value;
|
|
@@ -55046,7 +55259,7 @@ function getParticipantSchedules(_a) {
|
|
|
55046
55259
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
55047
55260
|
finally {
|
|
55048
55261
|
try {
|
|
55049
|
-
if (participants_1_1 && !participants_1_1.done && (
|
|
55262
|
+
if (participants_1_1 && !participants_1_1.done && (_g = participants_1.return)) _g.call(participants_1);
|
|
55050
55263
|
}
|
|
55051
55264
|
finally { if (e_2) throw e_2.error; }
|
|
55052
55265
|
}
|
|
@@ -55075,7 +55288,7 @@ function getParticipantSchedules(_a) {
|
|
|
55075
55288
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55076
55289
|
finally {
|
|
55077
55290
|
try {
|
|
55078
|
-
if (potentialParticipants_1_1 && !potentialParticipants_1_1.done && (
|
|
55291
|
+
if (potentialParticipants_1_1 && !potentialParticipants_1_1.done && (_h = potentialParticipants_1.return)) _h.call(potentialParticipants_1);
|
|
55079
55292
|
}
|
|
55080
55293
|
finally { if (e_3) throw e_3.error; }
|
|
55081
55294
|
}
|
|
@@ -55146,8 +55359,8 @@ var participantRoles = {
|
|
|
55146
55359
|
// add persons to a tournamentRecord and create participants in the process
|
|
55147
55360
|
// include ability to specify a doubles partner by personId
|
|
55148
55361
|
function addPersons(_a) {
|
|
55149
|
-
var _b;
|
|
55150
|
-
var
|
|
55362
|
+
var _b, _c;
|
|
55363
|
+
var _d = _a.participantRole, participantRole = _d === void 0 ? COMPETITOR : _d, tournamentRecord = _a.tournamentRecord, persons = _a.persons;
|
|
55151
55364
|
if (!tournamentRecord)
|
|
55152
55365
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55153
55366
|
if (!Array.isArray(persons))
|
|
@@ -55206,10 +55419,10 @@ function addPersons(_a) {
|
|
|
55206
55419
|
return result;
|
|
55207
55420
|
addedIndividualParticipantsCount = result.addedCount || 0;
|
|
55208
55421
|
var pairParticipants = [];
|
|
55209
|
-
var tournamentParticipants = ((_b = getParticipants$1({
|
|
55422
|
+
var tournamentParticipants = (_c = (_b = getParticipants$1({
|
|
55210
55423
|
participantFilters: { participantTypes: [INDIVIDUAL] },
|
|
55211
55424
|
tournamentRecord: tournamentRecord,
|
|
55212
|
-
})) === null || _b === void 0 ? void 0 : _b.participants)
|
|
55425
|
+
})) === null || _b === void 0 ? void 0 : _b.participants) !== null && _c !== void 0 ? _c : [];
|
|
55213
55426
|
if (participantRole === COMPETITOR) {
|
|
55214
55427
|
persons
|
|
55215
55428
|
.filter(function (_a) {
|
|
@@ -55291,6 +55504,7 @@ function updateTeamEventEntries(_a) {
|
|
|
55291
55504
|
|
|
55292
55505
|
function addIndividualParticipantIds(_a) {
|
|
55293
55506
|
var _b;
|
|
55507
|
+
var _c;
|
|
55294
55508
|
var individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, removeFromOtherTeams = _a.removeFromOtherTeams, tournamentRecord = _a.tournamentRecord;
|
|
55295
55509
|
var stack = 'addIndividualParticipantIds';
|
|
55296
55510
|
if (!tournamentRecord)
|
|
@@ -55300,7 +55514,7 @@ function addIndividualParticipantIds(_a) {
|
|
|
55300
55514
|
});
|
|
55301
55515
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
55302
55516
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
55303
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
55517
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
55304
55518
|
var groupingParticipant = tournamentParticipants.find(function (participant) { return participant.participantId === groupingParticipantId; });
|
|
55305
55519
|
if (!groupingParticipant)
|
|
55306
55520
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -55443,13 +55657,13 @@ function modifyIndividualParticipantIds(_a) {
|
|
|
55443
55657
|
|
|
55444
55658
|
function generateTeamsFromParticipantAttribute(_a) {
|
|
55445
55659
|
var e_1, _b;
|
|
55446
|
-
var _c, _d;
|
|
55447
|
-
var
|
|
55660
|
+
var _c, _d, _e, _f, _g, _h;
|
|
55661
|
+
var _j = _a.addParticipants, addParticipants = _j === void 0 ? true : _j, // optional boolean to disable add
|
|
55448
55662
|
participantAttribute = _a.participantAttribute, tournamentRecord = _a.tournamentRecord, personAttribute = _a.personAttribute, teamNames = _a.teamNames, accessor = _a.accessor, uuids = _a.uuids;
|
|
55449
55663
|
if (!tournamentRecord)
|
|
55450
55664
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55451
55665
|
var teams = {};
|
|
55452
|
-
var individualParticipants = (tournamentRecord.participants
|
|
55666
|
+
var individualParticipants = ((_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : []).filter(function (_a) {
|
|
55453
55667
|
var participantType = _a.participantType, participantRole = _a.participantRole;
|
|
55454
55668
|
return participantType === INDIVIDUAL && participantRole === COMPETITOR;
|
|
55455
55669
|
});
|
|
@@ -55458,25 +55672,25 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55458
55672
|
for (var individualParticipants_1 = __values(individualParticipants), individualParticipants_1_1 = individualParticipants_1.next(); !individualParticipants_1_1.done; individualParticipants_1_1 = individualParticipants_1.next()) {
|
|
55459
55673
|
var individualParticipant = individualParticipants_1_1.value;
|
|
55460
55674
|
var accessorValue = accessor &&
|
|
55461
|
-
((
|
|
55675
|
+
((_d = getAccessorValue({
|
|
55462
55676
|
element: individualParticipant,
|
|
55463
55677
|
accessor: accessor,
|
|
55464
|
-
})) === null ||
|
|
55678
|
+
})) === null || _d === void 0 ? void 0 : _d.value);
|
|
55465
55679
|
var attributeValue = accessorValue ||
|
|
55466
|
-
(personAttribute && ((
|
|
55680
|
+
(personAttribute && ((_e = individualParticipant.person) === null || _e === void 0 ? void 0 : _e[personAttribute])) ||
|
|
55467
55681
|
(participantAttribute && individualParticipant[participantAttribute]);
|
|
55468
55682
|
if (attributeValue) {
|
|
55469
55683
|
if (!Object.keys(teams).includes(attributeValue)) {
|
|
55470
55684
|
teams[attributeValue] = {
|
|
55471
|
-
participantName: (teamNames === null || teamNames === void 0 ? void 0 : teamNames[teamIndex])
|
|
55472
|
-
participantId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop())
|
|
55685
|
+
participantName: (_f = teamNames === null || teamNames === void 0 ? void 0 : teamNames[teamIndex]) !== null && _f !== void 0 ? _f : attributeValue,
|
|
55686
|
+
participantId: (_g = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _g !== void 0 ? _g : UUID(),
|
|
55473
55687
|
individualParticipantIds: [],
|
|
55474
55688
|
participantRole: COMPETITOR,
|
|
55475
55689
|
participantType: TEAM,
|
|
55476
55690
|
};
|
|
55477
55691
|
var extension = {
|
|
55692
|
+
value: personAttribute !== null && personAttribute !== void 0 ? personAttribute : participantAttribute,
|
|
55478
55693
|
name: GROUPING_ATTRIBUTE,
|
|
55479
|
-
value: personAttribute || participantAttribute,
|
|
55480
55694
|
};
|
|
55481
55695
|
addExtension$1({ element: teams[attributeValue], extension: extension });
|
|
55482
55696
|
teamIndex += 1;
|
|
@@ -55493,7 +55707,7 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55493
55707
|
finally { if (e_1) throw e_1.error; }
|
|
55494
55708
|
}
|
|
55495
55709
|
var groupingAttributes = Object.keys(teams);
|
|
55496
|
-
var overlappingTeamParticipantIds = (tournamentRecord.participants
|
|
55710
|
+
var overlappingTeamParticipantIds = ((_h = tournamentRecord.participants) !== null && _h !== void 0 ? _h : [])
|
|
55497
55711
|
.map(function (participant) {
|
|
55498
55712
|
if (participant.participantType !== TEAM)
|
|
55499
55713
|
return undefined;
|
|
@@ -55605,14 +55819,14 @@ function modifyParticipantsSignInStatus(_a) {
|
|
|
55605
55819
|
|
|
55606
55820
|
function scaledTeamAssignment(_a) {
|
|
55607
55821
|
var _b, e_1, _c, e_2, _d, e_3, _e, e_4, _f, e_5, _g, e_6, _h, e_7, _j;
|
|
55608
|
-
var _k, _l, _m, _o, _p;
|
|
55609
|
-
var
|
|
55822
|
+
var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
55823
|
+
var _x = _a.clearExistingAssignments, clearExistingAssignments = _x === void 0 ? true : _x, // by default remove all existing individualParticipantIds from targeted teams
|
|
55610
55824
|
individualParticipantIds = _a.individualParticipantIds, // if scaledParticipants are provided, individualParticipants is ignored
|
|
55611
55825
|
reverseAssignmentOrder = _a.reverseAssignmentOrder, // optional - reverses team order; useful for sequential assignment of participant groupings to ensure balanced distribution
|
|
55612
|
-
|
|
55613
|
-
initialTeamIndex =
|
|
55614
|
-
|
|
55615
|
-
scaledParticipants =
|
|
55826
|
+
_y = _a.initialTeamIndex, // optional - reverses team order; useful for sequential assignment of participant groupings to ensure balanced distribution
|
|
55827
|
+
initialTeamIndex = _y === void 0 ? 0 : _y, // optional - allows assignment to begin at a specified array index; useful for sequential assignment of groups of scaledParticipants
|
|
55828
|
+
_z = _a.scaledParticipants, // optional - allows assignment to begin at a specified array index; useful for sequential assignment of groups of scaledParticipants
|
|
55829
|
+
scaledParticipants = _z === void 0 ? [] : _z, // optional - either scaledParticipants or (individualParticipantIds and scaleName) must be provided
|
|
55616
55830
|
teamParticipantIds = _a.teamParticipantIds, // optional, IF teamsCount is provided then teams will be created
|
|
55617
55831
|
tournamentRecord = _a.tournamentRecord, // supplied automatically by tournamentEngine
|
|
55618
55832
|
scaleAttributes = _a.scaleAttributes, // ignored if scaledParticipants are provided; { scaleName, scaleType, sortOrder, eventType }
|
|
@@ -55650,23 +55864,22 @@ function scaledTeamAssignment(_a) {
|
|
|
55650
55864
|
error: MISSING_VALUE,
|
|
55651
55865
|
};
|
|
55652
55866
|
}
|
|
55653
|
-
var participantIdsToAssign = individualParticipantIds
|
|
55654
|
-
|
|
55655
|
-
|
|
55656
|
-
|
|
55657
|
-
});
|
|
55867
|
+
var participantIdsToAssign = individualParticipantIds !== null && individualParticipantIds !== void 0 ? individualParticipantIds : scaledParticipants.map(function (_a) {
|
|
55868
|
+
var participantId = _a.participantId;
|
|
55869
|
+
return participantId;
|
|
55870
|
+
});
|
|
55658
55871
|
if (reverseAssignmentOrder) {
|
|
55659
55872
|
teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.reverse();
|
|
55660
55873
|
initialTeamIndex += 1; // ensures that the targeted team remains the first team to receive an assignment
|
|
55661
55874
|
}
|
|
55662
55875
|
if (initialTeamIndex > ((teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.length) || 0) - 1)
|
|
55663
55876
|
initialTeamIndex = 0;
|
|
55664
|
-
var orderedTeamParticipantIds = (teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : (_b = teamParticipantIds.slice(initialTeamIndex)).concat.apply(_b, __spreadArray([], __read(teamParticipantIds.slice(0, initialTeamIndex)), false)))
|
|
55877
|
+
var orderedTeamParticipantIds = (_l = teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : (_b = teamParticipantIds.slice(initialTeamIndex)).concat.apply(_b, __spreadArray([], __read(teamParticipantIds.slice(0, initialTeamIndex)), false))) !== null && _l !== void 0 ? _l : [];
|
|
55665
55878
|
var relevantTeams = [];
|
|
55666
55879
|
try {
|
|
55667
55880
|
// build up an array of targeted TEAM participants
|
|
55668
|
-
for (var
|
|
55669
|
-
var participant =
|
|
55881
|
+
for (var _0 = __values((_m = tournamentRecord.participants) !== null && _m !== void 0 ? _m : []), _1 = _0.next(); !_1.done; _1 = _0.next()) {
|
|
55882
|
+
var participant = _1.value;
|
|
55670
55883
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55671
55884
|
if (!orderedTeamParticipantIds.includes(participantId))
|
|
55672
55885
|
continue;
|
|
@@ -55678,28 +55891,28 @@ function scaledTeamAssignment(_a) {
|
|
|
55678
55891
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55679
55892
|
finally {
|
|
55680
55893
|
try {
|
|
55681
|
-
if (
|
|
55894
|
+
if (_1 && !_1.done && (_c = _0.return)) _c.call(_0);
|
|
55682
55895
|
}
|
|
55683
55896
|
finally { if (e_1) throw e_1.error; }
|
|
55684
55897
|
}
|
|
55685
55898
|
if (teamsCount && relevantTeams.length < teamsCount) {
|
|
55686
55899
|
var addCount = teamsCount - ((relevantTeams === null || relevantTeams === void 0 ? void 0 : relevantTeams.length) || 0);
|
|
55687
|
-
var nameBase_1 = teamNameBase
|
|
55900
|
+
var nameBase_1 = teamNameBase !== null && teamNameBase !== void 0 ? teamNameBase : 'Team';
|
|
55688
55901
|
var teamParticipants = generateRange(0, addCount).map(function (i) { return ({
|
|
55689
55902
|
participantName: "".concat(nameBase_1, " ").concat(i + 1),
|
|
55690
55903
|
participantType: TEAM_PARTICIPANT,
|
|
55691
55904
|
participantRole: COMPETITOR,
|
|
55692
55905
|
}); });
|
|
55693
|
-
var
|
|
55906
|
+
var _2 = addParticipants({
|
|
55694
55907
|
participants: teamParticipants,
|
|
55695
55908
|
returnParticipants: true,
|
|
55696
55909
|
tournamentRecord: tournamentRecord,
|
|
55697
|
-
}).participants, participants =
|
|
55910
|
+
}).participants, participants = _2 === void 0 ? [] : _2;
|
|
55698
55911
|
var addedParticipantIds_1 = participants.map(getParticipantId);
|
|
55699
|
-
var addedParticipants = (
|
|
55912
|
+
var addedParticipants = (_p = (_o = tournamentRecord.participants) === null || _o === void 0 ? void 0 : _o.filter(function (_a) {
|
|
55700
55913
|
var participantId = _a.participantId;
|
|
55701
55914
|
return addedParticipantIds_1.includes(participantId);
|
|
55702
|
-
})) !== null &&
|
|
55915
|
+
})) !== null && _p !== void 0 ? _p : [];
|
|
55703
55916
|
relevantTeams.push.apply(relevantTeams, __spreadArray([], __read(addedParticipants), false));
|
|
55704
55917
|
}
|
|
55705
55918
|
if (!relevantTeams.length)
|
|
@@ -55739,19 +55952,19 @@ function scaledTeamAssignment(_a) {
|
|
|
55739
55952
|
}
|
|
55740
55953
|
if (!scaledParticipants.length) {
|
|
55741
55954
|
try {
|
|
55742
|
-
for (var
|
|
55743
|
-
var participant =
|
|
55955
|
+
for (var _3 = __values((_q = tournamentRecord.participants) !== null && _q !== void 0 ? _q : []), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
55956
|
+
var participant = _4.value;
|
|
55744
55957
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55745
55958
|
if (!participantIdsToAssign.includes(participantId))
|
|
55746
55959
|
continue;
|
|
55747
55960
|
if (participantType !== INDIVIDUAL)
|
|
55748
55961
|
return { error: INVALID_PARTICIPANT_TYPE, participant: participant };
|
|
55749
|
-
var scaleItem = (
|
|
55962
|
+
var scaleItem = (_r = participantScaleItem({
|
|
55750
55963
|
scaleAttributes: scaleAttributes,
|
|
55751
55964
|
participant: participant,
|
|
55752
|
-
})) === null ||
|
|
55965
|
+
})) === null || _r === void 0 ? void 0 : _r.scaleItem;
|
|
55753
55966
|
var scaleValue = (scaleAttributes === null || scaleAttributes === void 0 ? void 0 : scaleAttributes.accessor)
|
|
55754
|
-
? (
|
|
55967
|
+
? (_s = scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue) === null || _s === void 0 ? void 0 : _s[scaleAttributes === null || scaleAttributes === void 0 ? void 0 : scaleAttributes.accessor]
|
|
55755
55968
|
: scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue;
|
|
55756
55969
|
var scaledParticipant = { participantId: participantId, scaleValue: scaleValue };
|
|
55757
55970
|
scaledParticipants.push(scaledParticipant);
|
|
@@ -55760,7 +55973,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55760
55973
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55761
55974
|
finally {
|
|
55762
55975
|
try {
|
|
55763
|
-
if (
|
|
55976
|
+
if (_4 && !_4.done && (_e = _3.return)) _e.call(_3);
|
|
55764
55977
|
}
|
|
55765
55978
|
finally { if (e_3) throw e_3.error; }
|
|
55766
55979
|
}
|
|
@@ -55811,11 +56024,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55811
56024
|
try {
|
|
55812
56025
|
// for all events, check if any relevant teams are present
|
|
55813
56026
|
// if a relevant team is present, remove any UNGROUPED participants that are part of that team
|
|
55814
|
-
for (var
|
|
55815
|
-
var event_1 =
|
|
56027
|
+
for (var _5 = __values((_t = tournamentRecord.events) !== null && _t !== void 0 ? _t : []), _6 = _5.next(); !_6.done; _6 = _5.next()) {
|
|
56028
|
+
var event_1 = _6.value;
|
|
55816
56029
|
if (event_1.eventType !== TEAM_EVENT)
|
|
55817
56030
|
continue;
|
|
55818
|
-
var relevantTeamEntries = (event_1.entries
|
|
56031
|
+
var relevantTeamEntries = ((_u = event_1.entries) !== null && _u !== void 0 ? _u : []).filter(function (entry) {
|
|
55819
56032
|
return relevantTeamParticipantIds.includes(entry.participantId);
|
|
55820
56033
|
});
|
|
55821
56034
|
var _loop_1 = function (relevantEntry) {
|
|
@@ -55825,10 +56038,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55825
56038
|
});
|
|
55826
56039
|
var individualParticipantIds_1 = relevantTeam === null || relevantTeam === void 0 ? void 0 : relevantTeam.individualParticipantIds;
|
|
55827
56040
|
// remove any relevant individualParticipant entries from event.entries
|
|
55828
|
-
event_1.entries = (event_1.entries
|
|
56041
|
+
event_1.entries = ((_v = event_1.entries) !== null && _v !== void 0 ? _v : []).filter(function (entry) { return !individualParticipantIds_1.includes(entry.participantId); });
|
|
55829
56042
|
// also remove any relevant individualParticipant entries from drawDefinition.entries
|
|
55830
|
-
(event_1.drawDefinitions
|
|
55831
|
-
|
|
56043
|
+
((_w = event_1.drawDefinitions) !== null && _w !== void 0 ? _w : []).forEach(function (drawDefinition) {
|
|
56044
|
+
var _a;
|
|
56045
|
+
drawDefinition.entries = ((_a = drawDefinition.entries) !== null && _a !== void 0 ? _a : []).filter(function (entry) { return !individualParticipantIds_1.includes(entry.participantId); });
|
|
55832
56046
|
});
|
|
55833
56047
|
// also remove any relevant individualParticipant any flight.drawEntries
|
|
55834
56048
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
@@ -55854,7 +56068,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55854
56068
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
55855
56069
|
finally {
|
|
55856
56070
|
try {
|
|
55857
|
-
if (
|
|
56071
|
+
if (_6 && !_6.done && (_h = _5.return)) _h.call(_5);
|
|
55858
56072
|
}
|
|
55859
56073
|
finally { if (e_6) throw e_6.error; }
|
|
55860
56074
|
}
|
|
@@ -56758,76 +56972,6 @@ function unPublishEvent(_a) {
|
|
|
56758
56972
|
return __assign({ eventId: event.eventId }, SUCCESS);
|
|
56759
56973
|
}
|
|
56760
56974
|
|
|
56761
|
-
/**
|
|
56762
|
-
* return an array of arrays of grouped structureIds => structureGroups
|
|
56763
|
-
* the expectation is that all structures within a drawDefintion are linked
|
|
56764
|
-
* return a boolean whether this condition is met => allSructuresLinked
|
|
56765
|
-
*/
|
|
56766
|
-
function getStructureGroups(_a) {
|
|
56767
|
-
var drawDefinition = _a.drawDefinition;
|
|
56768
|
-
var links = drawDefinition.links || [];
|
|
56769
|
-
var sourceStructureIds = {};
|
|
56770
|
-
var hasDrawFeedProfile = {};
|
|
56771
|
-
var linkedStructureIds = links.map(function (link) {
|
|
56772
|
-
var sourceId = link.source.structureId;
|
|
56773
|
-
var targetId = link.target.structureId;
|
|
56774
|
-
hasDrawFeedProfile[targetId] =
|
|
56775
|
-
hasDrawFeedProfile[targetId] || link.target.feedProfile === DRAW;
|
|
56776
|
-
sourceStructureIds[targetId] = unique(__spreadArray(__spreadArray([], __read((sourceStructureIds[targetId] || [])), false), [
|
|
56777
|
-
sourceId,
|
|
56778
|
-
], false)).filter(Boolean);
|
|
56779
|
-
return [link.source.structureId, link.target.structureId];
|
|
56780
|
-
});
|
|
56781
|
-
// iterate through all groups of structureIds to flatten tree of links between structures
|
|
56782
|
-
var iterations = linkedStructureIds.length;
|
|
56783
|
-
generateRange(0, Math.ceil(iterations / 2)).forEach(function () {
|
|
56784
|
-
linkedStructureIds = generateRange(0, iterations).map(function (index) {
|
|
56785
|
-
var structureIds = linkedStructureIds[index];
|
|
56786
|
-
var mergedWithOverlappingIds = linkedStructureIds.reduce(function (biggest, ids) {
|
|
56787
|
-
var hasOverlap = overlap(structureIds, ids);
|
|
56788
|
-
return hasOverlap ? biggest.concat.apply(biggest, __spreadArray([], __read(ids), false)) : biggest;
|
|
56789
|
-
}, []) || [];
|
|
56790
|
-
return unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(mergedWithOverlappingIds), false)));
|
|
56791
|
-
});
|
|
56792
|
-
});
|
|
56793
|
-
// at this point all linkedStructureIds arrays should be equivalent
|
|
56794
|
-
// use the first of these as the identity array
|
|
56795
|
-
var groupedStructureIds = linkedStructureIds[0];
|
|
56796
|
-
// utility method to recognize equivalent arrays of structureIds
|
|
56797
|
-
var identityLink = function (a, b) { return intersection(a, b).length === a.length; };
|
|
56798
|
-
// check that all arrays of linkedStructureIds are equivalent to identity array
|
|
56799
|
-
var allLinkStructuresLinked = linkedStructureIds
|
|
56800
|
-
.slice(1)
|
|
56801
|
-
.reduce(function (allLinkStructuresLinked, ids) {
|
|
56802
|
-
return allLinkStructuresLinked && identityLink(ids, groupedStructureIds);
|
|
56803
|
-
}, true);
|
|
56804
|
-
// if a drawDefinition contains no links then no structure groups will exist
|
|
56805
|
-
// filter out undefined when there are no links in a drawDefinition
|
|
56806
|
-
var structureGroups = [groupedStructureIds].filter(Boolean);
|
|
56807
|
-
// this is the same as structureGroups, but excludes VOLUNTARY_CONSOLATION
|
|
56808
|
-
var linkCheck = [groupedStructureIds].filter(Boolean);
|
|
56809
|
-
// iterate through all structures to add missing structureIds
|
|
56810
|
-
var structures = drawDefinition.structures || [];
|
|
56811
|
-
structures.forEach(function (structure) {
|
|
56812
|
-
var structureId = structure.structureId, stage = structure.stage;
|
|
56813
|
-
var existingGroup = structureGroups.find(function (group) {
|
|
56814
|
-
return group.includes(structureId);
|
|
56815
|
-
});
|
|
56816
|
-
if (!existingGroup) {
|
|
56817
|
-
structureGroups.push([structureId]);
|
|
56818
|
-
if (stage !== VOLUNTARY_CONSOLATION)
|
|
56819
|
-
linkCheck.push(structureId);
|
|
56820
|
-
}
|
|
56821
|
-
});
|
|
56822
|
-
var allStructuresLinked = allLinkStructuresLinked && linkCheck.length === 1;
|
|
56823
|
-
return {
|
|
56824
|
-
allStructuresLinked: allStructuresLinked,
|
|
56825
|
-
sourceStructureIds: sourceStructureIds,
|
|
56826
|
-
hasDrawFeedProfile: hasDrawFeedProfile,
|
|
56827
|
-
structureGroups: structureGroups,
|
|
56828
|
-
};
|
|
56829
|
-
}
|
|
56830
|
-
|
|
56831
56975
|
function getDrawData(params) {
|
|
56832
56976
|
var _a = params.tournamentParticipants, tournamentParticipants = _a === void 0 ? [] : _a, includePositionAssignments = params.includePositionAssignments, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, _b = params.inContext, inContext = _b === void 0 ? true : _b, drawDefinition = params.drawDefinition, noDeepCopy = params.noDeepCopy, sortConfig = params.sortConfig, context = params.context, event = params.event;
|
|
56833
56977
|
if (!drawDefinition)
|
|
@@ -56872,13 +57016,20 @@ function getDrawData(params) {
|
|
|
56872
57016
|
.sort(function (a, b) { return structureSort(a, b, sortConfig); })
|
|
56873
57017
|
.map(function (structure) {
|
|
56874
57018
|
var _a;
|
|
56875
|
-
|
|
57019
|
+
if (!structure)
|
|
57020
|
+
return;
|
|
57021
|
+
var structureId = structure === null || structure === void 0 ? void 0 : structure.structureId;
|
|
56876
57022
|
var seedAssignments = [];
|
|
56877
57023
|
// pass seedAssignments from { stageSequence: 1 } to other stages
|
|
56878
|
-
if (
|
|
57024
|
+
if (structure.stage &&
|
|
57025
|
+
[
|
|
57026
|
+
StageTypeEnum.Main,
|
|
57027
|
+
StageTypeEnum.Consolation,
|
|
57028
|
+
StageTypeEnum.PlayOff,
|
|
57029
|
+
].includes(structure.stage)) {
|
|
56879
57030
|
seedAssignments = mainStageSeedAssignments;
|
|
56880
57031
|
}
|
|
56881
|
-
if (structure.stage === QUALIFYING) {
|
|
57032
|
+
if ((structure === null || structure === void 0 ? void 0 : structure.stage) === QUALIFYING) {
|
|
56882
57033
|
seedAssignments = qualificationStageSeedAssignments;
|
|
56883
57034
|
}
|
|
56884
57035
|
var _b = getAllStructureMatchUps({
|
|
@@ -56911,16 +57062,18 @@ function getDrawData(params) {
|
|
|
56911
57062
|
participantResult: extension.value,
|
|
56912
57063
|
});
|
|
56913
57064
|
}).filter(function (f) { return f === null || f === void 0 ? void 0 : f.participantResult; });
|
|
56914
|
-
var structureInfo =
|
|
56915
|
-
|
|
56916
|
-
|
|
56917
|
-
|
|
56918
|
-
|
|
56919
|
-
|
|
56920
|
-
|
|
56921
|
-
|
|
56922
|
-
|
|
56923
|
-
|
|
57065
|
+
var structureInfo = structure
|
|
57066
|
+
? (function (_a) {
|
|
57067
|
+
var stageSequence = _a.stageSequence, structureName = _a.structureName, structureType = _a.structureType, matchUpFormat = _a.matchUpFormat, stage = _a.stage;
|
|
57068
|
+
return ({
|
|
57069
|
+
stageSequence: stageSequence,
|
|
57070
|
+
structureName: structureName,
|
|
57071
|
+
structureType: structureType,
|
|
57072
|
+
matchUpFormat: matchUpFormat,
|
|
57073
|
+
stage: stage,
|
|
57074
|
+
});
|
|
57075
|
+
})(structure)
|
|
57076
|
+
: {};
|
|
56924
57077
|
structureInfo.sourceStructureIds = sourceStructureIds[structureId];
|
|
56925
57078
|
structureInfo.hasDrawFeedProfile = hasDrawFeedProfile[structureId];
|
|
56926
57079
|
structureInfo.positionAssignments = positionAssignments;
|
|
@@ -57077,9 +57230,9 @@ function getEventData(params) {
|
|
|
57077
57230
|
|
|
57078
57231
|
function publishEvent(params) {
|
|
57079
57232
|
var _a;
|
|
57080
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
57233
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
57081
57234
|
var policyDefinitions = params.policyDefinitions, drawIds = params.drawIds, structureIds = params.structureIds, stages = params.stages;
|
|
57082
|
-
var includePositionAssignments = params.includePositionAssignments, removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord,
|
|
57235
|
+
var includePositionAssignments = params.includePositionAssignments, removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord, _o = params.status, status = _o === void 0 ? PUBLIC : _o, event = params.event, drawIdsToRemove = params.drawIdsToRemove, drawIdsToAdd = params.drawIdsToAdd, stagesToRemove = params.stagesToRemove, stagesToAdd = params.stagesToAdd, structureIdsToRemove = params.structureIdsToRemove, structureIdsToAdd = params.structureIdsToAdd;
|
|
57083
57236
|
if (!tournamentRecord)
|
|
57084
57237
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57085
57238
|
if (!event)
|
|
@@ -57089,10 +57242,10 @@ function publishEvent(params) {
|
|
|
57089
57242
|
policyDefinitions = appliedPolicies;
|
|
57090
57243
|
}
|
|
57091
57244
|
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
57092
|
-
var eventDrawIds = ((_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
57245
|
+
var eventDrawIds = (_c = (_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
57093
57246
|
var drawId = _a.drawId;
|
|
57094
57247
|
return drawId;
|
|
57095
|
-
}))
|
|
57248
|
+
})) !== null && _c !== void 0 ? _c : [];
|
|
57096
57249
|
var timeItem = getEventTimeItem({
|
|
57097
57250
|
itemType: itemType,
|
|
57098
57251
|
event: event,
|
|
@@ -57102,17 +57255,17 @@ function publishEvent(params) {
|
|
|
57102
57255
|
drawIds = eventDrawIds;
|
|
57103
57256
|
}
|
|
57104
57257
|
else if (!drawIds && ((drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) || (drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.length))) {
|
|
57105
|
-
drawIds = ((
|
|
57258
|
+
drawIds = ((_e = (_d = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _d === void 0 ? void 0 : _d.PUBLIC) === null || _e === void 0 ? void 0 : _e.drawIds) || [];
|
|
57106
57259
|
}
|
|
57107
|
-
drawIds = (drawIds
|
|
57260
|
+
drawIds = (drawIds !== null && drawIds !== void 0 ? drawIds : []).filter(function (drawId) { return !(drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.length) || !drawIdsToRemove.includes(drawId); });
|
|
57108
57261
|
if (drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) {
|
|
57109
57262
|
drawIds = unique(drawIds.concat.apply(drawIds, __spreadArray([], __read(drawIdsToAdd.filter(function (drawId) { return eventDrawIds.includes(drawId); })), false)));
|
|
57110
57263
|
}
|
|
57111
57264
|
if (!structureIds &&
|
|
57112
57265
|
((structureIdsToAdd === null || structureIdsToAdd === void 0 ? void 0 : structureIdsToAdd.length) || (structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length))) {
|
|
57113
|
-
structureIds = ((
|
|
57266
|
+
structureIds = ((_g = (_f = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _f === void 0 ? void 0 : _f.PUBLIC) === null || _g === void 0 ? void 0 : _g.structureIds) || [];
|
|
57114
57267
|
}
|
|
57115
|
-
structureIds = (structureIds
|
|
57268
|
+
structureIds = (structureIds !== null && structureIds !== void 0 ? structureIds : []).filter(function (structureId) {
|
|
57116
57269
|
return !(structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length) ||
|
|
57117
57270
|
!structureIdsToRemove.includes(structureId);
|
|
57118
57271
|
});
|
|
@@ -57120,13 +57273,13 @@ function publishEvent(params) {
|
|
|
57120
57273
|
structureIds = unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(structureIdsToAdd), false)));
|
|
57121
57274
|
}
|
|
57122
57275
|
if (!stages && ((stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) || (stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length))) {
|
|
57123
|
-
stages = ((
|
|
57276
|
+
stages = ((_j = (_h = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _h === void 0 ? void 0 : _h.PUBLIC) === null || _j === void 0 ? void 0 : _j.stages) || [];
|
|
57124
57277
|
}
|
|
57125
|
-
stages = (stages
|
|
57278
|
+
stages = (stages !== null && stages !== void 0 ? stages : []).filter(function (stage) { return !(stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length) || !stagesToRemove.includes(stage); });
|
|
57126
57279
|
if (stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) {
|
|
57127
57280
|
stages = unique(stages.concat.apply(stages, __spreadArray([], __read(stagesToAdd), false)));
|
|
57128
57281
|
}
|
|
57129
|
-
var existingStatusValue = (
|
|
57282
|
+
var existingStatusValue = (_k = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _k === void 0 ? void 0 : _k[status];
|
|
57130
57283
|
var updatedTimeItem = {
|
|
57131
57284
|
itemValue: (_a = {},
|
|
57132
57285
|
_a[status] = __assign(__assign({}, existingStatusValue), { drawIds: drawIds, structureIds: structureIds, stages: stages }),
|
|
@@ -57142,7 +57295,7 @@ function publishEvent(params) {
|
|
|
57142
57295
|
event: event,
|
|
57143
57296
|
}).eventData;
|
|
57144
57297
|
// filter out drawData for unPublished draws
|
|
57145
|
-
var publishState = (
|
|
57298
|
+
var publishState = (_m = (_l = eventData === null || eventData === void 0 ? void 0 : eventData.eventInfo) === null || _l === void 0 ? void 0 : _l.publish) === null || _m === void 0 ? void 0 : _m.state;
|
|
57146
57299
|
eventData.drawsData = eventData.drawsData.filter(function (_a) {
|
|
57147
57300
|
var _b;
|
|
57148
57301
|
var drawId = _a.drawId;
|
|
@@ -58526,6 +58679,7 @@ function analyzeDraws(_a) {
|
|
|
58526
58679
|
var event = eventsMap[eventId];
|
|
58527
58680
|
var structures = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || [];
|
|
58528
58681
|
var structuresData = structures.map(function (structure) {
|
|
58682
|
+
var _a, _b, _c, _d;
|
|
58529
58683
|
var stage = structure.stage, stageSequence = structure.stageSequence, structureId = structure.structureId;
|
|
58530
58684
|
var orderNumber = stageOrder$1[stage];
|
|
58531
58685
|
var inContextStructureMatchUps = getStructureDrawPositionProfiles({
|
|
@@ -58555,9 +58709,9 @@ function analyzeDraws(_a) {
|
|
|
58555
58709
|
var participantId = _a.participantId;
|
|
58556
58710
|
return participantId;
|
|
58557
58711
|
});
|
|
58558
|
-
positionsAssignedCount += (positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length)
|
|
58559
|
-
var unassignedPositionsCount = ((positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length)
|
|
58560
|
-
var
|
|
58712
|
+
positionsAssignedCount += (_a = positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) !== null && _a !== void 0 ? _a : 0;
|
|
58713
|
+
var unassignedPositionsCount = ((_b = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length) !== null && _b !== void 0 ? _b : 0) - ((_c = positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) !== null && _c !== void 0 ? _c : 0);
|
|
58714
|
+
var _e = getRoundMatchUps$1({ matchUps: inContextStructureMatchUps }), roundMatchUps = _e.roundMatchUps, roundProfile = _e.roundProfile, roundNumbers = _e.roundNumbers, maxMatchUpsCount = _e.maxMatchUpsCount;
|
|
58561
58715
|
var activeRounds = roundProfile &&
|
|
58562
58716
|
Object.keys(roundProfile)
|
|
58563
58717
|
.filter(function (roundNumber) { return !roundProfile[roundNumber].inactiveRound; })
|
|
@@ -58569,7 +58723,7 @@ function analyzeDraws(_a) {
|
|
|
58569
58723
|
var inactiveStructure = roundProfile &&
|
|
58570
58724
|
Object.values(roundProfile).every(function (profile) { return profile.inactiveRound; });
|
|
58571
58725
|
return {
|
|
58572
|
-
positionsAssignedCount: (positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length)
|
|
58726
|
+
positionsAssignedCount: (_d = positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) !== null && _d !== void 0 ? _d : 0,
|
|
58573
58727
|
maxWinningSideFirstRoundPosition: maxWinningSideFirstRoundPosition,
|
|
58574
58728
|
unassignedPositionsCount: unassignedPositionsCount,
|
|
58575
58729
|
inactiveStructure: inactiveStructure,
|
|
@@ -58693,7 +58847,7 @@ function setTournamentCategories(_a) {
|
|
|
58693
58847
|
// bulk update when tournament dates change
|
|
58694
58848
|
function updateCourtAvailability(_a) {
|
|
58695
58849
|
var e_1, _b, e_2, _c;
|
|
58696
|
-
var _d, _e;
|
|
58850
|
+
var _d, _e, _f;
|
|
58697
58851
|
var tournamentRecord = _a.tournamentRecord;
|
|
58698
58852
|
if (!tournamentRecord)
|
|
58699
58853
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -58701,8 +58855,8 @@ function updateCourtAvailability(_a) {
|
|
|
58701
58855
|
var tournamentDates = dateRange(startDate, endDate);
|
|
58702
58856
|
var courts = [];
|
|
58703
58857
|
try {
|
|
58704
|
-
for (var
|
|
58705
|
-
var venue =
|
|
58858
|
+
for (var _g = __values(tournamentRecord.venues || []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
58859
|
+
var venue = _h.value;
|
|
58706
58860
|
if ((_d = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _d === void 0 ? void 0 : _d.length)
|
|
58707
58861
|
courts.push.apply(courts, __spreadArray([], __read(venue.courts), false));
|
|
58708
58862
|
}
|
|
@@ -58710,12 +58864,12 @@ function updateCourtAvailability(_a) {
|
|
|
58710
58864
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58711
58865
|
finally {
|
|
58712
58866
|
try {
|
|
58713
|
-
if (
|
|
58867
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
58714
58868
|
}
|
|
58715
58869
|
finally { if (e_1) throw e_1.error; }
|
|
58716
58870
|
}
|
|
58717
58871
|
var _loop_1 = function (court) {
|
|
58718
|
-
var
|
|
58872
|
+
var _j = ((_e = court.dateAvailability) !== null && _e !== void 0 ? _e : []).reduce(function (extents, availability) {
|
|
58719
58873
|
var startMinutes = timeStringMinutes(extents.startTime);
|
|
58720
58874
|
var endMinutes = timeStringMinutes(extents.endTime);
|
|
58721
58875
|
if (availability.startTime &&
|
|
@@ -58725,13 +58879,13 @@ function updateCourtAvailability(_a) {
|
|
|
58725
58879
|
timeStringMinutes(availability.endTime) > endMinutes)
|
|
58726
58880
|
extents.endTime = availability.endTime;
|
|
58727
58881
|
return extents;
|
|
58728
|
-
}, { startTime: '08:00', endTime: '18:00' }), startTime =
|
|
58882
|
+
}, { startTime: '08:00', endTime: '18:00' }), startTime = _j.startTime, endTime = _j.endTime;
|
|
58729
58883
|
var updatedDateAvailability = tournamentDates.map(function (date) {
|
|
58730
58884
|
var _a;
|
|
58731
58885
|
var existing = (_a = court.dateAvailability) === null || _a === void 0 ? void 0 : _a.find(function (availability) { return availability.date === date; });
|
|
58732
|
-
return existing
|
|
58886
|
+
return existing !== null && existing !== void 0 ? existing : { date: date, startTime: startTime, endTime: endTime };
|
|
58733
58887
|
});
|
|
58734
|
-
var defaultAvailability = (
|
|
58888
|
+
var defaultAvailability = (_f = court.dateAvailability) === null || _f === void 0 ? void 0 : _f.find(function (availability) { return !availability.date; });
|
|
58735
58889
|
if (defaultAvailability)
|
|
58736
58890
|
updatedDateAvailability.unshift(defaultAvailability);
|
|
58737
58891
|
court.dateAvailability = updatedDateAvailability;
|
|
@@ -58981,8 +59135,8 @@ function getMatchUpDailyLimitsUpdate(_a) {
|
|
|
58981
59135
|
}
|
|
58982
59136
|
|
|
58983
59137
|
function clearMatchUpSchedule(_a) {
|
|
58984
|
-
var _b, _c;
|
|
58985
|
-
var
|
|
59138
|
+
var _b, _c, _d;
|
|
59139
|
+
var _e = _a.scheduleAttributes, scheduleAttributes = _e === void 0 ? [
|
|
58986
59140
|
ALLOCATE_COURTS,
|
|
58987
59141
|
ASSIGN_COURT,
|
|
58988
59142
|
ASSIGN_VENUE,
|
|
@@ -58992,7 +59146,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
58992
59146
|
END_TIME,
|
|
58993
59147
|
RESUME_TIME,
|
|
58994
59148
|
STOP_TIME,
|
|
58995
|
-
] :
|
|
59149
|
+
] : _e, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId;
|
|
58996
59150
|
var stack = 'clearMatchUpSchedule';
|
|
58997
59151
|
var matchUp = drawDefinition
|
|
58998
59152
|
? (_b = allDrawMatchUps$1({
|
|
@@ -59007,7 +59161,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
59007
59161
|
}).matchUps) === null || _c === void 0 ? void 0 : _c[0];
|
|
59008
59162
|
if (!matchUp)
|
|
59009
59163
|
return { error: MATCHUP_NOT_FOUND };
|
|
59010
|
-
var newTimeItems = (matchUp.timeItems
|
|
59164
|
+
var newTimeItems = ((_d = matchUp.timeItems) !== null && _d !== void 0 ? _d : []).filter(function (timeItem) {
|
|
59011
59165
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) && !scheduleAttributes.includes(timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType);
|
|
59012
59166
|
});
|
|
59013
59167
|
matchUp.timeItems = newTimeItems;
|
|
@@ -59214,11 +59368,11 @@ function getEntryStatusReports(_a) {
|
|
|
59214
59368
|
var positionAssignments = _a.positionAssignments;
|
|
59215
59369
|
return positionAssignments;
|
|
59216
59370
|
})
|
|
59371
|
+
.filter(Boolean)
|
|
59217
59372
|
.map(function (_a) {
|
|
59218
59373
|
var participantId = _a.participantId;
|
|
59219
59374
|
return participantId;
|
|
59220
|
-
})
|
|
59221
|
-
.filter(Boolean);
|
|
59375
|
+
});
|
|
59222
59376
|
var entryFilter = function (_a) {
|
|
59223
59377
|
var participantId = _a.participantId;
|
|
59224
59378
|
return assignedParticipantIds.includes(participantId);
|
|
@@ -60065,8 +60219,8 @@ function assignMatchUpSideParticipant(_a) {
|
|
|
60065
60219
|
};
|
|
60066
60220
|
if (matchUp) {
|
|
60067
60221
|
matchUp.sides = [1, 2].map(function (currentSideNumber) {
|
|
60068
|
-
var _a;
|
|
60069
|
-
var existingSide = ((_a = matchUp.sides) === null || _a === void 0 ? void 0 : _a.find(function (side) { return side.sideNumber === currentSideNumber; }))
|
|
60222
|
+
var _a, _b;
|
|
60223
|
+
var existingSide = (_b = (_a = matchUp.sides) === null || _a === void 0 ? void 0 : _a.find(function (side) { return side.sideNumber === currentSideNumber; })) !== null && _b !== void 0 ? _b : { sideNumber: currentSideNumber };
|
|
60070
60224
|
return sideNumber === currentSideNumber
|
|
60071
60225
|
? __assign(__assign({}, existingSide), { participantId: participantId }) : existingSide;
|
|
60072
60226
|
});
|
|
@@ -60509,7 +60663,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60509
60663
|
if (matchUpType === DOUBLES$1 &&
|
|
60510
60664
|
participantToRemove.participantType === INDIVIDUAL) {
|
|
60511
60665
|
var tieMatchUpSide = (_q = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _q === void 0 ? void 0 : _q.find(function (side) { return side.sideNumber === (dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.sideNumber); });
|
|
60512
|
-
var pairParticipantId = (tieMatchUpSide
|
|
60666
|
+
var pairParticipantId = (tieMatchUpSide !== null && tieMatchUpSide !== void 0 ? tieMatchUpSide : {}).participantId;
|
|
60513
60667
|
var pairParticipant = pairParticipantId &&
|
|
60514
60668
|
((_s = (_r = getParticipants$1({
|
|
60515
60669
|
participantFilters: { participantIds: [pairParticipantId] },
|
|
@@ -60547,26 +60701,24 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60547
60701
|
console.log('cleanup', { result: result });
|
|
60548
60702
|
}
|
|
60549
60703
|
}
|
|
60550
|
-
else {
|
|
60551
|
-
|
|
60552
|
-
|
|
60553
|
-
|
|
60704
|
+
else if (individualParticipantIds.length === 1) {
|
|
60705
|
+
var existingParticipant = getPairedParticipant({
|
|
60706
|
+
participantIds: individualParticipantIds,
|
|
60707
|
+
tournamentRecord: tournamentRecord,
|
|
60708
|
+
}).participant;
|
|
60709
|
+
if (!existingParticipant) {
|
|
60710
|
+
var newPairParticipant = {
|
|
60711
|
+
participantRole: COMPETITOR,
|
|
60712
|
+
individualParticipantIds: individualParticipantIds,
|
|
60713
|
+
participantType: PAIR,
|
|
60714
|
+
};
|
|
60715
|
+
var result = addParticipant$1({
|
|
60716
|
+
participant: newPairParticipant,
|
|
60717
|
+
pairOverride: true,
|
|
60554
60718
|
tournamentRecord: tournamentRecord,
|
|
60555
|
-
})
|
|
60556
|
-
if (
|
|
60557
|
-
|
|
60558
|
-
participantRole: COMPETITOR,
|
|
60559
|
-
individualParticipantIds: individualParticipantIds,
|
|
60560
|
-
participantType: PAIR,
|
|
60561
|
-
};
|
|
60562
|
-
var result = addParticipant$1({
|
|
60563
|
-
participant: newPairParticipant,
|
|
60564
|
-
pairOverride: true,
|
|
60565
|
-
tournamentRecord: tournamentRecord,
|
|
60566
|
-
});
|
|
60567
|
-
if (result.error)
|
|
60568
|
-
return decorateResult({ result: result, stack: stack });
|
|
60569
|
-
}
|
|
60719
|
+
});
|
|
60720
|
+
if (result.error)
|
|
60721
|
+
return decorateResult({ result: result, stack: stack });
|
|
60570
60722
|
}
|
|
60571
60723
|
}
|
|
60572
60724
|
}
|
|
@@ -60634,9 +60786,9 @@ function getPositionAssignments(_a) {
|
|
|
60634
60786
|
structure: structure,
|
|
60635
60787
|
}), error = _d.error, assignments = _d.positionAssignments;
|
|
60636
60788
|
return {
|
|
60637
|
-
|
|
60638
|
-
positionAssignments: assignments || [],
|
|
60789
|
+
positionAssignments: assignments !== null && assignments !== void 0 ? assignments : [],
|
|
60639
60790
|
structureId: structure === null || structure === void 0 ? void 0 : structure.structureId,
|
|
60791
|
+
error: error,
|
|
60640
60792
|
};
|
|
60641
60793
|
}
|
|
60642
60794
|
|
|
@@ -60960,14 +61112,15 @@ function assignDrawPosition(_a) {
|
|
|
60960
61112
|
}
|
|
60961
61113
|
|
|
60962
61114
|
function addEventEntryPairs(_a) {
|
|
60963
|
-
var
|
|
61115
|
+
var _b;
|
|
61116
|
+
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, _c = _a.entryStage, entryStage = _c === void 0 ? StageTypeEnum.Main : _c, _d = _a.entryStatus, entryStatus = _d === void 0 ? ALTERNATE : _d, _e = _a.participantIdPairs, participantIdPairs = _e === void 0 ? [] : _e, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, event = _a.event, uuids = _a.uuids;
|
|
60964
61117
|
if (!tournamentRecord)
|
|
60965
61118
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
60966
61119
|
if (!event)
|
|
60967
61120
|
return { error: MISSING_EVENT };
|
|
60968
61121
|
if (event.eventType !== DOUBLES$1)
|
|
60969
61122
|
return { error: INVALID_EVENT_TYPE };
|
|
60970
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
61123
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
60971
61124
|
var individualParticipantIds = tournamentParticipants
|
|
60972
61125
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
60973
61126
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -60984,12 +61137,15 @@ function addEventEntryPairs(_a) {
|
|
|
60984
61137
|
.filter(function (participant) { return participant.participantType === PAIR; })
|
|
60985
61138
|
.map(function (participant) { return participant.individualParticipantIds; });
|
|
60986
61139
|
// create provisional participant objects
|
|
60987
|
-
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
60988
|
-
|
|
60989
|
-
|
|
60990
|
-
|
|
60991
|
-
|
|
60992
|
-
|
|
61140
|
+
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
61141
|
+
var _a;
|
|
61142
|
+
return ({
|
|
61143
|
+
participantId: (_a = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _a !== void 0 ? _a : UUID(),
|
|
61144
|
+
participantRole: COMPETITOR,
|
|
61145
|
+
individualParticipantIds: individualParticipantIds,
|
|
61146
|
+
participantType: PAIR,
|
|
61147
|
+
});
|
|
61148
|
+
});
|
|
60993
61149
|
// filter out existing participants unless allowDuplicateParticipantIdPairs is true
|
|
60994
61150
|
var newParticipants = allowDuplicateParticipantIdPairs
|
|
60995
61151
|
? provisionalParticipants
|
|
@@ -61134,7 +61290,7 @@ function assignSeedPositions(params) {
|
|
|
61134
61290
|
/**
|
|
61135
61291
|
* mergeObject and seedLimit ensure that new assignments do not go beyond already established number of seeds
|
|
61136
61292
|
*/
|
|
61137
|
-
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments
|
|
61293
|
+
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments !== null && seedAssignments !== void 0 ? seedAssignments : [])
|
|
61138
61294
|
.filter(function (assignment) { return assignment.seedNumber; })
|
|
61139
61295
|
.map(function (assignment) {
|
|
61140
61296
|
var _a;
|
|
@@ -61403,7 +61559,7 @@ var tieFormatDefaults = function (params) {
|
|
|
61403
61559
|
|
|
61404
61560
|
function addEvent(_a) {
|
|
61405
61561
|
var e_1, _b;
|
|
61406
|
-
var _c, _d, _e, _f;
|
|
61562
|
+
var _c, _d, _e, _f, _g;
|
|
61407
61563
|
var suppressNotifications = _a.suppressNotifications, tournamentRecord = _a.tournamentRecord, internalUse = _a.internalUse, event = _a.event;
|
|
61408
61564
|
if (!tournamentRecord)
|
|
61409
61565
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -61426,13 +61582,7 @@ function addEvent(_a) {
|
|
|
61426
61582
|
context: context,
|
|
61427
61583
|
};
|
|
61428
61584
|
}
|
|
61429
|
-
var eventRecord =
|
|
61430
|
-
drawDefinitions: [],
|
|
61431
|
-
eventType: TypeEnum.Singles,
|
|
61432
|
-
entries: [],
|
|
61433
|
-
startDate: startDate,
|
|
61434
|
-
endDate: endDate,
|
|
61435
|
-
}, event);
|
|
61585
|
+
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
61436
61586
|
if (event.eventType === TypeEnum.Team) {
|
|
61437
61587
|
if (event.tieFormat) {
|
|
61438
61588
|
var result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
@@ -61463,7 +61613,7 @@ function addEvent(_a) {
|
|
|
61463
61613
|
if (!suppressNotifications) {
|
|
61464
61614
|
var topics = getTopics().topics;
|
|
61465
61615
|
if (topics.includes(ADD_MATCHUPS)) {
|
|
61466
|
-
var matchUps = allEventMatchUps({ event: event }).matchUps
|
|
61616
|
+
var matchUps = (_g = allEventMatchUps({ event: event }).matchUps) !== null && _g !== void 0 ? _g : [];
|
|
61467
61617
|
addMatchUpsNotice({
|
|
61468
61618
|
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
61469
61619
|
eventId: event.eventId,
|
|
@@ -61471,15 +61621,15 @@ function addEvent(_a) {
|
|
|
61471
61621
|
});
|
|
61472
61622
|
}
|
|
61473
61623
|
try {
|
|
61474
|
-
for (var
|
|
61475
|
-
var drawDefinition =
|
|
61624
|
+
for (var _h = __values(event.drawDefinitions || []), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
61625
|
+
var drawDefinition = _j.value;
|
|
61476
61626
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
61477
61627
|
}
|
|
61478
61628
|
}
|
|
61479
61629
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61480
61630
|
finally {
|
|
61481
61631
|
try {
|
|
61482
|
-
if (
|
|
61632
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
61483
61633
|
}
|
|
61484
61634
|
finally { if (e_1) throw e_1.error; }
|
|
61485
61635
|
}
|
|
@@ -62170,11 +62320,9 @@ function setMatchUpFormat(_a) {
|
|
|
62170
62320
|
finally { if (e_2) throw e_2.error; }
|
|
62171
62321
|
}
|
|
62172
62322
|
}
|
|
62173
|
-
else {
|
|
62174
|
-
|
|
62175
|
-
|
|
62176
|
-
modificationsCount += 1;
|
|
62177
|
-
}
|
|
62323
|
+
else if (event_1.matchUpFormat !== matchUpFormat) {
|
|
62324
|
+
event_1.matchUpFormat = matchUpFormat;
|
|
62325
|
+
modificationsCount += 1;
|
|
62178
62326
|
}
|
|
62179
62327
|
}
|
|
62180
62328
|
}
|
|
@@ -62399,10 +62547,11 @@ function getParticipantScaleItem(_a) {
|
|
|
62399
62547
|
}
|
|
62400
62548
|
|
|
62401
62549
|
function getScaledEntries(_a) {
|
|
62402
|
-
var _b
|
|
62550
|
+
var _b;
|
|
62551
|
+
var _c = _a.sortDescending, sortDescending = _c === void 0 ? false : _c, tournamentRecord = _a.tournamentRecord, scaleAttributes = _a.scaleAttributes, scaleSortMethod = _a.scaleSortMethod, stageSequence = _a.stageSequence, entries = _a.entries, event = _a.event, stage = _a.stage;
|
|
62403
62552
|
if (!tournamentRecord)
|
|
62404
62553
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
62405
|
-
entries = entries
|
|
62554
|
+
entries = (_b = entries !== null && entries !== void 0 ? entries : event === null || event === void 0 ? void 0 : event.entries) !== null && _b !== void 0 ? _b : [];
|
|
62406
62555
|
var stageEntries = entries.filter(function (entry) {
|
|
62407
62556
|
return (!stage || !entry.entryStage || entry.entryStage === stage) &&
|
|
62408
62557
|
(!stageSequence ||
|
|
@@ -62440,15 +62589,6 @@ function getScaledEntries(_a) {
|
|
|
62440
62589
|
}
|
|
62441
62590
|
}
|
|
62442
62591
|
|
|
62443
|
-
/**
|
|
62444
|
-
*
|
|
62445
|
-
* @param {object} tournamentRecord - passed automatically if tournamentEngine.setState()
|
|
62446
|
-
* @param {string} eventId - resolves to event
|
|
62447
|
-
* @param {string} drawId - OPTIONAL - resolves drawDefinition - scopes participants to clear to drawDefinition.entries or flightProfile.flight.drawEntries
|
|
62448
|
-
* @param {string} scaleName - OPTIONAL - defaults to event.categoryName || event.ageCategoryCode
|
|
62449
|
-
* @param {string} stage - OPTIONAL - filter event or draw entries by stage
|
|
62450
|
-
* @returns {boolean} { success: true } or { error }
|
|
62451
|
-
*/
|
|
62452
62592
|
function removeSeeding(_a) {
|
|
62453
62593
|
var _b, _c;
|
|
62454
62594
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, entryStatuses = _a.entryStatuses, scaleName = _a.scaleName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
@@ -62740,16 +62880,16 @@ var flightConstants = {
|
|
|
62740
62880
|
};
|
|
62741
62881
|
|
|
62742
62882
|
function generateFlightProfile(params) {
|
|
62743
|
-
var _a;
|
|
62744
|
-
var
|
|
62883
|
+
var _a, _b;
|
|
62884
|
+
var _c = params.drawNameRoot, drawNameRoot = _c === void 0 ? 'Flight' : _c, attachFlightProfile$1 = params.attachFlightProfile, tournamentRecord = params.tournamentRecord, scaleAttributes = params.scaleAttributes, scaleSortMethod = params.scaleSortMethod, deleteExisting = params.deleteExisting, sortDescending = params.sortDescending, _d = params.drawNames, drawNames = _d === void 0 ? [] : _d, flightsCount = params.flightsCount, splitMethod = params.splitMethod, _e = params.uuids, uuids = _e === void 0 ? [] : _e, event = params.event, stage = params.stage;
|
|
62745
62885
|
if (!event)
|
|
62746
62886
|
return { error: MISSING_EVENT };
|
|
62747
|
-
var eventEntries = event.entries
|
|
62887
|
+
var eventEntries = (_a = event.entries) !== null && _a !== void 0 ? _a : [];
|
|
62748
62888
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
62749
62889
|
if (flightProfile && attachFlightProfile$1 && !deleteExisting) {
|
|
62750
62890
|
return { error: EXISTING_PROFILE };
|
|
62751
62891
|
}
|
|
62752
|
-
var scaledEntries = (
|
|
62892
|
+
var scaledEntries = (_b = params.scaledEntries) !== null && _b !== void 0 ? _b : getScaledEntries({
|
|
62753
62893
|
tournamentRecord: tournamentRecord,
|
|
62754
62894
|
scaleAttributes: scaleAttributes,
|
|
62755
62895
|
scaleSortMethod: scaleSortMethod,
|
|
@@ -62798,10 +62938,11 @@ function generateFlightProfile(params) {
|
|
|
62798
62938
|
});
|
|
62799
62939
|
}
|
|
62800
62940
|
var flights = generateRange(0, flightsCount).map(function (index) {
|
|
62941
|
+
var _a;
|
|
62801
62942
|
var flightNumber = index + 1;
|
|
62802
62943
|
return {
|
|
62803
62944
|
flightNumber: flightNumber,
|
|
62804
|
-
drawId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop())
|
|
62945
|
+
drawId: (_a = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _a !== void 0 ? _a : UUID(),
|
|
62805
62946
|
drawEntries: getDrawEntries(splitEntries[index]),
|
|
62806
62947
|
drawName: ((drawNames === null || drawNames === void 0 ? void 0 : drawNames.length) && drawNames[index]) ||
|
|
62807
62948
|
"".concat(drawNameRoot, " ").concat(flightNumber),
|
|
@@ -63087,8 +63228,8 @@ function resetDrawDefinition(_a) {
|
|
|
63087
63228
|
}
|
|
63088
63229
|
|
|
63089
63230
|
function pruneDrawDefinition(_a) {
|
|
63090
|
-
var _b;
|
|
63091
|
-
var
|
|
63231
|
+
var _b, _c;
|
|
63232
|
+
var _d = _a.matchPlayDrawPositions, matchPlayDrawPositions = _d === void 0 ? true : _d, // when simply extracting matchUps for aggregation, drawPositions are unnecessary
|
|
63092
63233
|
tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, drawId = _a.drawId;
|
|
63093
63234
|
if (!tournamentRecord)
|
|
63094
63235
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -63099,16 +63240,16 @@ function pruneDrawDefinition(_a) {
|
|
|
63099
63240
|
if (drawsAnalysis.canBePruned.includes(drawId)) {
|
|
63100
63241
|
var isMatchPlay = drawsAnalysis.matchPlay.includes(drawId);
|
|
63101
63242
|
var drawAnalysis = drawsAnalysis.drawAnalysis[drawId];
|
|
63102
|
-
var
|
|
63243
|
+
var _e = __read(getDrawStructures({
|
|
63103
63244
|
stageSequence: 1,
|
|
63104
63245
|
drawDefinition: drawDefinition,
|
|
63105
63246
|
stage: MAIN,
|
|
63106
|
-
}).structures, 1), mainStructure_1 =
|
|
63247
|
+
}).structures, 1), mainStructure_1 = _e[0];
|
|
63107
63248
|
var structureData_1 = drawAnalysis.structuresData.find(function (_a) {
|
|
63108
63249
|
var structureId = _a.structureId;
|
|
63109
63250
|
return mainStructure_1.structureId === structureId;
|
|
63110
63251
|
});
|
|
63111
|
-
var matchUps = mainStructure_1.matchUps
|
|
63252
|
+
var matchUps = (_b = mainStructure_1.matchUps) !== null && _b !== void 0 ? _b : [];
|
|
63112
63253
|
relevantMatchUps = matchUps
|
|
63113
63254
|
.sort(function (a, b) { return a.roundPosition - b.roundPosition; })
|
|
63114
63255
|
.filter(function (_a) {
|
|
@@ -63135,7 +63276,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63135
63276
|
var matchUpIdsToDelete = relevantMatchUpIds_1.filter(function (matchUpId) { return !matchPlayMatchUpIds_1.includes(matchUpId); });
|
|
63136
63277
|
deletedMatchUpIds.push.apply(deletedMatchUpIds, __spreadArray([], __read(matchUpIdsToDelete), false));
|
|
63137
63278
|
var existingDrawPositionPairings = matchPlayMatchUps
|
|
63138
|
-
.flatMap(function (matchUp) { return matchUp.drawPositions
|
|
63279
|
+
.flatMap(function (matchUp) { var _a; return (_a = matchUp.drawPositions) !== null && _a !== void 0 ? _a : []; })
|
|
63139
63280
|
.filter(Boolean);
|
|
63140
63281
|
var existingDrawPositions_1 = existingDrawPositionPairings.flat();
|
|
63141
63282
|
var drawPositionsMap_1 = Object.assign.apply(Object, __spreadArray([{}], __read(existingDrawPositions_1.map(function (drawPosition, i) {
|
|
@@ -63153,7 +63294,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63153
63294
|
}
|
|
63154
63295
|
});
|
|
63155
63296
|
if (matchPlayDrawPositions) {
|
|
63156
|
-
var updatedPositionAssignments = (
|
|
63297
|
+
var updatedPositionAssignments = (_c = mainStructure_1 === null || mainStructure_1 === void 0 ? void 0 : mainStructure_1.positionAssignments) === null || _c === void 0 ? void 0 : _c.filter(function (assignment) {
|
|
63157
63298
|
return existingDrawPositions_1.includes(assignment.drawPosition);
|
|
63158
63299
|
}).map(function (assignment) {
|
|
63159
63300
|
assignment.drawPosition = drawPositionsMap_1[assignment.drawPosition];
|
|
@@ -63183,12 +63324,13 @@ function setOrderOfFinish(params) {
|
|
|
63183
63324
|
|
|
63184
63325
|
function modifyEventEntries(_a) {
|
|
63185
63326
|
var _b;
|
|
63186
|
-
var _c
|
|
63327
|
+
var _c, _d;
|
|
63328
|
+
var _e = _a.entryStatus, entryStatus = _e === void 0 ? DIRECT_ACCEPTANCE : _e, _f = _a.unpairedParticipantIds, unpairedParticipantIds = _f === void 0 ? [] : _f, _g = _a.participantIdPairs, participantIdPairs = _g === void 0 ? [] : _g, _h = _a.entryStage, entryStage = _h === void 0 ? MAIN : _h, tournamentRecord = _a.tournamentRecord, event = _a.event;
|
|
63187
63329
|
if (!tournamentRecord)
|
|
63188
63330
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63189
63331
|
if (!event)
|
|
63190
63332
|
return { error: MISSING_EVENT };
|
|
63191
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
63333
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
63192
63334
|
var individualParticipantIds = tournamentParticipants
|
|
63193
63335
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
63194
63336
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -63243,7 +63385,7 @@ function modifyEventEntries(_a) {
|
|
|
63243
63385
|
entryStage: entryStage,
|
|
63244
63386
|
}); });
|
|
63245
63387
|
// remove all entries matching the stage which has been modified
|
|
63246
|
-
event.entries = (event.entries
|
|
63388
|
+
event.entries = ((_d = event.entries) !== null && _d !== void 0 ? _d : []).filter(function (entry) { return entry.entryStage === entryStage; });
|
|
63247
63389
|
event.entries = (_b = event.entries).concat.apply(_b, __spreadArray(__spreadArray([], __read(pairParticipantEntries), false), __read(unpairedParticipantEntries), false));
|
|
63248
63390
|
return __assign({}, SUCCESS);
|
|
63249
63391
|
}
|
|
@@ -63256,8 +63398,8 @@ function drawMatic(params) {
|
|
|
63256
63398
|
}
|
|
63257
63399
|
|
|
63258
63400
|
function addFlight(_a) {
|
|
63259
|
-
var _b, _c, _d;
|
|
63260
|
-
var qualifyingPositions = _a.qualifyingPositions,
|
|
63401
|
+
var _b, _c, _d, _e;
|
|
63402
|
+
var qualifyingPositions = _a.qualifyingPositions, _f = _a.drawEntries, drawEntries = _f === void 0 ? [] : _f, // [{ entryPosition, entryStatus, participantId }]
|
|
63261
63403
|
drawName = _a.drawName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
63262
63404
|
var stack = 'addFlight';
|
|
63263
63405
|
if (!event)
|
|
@@ -63266,18 +63408,18 @@ function addFlight(_a) {
|
|
|
63266
63408
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
63267
63409
|
if (drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.length) {
|
|
63268
63410
|
// check that all drawEntries are in event.entries
|
|
63269
|
-
var enteredParticipantIds = (event.entries
|
|
63411
|
+
var enteredParticipantIds = ((_b = event.entries) !== null && _b !== void 0 ? _b : []).map(extractAttributes('participantId'));
|
|
63270
63412
|
var flightParticipantIds = drawEntries.map(extractAttributes('participantId'));
|
|
63271
63413
|
if (intersection(flightParticipantIds, enteredParticipantIds).length !==
|
|
63272
63414
|
flightParticipantIds.length) {
|
|
63273
63415
|
return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
|
|
63274
63416
|
}
|
|
63275
63417
|
}
|
|
63276
|
-
var flightProfile = (
|
|
63277
|
-
var flightNumbers = ((
|
|
63418
|
+
var flightProfile = (_c = getFlightProfile({ event: event })) === null || _c === void 0 ? void 0 : _c.flightProfile;
|
|
63419
|
+
var flightNumbers = ((_e = (_d = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
63278
63420
|
var flightNumber = _a.flightNumber;
|
|
63279
63421
|
return !isNaN(flightNumber) && ensureInt(flightNumber);
|
|
63280
|
-
})) === null ||
|
|
63422
|
+
})) === null || _e === void 0 ? void 0 : _e.filter(Boolean)) || [];
|
|
63281
63423
|
var flightNumber = Math.max.apply(Math, __spreadArray([0], __read(flightNumbers), false)) + 1;
|
|
63282
63424
|
var flightDrawId = drawId || UUID();
|
|
63283
63425
|
var flight = {
|
|
@@ -64488,8 +64630,7 @@ function isValidForQualifying(_a) {
|
|
|
64488
64630
|
var targetFeedProfiles = result.links.target
|
|
64489
64631
|
.flatMap(function (t) { return t.target.feedProfile; })
|
|
64490
64632
|
.filter(Boolean);
|
|
64491
|
-
var valid = !intersection([BOTTOM_UP, TOP_DOWN, RANDOM], targetFeedProfiles)
|
|
64492
|
-
.length;
|
|
64633
|
+
var valid = !intersection([BOTTOM_UP, TOP_DOWN, RANDOM, WATERFALL], targetFeedProfiles).length;
|
|
64493
64634
|
return __assign(__assign({}, SUCCESS), { valid: valid });
|
|
64494
64635
|
}
|
|
64495
64636
|
|
|
@@ -64898,7 +65039,7 @@ function getMaxEntryPosition(params) {
|
|
|
64898
65039
|
}
|
|
64899
65040
|
|
|
64900
65041
|
function getPredictiveAccuracy(params) {
|
|
64901
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
65042
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
64902
65043
|
var matchUps = params.matchUps;
|
|
64903
65044
|
var singlesForDoubles = params.singlesForDoubles, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, scaleName = params.scaleName, eventId = params.eventId, zonePct = params.zonePct, drawId = params.drawId, event = params.event;
|
|
64904
65045
|
if (!tournamentRecord && !matchUps)
|
|
@@ -64914,14 +65055,14 @@ function getPredictiveAccuracy(params) {
|
|
|
64914
65055
|
? Math.abs(scaleProfile.range[0] - scaleProfile.range[1])
|
|
64915
65056
|
: 0;
|
|
64916
65057
|
var zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
|
|
64917
|
-
? (zonePct
|
|
64918
|
-
: params.zoneMargin
|
|
65058
|
+
? (zonePct !== null && zonePct !== void 0 ? zonePct : 0 / 100) * ratingsRangeDifference
|
|
65059
|
+
: (_d = params.zoneMargin) !== null && _d !== void 0 ? _d : ratingsRangeDifference;
|
|
64919
65060
|
var contextProfile = { withScaleValues: true, withCompetitiveness: true };
|
|
64920
65061
|
var contextFilters = {
|
|
64921
65062
|
matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
|
|
64922
65063
|
};
|
|
64923
65064
|
var participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
64924
|
-
if ((
|
|
65065
|
+
if ((_e = matchUps === null || matchUps === void 0 ? void 0 : matchUps[0]) === null || _e === void 0 ? void 0 : _e.hasContext) {
|
|
64925
65066
|
if (drawId) {
|
|
64926
65067
|
matchUps = matchUps.filter(function (matchUp) { return matchUp.drawId === drawId; });
|
|
64927
65068
|
}
|
|
@@ -64934,27 +65075,27 @@ function getPredictiveAccuracy(params) {
|
|
|
64934
65075
|
(drawId && !drawDefinition && []) ||
|
|
64935
65076
|
(!drawId && eventId && !event && []) ||
|
|
64936
65077
|
(drawId &&
|
|
64937
|
-
((
|
|
65078
|
+
((_f = allDrawMatchUps$1({
|
|
64938
65079
|
inContext: true,
|
|
64939
65080
|
drawDefinition: drawDefinition,
|
|
64940
65081
|
contextFilters: contextFilters,
|
|
64941
65082
|
contextProfile: contextProfile,
|
|
64942
65083
|
participants: participants,
|
|
64943
|
-
})) === null ||
|
|
65084
|
+
})) === null || _f === void 0 ? void 0 : _f.matchUps)) ||
|
|
64944
65085
|
(!drawId &&
|
|
64945
65086
|
eventId &&
|
|
64946
|
-
((
|
|
65087
|
+
((_g = allEventMatchUps({
|
|
64947
65088
|
inContext: true,
|
|
64948
65089
|
contextFilters: contextFilters,
|
|
64949
65090
|
contextProfile: contextProfile,
|
|
64950
65091
|
participants: participants,
|
|
64951
65092
|
event: event,
|
|
64952
|
-
})) === null ||
|
|
64953
|
-
((
|
|
65093
|
+
})) === null || _g === void 0 ? void 0 : _g.matchUps)) ||
|
|
65094
|
+
((_h = allTournamentMatchUps({
|
|
64954
65095
|
tournamentRecord: tournamentRecord,
|
|
64955
65096
|
contextFilters: contextFilters,
|
|
64956
65097
|
contextProfile: contextProfile,
|
|
64957
|
-
})) === null ||
|
|
65098
|
+
})) === null || _h === void 0 ? void 0 : _h.matchUps) ||
|
|
64958
65099
|
[];
|
|
64959
65100
|
}
|
|
64960
65101
|
if (matchUpType) {
|
|
@@ -64962,7 +65103,7 @@ function getPredictiveAccuracy(params) {
|
|
|
64962
65103
|
}
|
|
64963
65104
|
var relevantMatchUps = matchUps.filter(function (_a) {
|
|
64964
65105
|
var winningSide = _a.winningSide, score = _a.score, sides = _a.sides, matchUpStatus = _a.matchUpStatus;
|
|
64965
|
-
return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus
|
|
65106
|
+
return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus !== null && matchUpStatus !== void 0 ? matchUpStatus : '') &&
|
|
64966
65107
|
scoreHasValue({ score: score }) &&
|
|
64967
65108
|
(sides === null || sides === void 0 ? void 0 : sides.length) === 2 &&
|
|
64968
65109
|
winningSide;
|
|
@@ -66521,7 +66662,7 @@ function getAwardPoints(_a) {
|
|
|
66521
66662
|
|
|
66522
66663
|
function getTournamentPoints(_a) {
|
|
66523
66664
|
var e_1, _b;
|
|
66524
|
-
var _c;
|
|
66665
|
+
var _c, _d;
|
|
66525
66666
|
var participantFilters = _a.participantFilters, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, saveRankings = _a.saveRankings, level = _a.level;
|
|
66526
66667
|
if (!tournamentRecord)
|
|
66527
66668
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -66529,25 +66670,24 @@ function getTournamentPoints(_a) {
|
|
|
66529
66670
|
policyTypes: [POLICY_TYPE_RANKING_POINTS],
|
|
66530
66671
|
tournamentRecord: tournamentRecord,
|
|
66531
66672
|
}).policyDefinitions;
|
|
66532
|
-
var pointsPolicy = (policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_RANKING_POINTS]) ||
|
|
66533
|
-
(attachedPolicies === null || attachedPolicies === void 0 ? void 0 : attachedPolicies[POLICY_TYPE_RANKING_POINTS]);
|
|
66673
|
+
var pointsPolicy = (_c = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_RANKING_POINTS]) !== null && _c !== void 0 ? _c : attachedPolicies === null || attachedPolicies === void 0 ? void 0 : attachedPolicies[POLICY_TYPE_RANKING_POINTS];
|
|
66534
66674
|
if (!pointsPolicy)
|
|
66535
66675
|
return { error: MISSING_POLICY_DEFINITION };
|
|
66536
66676
|
var awardProfiles = pointsPolicy.awardProfiles;
|
|
66537
66677
|
var requireWinFirstRound = pointsPolicy.requireWinFirstRound;
|
|
66538
66678
|
var requireWinForPoints = pointsPolicy.requireWinForPoints;
|
|
66539
|
-
var
|
|
66679
|
+
var _e = getParticipants$1({
|
|
66540
66680
|
withRankingProfile: true,
|
|
66541
66681
|
participantFilters: participantFilters,
|
|
66542
66682
|
tournamentRecord: tournamentRecord,
|
|
66543
|
-
}), participants =
|
|
66683
|
+
}), participants = _e.participants, derivedEventInfo = _e.derivedEventInfo, derivedDrawInfo = _e.derivedDrawInfo, mappedMatchUps = _e.mappedMatchUps;
|
|
66544
66684
|
var participantsWithOutcomes = participants === null || participants === void 0 ? void 0 : participants.filter(function (p) { var _a; return (_a = p.draws) === null || _a === void 0 ? void 0 : _a.length; });
|
|
66545
66685
|
// keep track of points earned per person / per team
|
|
66546
66686
|
var personPoints = {};
|
|
66547
66687
|
var teamPoints = {};
|
|
66548
66688
|
var pairPoints = {};
|
|
66549
66689
|
var _loop_1 = function (participant) {
|
|
66550
|
-
var e_2,
|
|
66690
|
+
var e_2, _h, e_3, _j;
|
|
66551
66691
|
var participantType = participant.participantType, participantId = participant.participantId, person = participant.person, draws = participant.draws;
|
|
66552
66692
|
try {
|
|
66553
66693
|
for (var draws_1 = (e_2 = void 0, __values(draws)), draws_1_1 = draws_1.next(); !draws_1_1.done; draws_1_1 = draws_1.next()) {
|
|
@@ -66556,7 +66696,7 @@ function getTournamentPoints(_a) {
|
|
|
66556
66696
|
var eventInfo = derivedEventInfo[eventId];
|
|
66557
66697
|
var drawInfo = derivedDrawInfo[drawId];
|
|
66558
66698
|
var drawType = drawInfo === null || drawInfo === void 0 ? void 0 : drawInfo.drawType;
|
|
66559
|
-
var
|
|
66699
|
+
var _k = eventInfo || {}, category = _k.category, eventType = _k.eventType;
|
|
66560
66700
|
var startDate = draw.startDate || eventInfo.startDate || tournamentRecord.startDate;
|
|
66561
66701
|
var endDate = draw.endDate || eventInfo.endDate || tournamentRecord.endDate;
|
|
66562
66702
|
// don't process INDIVIDUAL and PAIR participants in TEAM events
|
|
@@ -66567,13 +66707,12 @@ function getTournamentPoints(_a) {
|
|
|
66567
66707
|
var points = void 0;
|
|
66568
66708
|
if (awardProfiles) {
|
|
66569
66709
|
var requireWin = requireWinForPoints;
|
|
66570
|
-
// const positionAwards = []; // potential use for combining ppw w/ fpp
|
|
66571
66710
|
var totalWinsCount = 0;
|
|
66572
66711
|
var positionPoints = 0;
|
|
66573
66712
|
var perWinPoints = 0;
|
|
66574
66713
|
var rangeAccessor = void 0;
|
|
66575
66714
|
var _loop_2 = function (participation) {
|
|
66576
|
-
var
|
|
66715
|
+
var _l, _m, e_4, _o, e_5, _p;
|
|
66577
66716
|
var finishingPositionRange = participation.finishingPositionRange, participationOrder = participation.participationOrder, participantWon = participation.participantWon, flightNumber = participation.flightNumber, rankingStage = participation.rankingStage, winCount = participation.winCount;
|
|
66578
66717
|
totalWinsCount += winCount || 0;
|
|
66579
66718
|
var drawSize = drawInfo === null || drawInfo === void 0 ? void 0 : drawInfo.drawSize;
|
|
@@ -66602,27 +66741,25 @@ function getTournamentPoints(_a) {
|
|
|
66602
66741
|
requireWin = awardProfile.requireWinForPoints;
|
|
66603
66742
|
if (awardProfile.requireWinFirstRound !== undefined)
|
|
66604
66743
|
requireWinFirstRound = awardProfile.requireWinFirstRound;
|
|
66605
|
-
var
|
|
66744
|
+
var _q = awardProfile.finishingPositionPoints, finishingPositionPoints = _q === void 0 ? {} : _q, finishingPositionRanges = awardProfile.finishingPositionRanges, finishingRound = awardProfile.finishingRound, pointsPerWin = awardProfile.pointsPerWin, flights = awardProfile.flights;
|
|
66606
66745
|
var ppwProfile = Array.isArray(awardProfile.perWinPoints)
|
|
66607
|
-
? (
|
|
66746
|
+
? (_d = awardProfile.perWinPoints) === null || _d === void 0 ? void 0 : _d.find(function (pwp) { var _a; return (_a = pwp.participationOrders) === null || _a === void 0 ? void 0 : _a.includes(participationOrder); })
|
|
66608
66747
|
: awardProfile.perWinPoints;
|
|
66609
66748
|
var participationOrders = finishingPositionPoints.participationOrders;
|
|
66610
66749
|
var awardPoints = 0;
|
|
66611
66750
|
var winRequired = void 0;
|
|
66612
|
-
// const noPositionAwards = !positionAwards.length;
|
|
66613
66751
|
var isValidOrder = !participationOrders ||
|
|
66614
66752
|
participationOrders.includes(participationOrder);
|
|
66615
66753
|
if (isValidOrder && finishingPositionRanges && accessor) {
|
|
66616
66754
|
var valueObj = finishingPositionRanges[accessor];
|
|
66617
66755
|
if (valueObj) {
|
|
66618
|
-
|
|
66619
|
-
(_k = getAwardPoints({
|
|
66756
|
+
(_l = getAwardPoints({
|
|
66620
66757
|
flightNumber: flightNumber,
|
|
66621
66758
|
valueObj: valueObj,
|
|
66622
66759
|
drawSize: drawSize,
|
|
66623
66760
|
flights: flights,
|
|
66624
66761
|
level: level,
|
|
66625
|
-
}), awardPoints =
|
|
66762
|
+
}), awardPoints = _l.awardPoints, winRequired = _l.requireWin);
|
|
66626
66763
|
}
|
|
66627
66764
|
}
|
|
66628
66765
|
if (!awardPoints &&
|
|
@@ -66631,15 +66768,14 @@ function getTournamentPoints(_a) {
|
|
|
66631
66768
|
accessor) {
|
|
66632
66769
|
var valueObj = finishingRound[accessor];
|
|
66633
66770
|
if (valueObj) {
|
|
66634
|
-
|
|
66635
|
-
(_l = getAwardPoints({
|
|
66771
|
+
(_m = getAwardPoints({
|
|
66636
66772
|
participantWon: participantWon,
|
|
66637
66773
|
flightNumber: flightNumber,
|
|
66638
66774
|
valueObj: valueObj,
|
|
66639
66775
|
drawSize: drawSize,
|
|
66640
66776
|
flights: flights,
|
|
66641
66777
|
level: level,
|
|
66642
|
-
}), awardPoints =
|
|
66778
|
+
}), awardPoints = _m.awardPoints, winRequired = _m.requireWin);
|
|
66643
66779
|
}
|
|
66644
66780
|
}
|
|
66645
66781
|
if (firstRound && requireWinFirstRound !== undefined) {
|
|
@@ -66681,8 +66817,8 @@ function getTournamentPoints(_a) {
|
|
|
66681
66817
|
continue;
|
|
66682
66818
|
}
|
|
66683
66819
|
try {
|
|
66684
|
-
for (var
|
|
66685
|
-
var tieMatchUp =
|
|
66820
|
+
for (var _r = (e_5 = void 0, __values(matchUp.tieMatchUps)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
66821
|
+
var tieMatchUp = _s.value;
|
|
66686
66822
|
// ingore matchUps with no winningSide
|
|
66687
66823
|
if (!tieMatchUp.winningSide)
|
|
66688
66824
|
continue;
|
|
@@ -66691,7 +66827,7 @@ function getTournamentPoints(_a) {
|
|
|
66691
66827
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
66692
66828
|
finally {
|
|
66693
66829
|
try {
|
|
66694
|
-
if (
|
|
66830
|
+
if (_s && !_s.done && (_p = _r.return)) _p.call(_r);
|
|
66695
66831
|
}
|
|
66696
66832
|
finally { if (e_5) throw e_5.error; }
|
|
66697
66833
|
}
|
|
@@ -66700,7 +66836,7 @@ function getTournamentPoints(_a) {
|
|
|
66700
66836
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
66701
66837
|
finally {
|
|
66702
66838
|
try {
|
|
66703
|
-
if (teamStructureMatchUps_1_1 && !teamStructureMatchUps_1_1.done && (
|
|
66839
|
+
if (teamStructureMatchUps_1_1 && !teamStructureMatchUps_1_1.done && (_o = teamStructureMatchUps_1.return)) _o.call(teamStructureMatchUps_1);
|
|
66704
66840
|
}
|
|
66705
66841
|
finally { if (e_4) throw e_4.error; }
|
|
66706
66842
|
}
|
|
@@ -66715,7 +66851,7 @@ function getTournamentPoints(_a) {
|
|
|
66715
66851
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
66716
66852
|
finally {
|
|
66717
66853
|
try {
|
|
66718
|
-
if (structureParticipation_1_1 && !structureParticipation_1_1.done && (
|
|
66854
|
+
if (structureParticipation_1_1 && !structureParticipation_1_1.done && (_j = structureParticipation_1.return)) _j.call(structureParticipation_1);
|
|
66719
66855
|
}
|
|
66720
66856
|
finally { if (e_3) throw e_3.error; }
|
|
66721
66857
|
}
|
|
@@ -66752,21 +66888,21 @@ function getTournamentPoints(_a) {
|
|
|
66752
66888
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
66753
66889
|
finally {
|
|
66754
66890
|
try {
|
|
66755
|
-
if (draws_1_1 && !draws_1_1.done && (
|
|
66891
|
+
if (draws_1_1 && !draws_1_1.done && (_h = draws_1.return)) _h.call(draws_1);
|
|
66756
66892
|
}
|
|
66757
66893
|
finally { if (e_2) throw e_2.error; }
|
|
66758
66894
|
}
|
|
66759
66895
|
};
|
|
66760
66896
|
try {
|
|
66761
|
-
for (var
|
|
66762
|
-
var participant =
|
|
66897
|
+
for (var _f = __values(participantsWithOutcomes !== null && participantsWithOutcomes !== void 0 ? participantsWithOutcomes : []), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
66898
|
+
var participant = _g.value;
|
|
66763
66899
|
_loop_1(participant);
|
|
66764
66900
|
}
|
|
66765
66901
|
}
|
|
66766
66902
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
66767
66903
|
finally {
|
|
66768
66904
|
try {
|
|
66769
|
-
if (
|
|
66905
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
66770
66906
|
}
|
|
66771
66907
|
finally { if (e_1) throw e_1.error; }
|
|
66772
66908
|
}
|
|
@@ -66899,8 +67035,8 @@ var aggregateSets = function (sets) {
|
|
|
66899
67035
|
|
|
66900
67036
|
function generateDynamicRatings(_a) {
|
|
66901
67037
|
var e_1, _b;
|
|
66902
|
-
var _c, _d;
|
|
66903
|
-
var
|
|
67038
|
+
var _c, _d, _e;
|
|
67039
|
+
var _f = _a.removePriorValues, removePriorValues = _f === void 0 ? true : _f, tournamentRecord = _a.tournamentRecord, _g = _a.ratingType, ratingType = _g === void 0 ? ELO : _g, considerGames = _a.considerGames, matchUpIds = _a.matchUpIds, asDynamic = _a.asDynamic;
|
|
66904
67040
|
if (!tournamentRecord)
|
|
66905
67041
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
66906
67042
|
if (!Array.isArray(matchUpIds))
|
|
@@ -66912,13 +67048,14 @@ function generateDynamicRatings(_a) {
|
|
|
66912
67048
|
var ratingParameter = ratingsParameters[ratingType];
|
|
66913
67049
|
var accessor = ratingParameter.accessor;
|
|
66914
67050
|
var modifiedScaleValues = {};
|
|
66915
|
-
var matchUps = allTournamentMatchUps({
|
|
67051
|
+
var matchUps = (_c = allTournamentMatchUps({
|
|
66916
67052
|
matchUpFilters: { matchUpIds: matchUpIds, matchUpStatuses: completedMatchUpStatuses },
|
|
66917
67053
|
tournamentRecord: tournamentRecord,
|
|
66918
67054
|
inContext: true,
|
|
66919
|
-
}).matchUps
|
|
67055
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
67056
|
+
matchUps.sort(matchUpSort);
|
|
66920
67057
|
var _loop_1 = function (matchUp) {
|
|
66921
|
-
var e_2,
|
|
67058
|
+
var e_2, _h, e_3, _j, _k, _l;
|
|
66922
67059
|
var endDate = matchUp.endDate, matchUpFormat = matchUp.matchUpFormat, score = matchUp.score, sides = matchUp.sides, winningSide = matchUp.winningSide;
|
|
66923
67060
|
var matchUpType = matchUp.matchUpType;
|
|
66924
67061
|
var scaleAttributes = {
|
|
@@ -66932,13 +67069,14 @@ function generateDynamicRatings(_a) {
|
|
|
66932
67069
|
eventType: matchUpType,
|
|
66933
67070
|
scaleType: RATING$2,
|
|
66934
67071
|
};
|
|
66935
|
-
var sideParticipantIds = Object.assign.apply(Object, __spreadArray([{}], __read((sides
|
|
67072
|
+
var sideParticipantIds = Object.assign.apply(Object, __spreadArray([{}], __read((sides !== null && sides !== void 0 ? sides : []).map(function (side) {
|
|
66936
67073
|
var _a;
|
|
67074
|
+
var _b;
|
|
66937
67075
|
var sideNumber = side.sideNumber, participant = side.participant;
|
|
66938
67076
|
return (sideNumber && (_a = {},
|
|
66939
67077
|
_a[sideNumber] = __spreadArray([
|
|
66940
67078
|
participant === null || participant === void 0 ? void 0 : participant.participantId
|
|
66941
|
-
], __read(((participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds)
|
|
67079
|
+
], __read(((_b = participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) !== null && _b !== void 0 ? _b : [])), false).filter(Boolean)
|
|
66942
67080
|
.flat(),
|
|
66943
67081
|
_a));
|
|
66944
67082
|
})), false));
|
|
@@ -66984,14 +67122,14 @@ function generateDynamicRatings(_a) {
|
|
|
66984
67122
|
try {
|
|
66985
67123
|
for (var winningSideParticipantIds_1 = (e_2 = void 0, __values(winningSideParticipantIds)), winningSideParticipantIds_1_1 = winningSideParticipantIds_1.next(); !winningSideParticipantIds_1_1.done; winningSideParticipantIds_1_1 = winningSideParticipantIds_1.next()) {
|
|
66986
67124
|
var winnerParticipantId = winningSideParticipantIds_1_1.value;
|
|
66987
|
-
var winnerScaleValue = (
|
|
67125
|
+
var winnerScaleValue = (_d = scaleItemMap[winnerParticipantId]) === null || _d === void 0 ? void 0 : _d.scaleValue;
|
|
66988
67126
|
var winnerRating = typeof winnerScaleValue === 'object'
|
|
66989
67127
|
? winnerScaleValue[accessor]
|
|
66990
67128
|
: winnerScaleValue;
|
|
66991
67129
|
try {
|
|
66992
67130
|
for (var losingSideParticipantIds_1 = (e_3 = void 0, __values(losingSideParticipantIds)), losingSideParticipantIds_1_1 = losingSideParticipantIds_1.next(); !losingSideParticipantIds_1_1.done; losingSideParticipantIds_1_1 = losingSideParticipantIds_1.next()) {
|
|
66993
67131
|
var loserParticipantId = losingSideParticipantIds_1_1.value;
|
|
66994
|
-
var loserScaleValue = (
|
|
67132
|
+
var loserScaleValue = (_e = scaleItemMap[loserParticipantId]) === null || _e === void 0 ? void 0 : _e.scaleValue;
|
|
66995
67133
|
var loserRating = typeof loserScaleValue === 'object'
|
|
66996
67134
|
? loserScaleValue[accessor]
|
|
66997
67135
|
: loserScaleValue;
|
|
@@ -66999,18 +67137,18 @@ function generateDynamicRatings(_a) {
|
|
|
66999
67137
|
var loserCountables = winningSide
|
|
67000
67138
|
? countables[3 - winningSide]
|
|
67001
67139
|
: [0, 0];
|
|
67002
|
-
var
|
|
67140
|
+
var _m = calculateNewRatings({
|
|
67003
67141
|
winnerCountables: winnerCountables,
|
|
67004
67142
|
loserCountables: loserCountables,
|
|
67005
67143
|
maxCountables: maxCountables,
|
|
67006
67144
|
winnerRating: winnerRating,
|
|
67007
67145
|
loserRating: loserRating,
|
|
67008
67146
|
ratingType: ratingType,
|
|
67009
|
-
}), newWinnerRating =
|
|
67147
|
+
}), newWinnerRating = _m.newWinnerRating, newLoserRating = _m.newLoserRating;
|
|
67010
67148
|
var newWinnerScaleValue = accessor
|
|
67011
|
-
? __assign(__assign({}, winnerScaleValue), (
|
|
67149
|
+
? __assign(__assign({}, winnerScaleValue), (_k = {}, _k[accessor] = newWinnerRating, _k)) : newWinnerRating;
|
|
67012
67150
|
var newLoserScaleValue = accessor
|
|
67013
|
-
? __assign(__assign({}, loserScaleValue), (
|
|
67151
|
+
? __assign(__assign({}, loserScaleValue), (_l = {}, _l[accessor] = newLoserRating, _l)) : newLoserRating;
|
|
67014
67152
|
scaleItemMap[winnerParticipantId].scaleValue = newWinnerScaleValue;
|
|
67015
67153
|
scaleItemMap[loserParticipantId].scaleValue = newLoserScaleValue;
|
|
67016
67154
|
var result = setParticipantScaleItem({
|
|
@@ -67034,7 +67172,7 @@ function generateDynamicRatings(_a) {
|
|
|
67034
67172
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
67035
67173
|
finally {
|
|
67036
67174
|
try {
|
|
67037
|
-
if (losingSideParticipantIds_1_1 && !losingSideParticipantIds_1_1.done && (
|
|
67175
|
+
if (losingSideParticipantIds_1_1 && !losingSideParticipantIds_1_1.done && (_j = losingSideParticipantIds_1.return)) _j.call(losingSideParticipantIds_1);
|
|
67038
67176
|
}
|
|
67039
67177
|
finally { if (e_3) throw e_3.error; }
|
|
67040
67178
|
}
|
|
@@ -67043,15 +67181,15 @@ function generateDynamicRatings(_a) {
|
|
|
67043
67181
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
67044
67182
|
finally {
|
|
67045
67183
|
try {
|
|
67046
|
-
if (winningSideParticipantIds_1_1 && !winningSideParticipantIds_1_1.done && (
|
|
67184
|
+
if (winningSideParticipantIds_1_1 && !winningSideParticipantIds_1_1.done && (_h = winningSideParticipantIds_1.return)) _h.call(winningSideParticipantIds_1);
|
|
67047
67185
|
}
|
|
67048
67186
|
finally { if (e_2) throw e_2.error; }
|
|
67049
67187
|
}
|
|
67050
67188
|
Object.assign(modifiedScaleValues, scaleItemMap);
|
|
67051
67189
|
};
|
|
67052
67190
|
try {
|
|
67053
|
-
for (var
|
|
67054
|
-
var matchUp =
|
|
67191
|
+
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
67192
|
+
var matchUp = matchUps_1_1.value;
|
|
67055
67193
|
var state_1 = _loop_1(matchUp);
|
|
67056
67194
|
if (typeof state_1 === "object")
|
|
67057
67195
|
return state_1.value;
|
|
@@ -67060,7 +67198,7 @@ function generateDynamicRatings(_a) {
|
|
|
67060
67198
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
67061
67199
|
finally {
|
|
67062
67200
|
try {
|
|
67063
|
-
if (
|
|
67201
|
+
if (matchUps_1_1 && !matchUps_1_1.done && (_b = matchUps_1.return)) _b.call(matchUps_1);
|
|
67064
67202
|
}
|
|
67065
67203
|
finally { if (e_1) throw e_1.error; }
|
|
67066
67204
|
}
|
|
@@ -68770,7 +68908,7 @@ function generateParticipants(params) {
|
|
|
68770
68908
|
if (ratingType && ratingsParameters$1[ratingType]) {
|
|
68771
68909
|
// ratingAttributes allows selected attributes of ratingParameters to be overridden
|
|
68772
68910
|
var ratingMax_1 = category.ratingMax, ratingMin_1 = category.ratingMin, ratingAttributes = category.ratingAttributes;
|
|
68773
|
-
var ratingParameters =
|
|
68911
|
+
var ratingParameters = __assign(__assign({}, ratingsParameters$1[ratingType]), (ratingAttributes || {}));
|
|
68774
68912
|
var _e = ratingParameters.attributes, attributes_1 = _e === void 0 ? {} : _e, decimalsCount_1 = ratingParameters.decimalsCount, accessors_1 = ratingParameters.accessors, range = ratingParameters.range, step_1 = ratingParameters.step;
|
|
68775
68913
|
var getAttributes_1 = function (attributes) {
|
|
68776
68914
|
var e_1, _a;
|
|
@@ -69130,16 +69268,14 @@ function getParticipantsCount(_a) {
|
|
|
69130
69268
|
largestDoublesDraw = drawSize + alternatesCount;
|
|
69131
69269
|
}
|
|
69132
69270
|
}
|
|
69133
|
-
else {
|
|
69134
|
-
|
|
69135
|
-
|
|
69136
|
-
|
|
69137
|
-
|
|
69138
|
-
|
|
69139
|
-
|
|
69140
|
-
|
|
69141
|
-
largestSinglesDraw = drawSize + alternatesCount;
|
|
69142
|
-
}
|
|
69271
|
+
else if (requiresUniqueParticipants) {
|
|
69272
|
+
var additionalParticipantsCount = drawSize + alternatesCount;
|
|
69273
|
+
if (gender)
|
|
69274
|
+
gendersCount[gender] += additionalParticipantsCount;
|
|
69275
|
+
uniqueParticipantsCount += additionalParticipantsCount;
|
|
69276
|
+
}
|
|
69277
|
+
else if (drawSize && drawSize > largestSinglesDraw) {
|
|
69278
|
+
largestSinglesDraw = drawSize + alternatesCount;
|
|
69143
69279
|
}
|
|
69144
69280
|
};
|
|
69145
69281
|
/*
|
|
@@ -70028,11 +70164,12 @@ function generateEventWithDraw(params) {
|
|
|
70028
70164
|
|
|
70029
70165
|
function generateVenues(_a) {
|
|
70030
70166
|
var e_1, _b;
|
|
70167
|
+
var _c;
|
|
70031
70168
|
var tournamentRecord = _a.tournamentRecord, venueProfiles = _a.venueProfiles, uuids = _a.uuids;
|
|
70032
70169
|
var startDate = tournamentRecord.startDate, endDate = tournamentRecord.endDate;
|
|
70033
70170
|
var venueIds = [];
|
|
70034
70171
|
var _loop_1 = function (index, venueProfile) {
|
|
70035
|
-
var venueAbbreviation = venueProfile.venueAbbreviation,
|
|
70172
|
+
var venueAbbreviation = venueProfile.venueAbbreviation, _g = venueProfile.venueId, venueId = _g === void 0 ? (_c = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _c !== void 0 ? _c : UUID() : _g, dateAvailability = venueProfile.dateAvailability, _h = venueProfile.startTime, startTime = _h === void 0 ? '07:00' : _h, _j = venueProfile.endTime, endTime = _j === void 0 ? '19:00' : _j, courtTimings = venueProfile.courtTimings, courtsCount = venueProfile.courtsCount, courtNames = venueProfile.courtNames, venueName = venueProfile.venueName, idPrefix = venueProfile.idPrefix, courtIds = venueProfile.courtIds;
|
|
70036
70173
|
var newVenue = {
|
|
70037
70174
|
venueName: venueName || "Venue ".concat(index + 1),
|
|
70038
70175
|
venueAbbreviation: venueAbbreviation,
|
|
@@ -70066,8 +70203,8 @@ function generateVenues(_a) {
|
|
|
70066
70203
|
return { value: addResult };
|
|
70067
70204
|
};
|
|
70068
70205
|
try {
|
|
70069
|
-
for (var
|
|
70070
|
-
var
|
|
70206
|
+
for (var _d = __values(venueProfiles.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
70207
|
+
var _f = __read(_e.value, 2), index = _f[0], venueProfile = _f[1];
|
|
70071
70208
|
var state_1 = _loop_1(index, venueProfile);
|
|
70072
70209
|
if (typeof state_1 === "object")
|
|
70073
70210
|
return state_1.value;
|
|
@@ -70076,7 +70213,7 @@ function generateVenues(_a) {
|
|
|
70076
70213
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70077
70214
|
finally {
|
|
70078
70215
|
try {
|
|
70079
|
-
if (
|
|
70216
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
70080
70217
|
}
|
|
70081
70218
|
finally { if (e_1) throw e_1.error; }
|
|
70082
70219
|
}
|
|
@@ -70307,25 +70444,26 @@ var amendsGovernor = {
|
|
|
70307
70444
|
|
|
70308
70445
|
function generateScheduledRounds(_a) {
|
|
70309
70446
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
70447
|
+
var _e, _f;
|
|
70310
70448
|
var schedulingProfile = _a.schedulingProfile, tournamentRecord = _a.tournamentRecord;
|
|
70311
70449
|
if (typeof schedulingProfile !== 'object')
|
|
70312
70450
|
return { error: INVALID_VALUES };
|
|
70313
70451
|
var containedStructures = getContainedStructures({
|
|
70314
70452
|
tournamentRecord: tournamentRecord,
|
|
70315
70453
|
}).containedStructures;
|
|
70316
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps
|
|
70454
|
+
var matchUps = (_e = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _e !== void 0 ? _e : [];
|
|
70317
70455
|
var tournamentId = tournamentRecord.tournamentId;
|
|
70318
70456
|
var scheduledRounds = [];
|
|
70319
70457
|
try {
|
|
70320
70458
|
for (var schedulingProfile_1 = __values(schedulingProfile), schedulingProfile_1_1 = schedulingProfile_1.next(); !schedulingProfile_1_1.done; schedulingProfile_1_1 = schedulingProfile_1.next()) {
|
|
70321
70459
|
var dateProfile = schedulingProfile_1_1.value;
|
|
70322
|
-
var scheduleDate = dateProfile.scheduleDate,
|
|
70460
|
+
var scheduleDate = dateProfile.scheduleDate, _g = dateProfile.venues, venues = _g === void 0 ? [] : _g;
|
|
70323
70461
|
try {
|
|
70324
70462
|
for (var venues_1 = (e_2 = void 0, __values(venues)), venues_1_1 = venues_1.next(); !venues_1_1.done; venues_1_1 = venues_1.next()) {
|
|
70325
70463
|
var venue = venues_1_1.value;
|
|
70326
70464
|
var rounds = venue.rounds, venueId = venue.venueId;
|
|
70327
70465
|
var _loop_1 = function (round) {
|
|
70328
|
-
var
|
|
70466
|
+
var _h;
|
|
70329
70467
|
var drawId = round.drawId, winnerFinishingPositionRange = round.winnerFinishingPositionRange, roundSegment = round.roundSegment;
|
|
70330
70468
|
var targetMatchUps = matchUps.filter(function (matchUp) {
|
|
70331
70469
|
var _a;
|
|
@@ -70347,9 +70485,9 @@ function generateScheduledRounds(_a) {
|
|
|
70347
70485
|
var structureId_1 = targetMatchUp.structureId;
|
|
70348
70486
|
if (roundNumber && !winnerFinishingPositionRange) {
|
|
70349
70487
|
structureId_1 =
|
|
70350
|
-
Object.keys(containedStructures).find(function (containingStructureId) {
|
|
70488
|
+
(_f = Object.keys(containedStructures).find(function (containingStructureId) {
|
|
70351
70489
|
return containedStructures[containingStructureId].includes(structureId_1);
|
|
70352
|
-
})
|
|
70490
|
+
})) !== null && _f !== void 0 ? _f : structureId_1;
|
|
70353
70491
|
}
|
|
70354
70492
|
var roundToSchedule = {
|
|
70355
70493
|
tournamentId: tournamentId,
|
|
@@ -70360,7 +70498,7 @@ function generateScheduledRounds(_a) {
|
|
|
70360
70498
|
drawId: drawId,
|
|
70361
70499
|
};
|
|
70362
70500
|
var result = addSchedulingProfileRound({
|
|
70363
|
-
tournamentRecords: (
|
|
70501
|
+
tournamentRecords: (_h = {}, _h[tournamentId] = tournamentRecord, _h),
|
|
70364
70502
|
round: roundToSchedule,
|
|
70365
70503
|
scheduleDate: scheduleDate,
|
|
70366
70504
|
venueId: venueId,
|