tods-competition-factory 1.8.22 → 1.8.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge/generate.mjs +34 -22
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +21 -16
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +11 -6
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +216 -203
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +480 -463
- 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.23';
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -6007,11 +6007,12 @@ var scheduleConstants = {
|
|
|
6007
6007
|
};
|
|
6008
6008
|
|
|
6009
6009
|
function getMatchUpFormatTiming(_a) {
|
|
6010
|
-
var _b
|
|
6010
|
+
var _b;
|
|
6011
|
+
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
6012
|
if (!tournamentRecord)
|
|
6012
6013
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
6013
6014
|
// event is optional, so eventType can also be passed in directly
|
|
6014
|
-
eventType = eventType
|
|
6015
|
+
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
6016
|
var defaultTiming = {
|
|
6016
6017
|
averageTimes: [{ minutes: { default: defaultAverageMinutes } }],
|
|
6017
6018
|
recoveryTimes: [{ minutes: { default: defaultRecoveryMinutes } }],
|
|
@@ -6661,7 +6662,7 @@ function getVenuesAndCourts$1(_a) {
|
|
|
6661
6662
|
}
|
|
6662
6663
|
function findVenue(_a) {
|
|
6663
6664
|
var e_1, _b;
|
|
6664
|
-
var _c;
|
|
6665
|
+
var _c, _d;
|
|
6665
6666
|
var tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, venueId = _a.venueId;
|
|
6666
6667
|
if (!tournamentRecord)
|
|
6667
6668
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -6672,9 +6673,9 @@ function findVenue(_a) {
|
|
|
6672
6673
|
return venueRecord.venueId === venueId ? venueRecord : venue;
|
|
6673
6674
|
}, undefined);
|
|
6674
6675
|
if (!venue && tournamentRecords) {
|
|
6675
|
-
var linkedTournamentIds = getLinkedTournamentIds({
|
|
6676
|
+
var linkedTournamentIds = (_d = getLinkedTournamentIds({
|
|
6676
6677
|
tournamentRecords: tournamentRecords,
|
|
6677
|
-
}).linkedTournamentIds
|
|
6678
|
+
}).linkedTournamentIds) !== null && _d !== void 0 ? _d : [];
|
|
6678
6679
|
var relevantIds = linkedTournamentIds[tournamentRecord.tournamentId];
|
|
6679
6680
|
try {
|
|
6680
6681
|
// if there are linked tournaments search for court in all linked tournaments
|
|
@@ -7437,6 +7438,7 @@ var participantConstants = {
|
|
|
7437
7438
|
};
|
|
7438
7439
|
|
|
7439
7440
|
function getPairedParticipant(_a) {
|
|
7441
|
+
var _b;
|
|
7440
7442
|
var tournamentParticipants = _a.tournamentParticipants, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds;
|
|
7441
7443
|
var stack = 'getPairedParticipant';
|
|
7442
7444
|
if (!tournamentParticipants && !tournamentRecord)
|
|
@@ -7449,7 +7451,7 @@ function getPairedParticipant(_a) {
|
|
|
7449
7451
|
stack: stack,
|
|
7450
7452
|
});
|
|
7451
7453
|
tournamentParticipants =
|
|
7452
|
-
tournamentParticipants
|
|
7454
|
+
(_b = tournamentParticipants !== null && tournamentParticipants !== void 0 ? tournamentParticipants : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
7453
7455
|
var existingPairedParticipants = tournamentParticipants.filter(function (participant) {
|
|
7454
7456
|
return participant.participantType === PAIR &&
|
|
7455
7457
|
intersection(participantIds, participant.individualParticipantIds)
|
|
@@ -9269,9 +9271,9 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9269
9271
|
_a$h);
|
|
9270
9272
|
|
|
9271
9273
|
function getRoundContextProfile(_a) {
|
|
9272
|
-
var _b, _c, _d, _e;
|
|
9274
|
+
var _b, _c, _d, _e, _f;
|
|
9273
9275
|
var roundNamingPolicy = _a.roundNamingPolicy, drawDefinition = _a.drawDefinition, structure = _a.structure, matchUps = _a.matchUps;
|
|
9274
|
-
var
|
|
9276
|
+
var _g = getRoundMatchUps$1({ matchUps: matchUps }), roundProfile = _g.roundProfile, roundMatchUps = _g.roundMatchUps;
|
|
9275
9277
|
var structureAbbreviation = structure.structureAbbreviation, stage = structure.stage;
|
|
9276
9278
|
var isAdHocStructure = isAdHoc({ structure: structure });
|
|
9277
9279
|
var isLuckyStructure = isLucky({ structure: structure });
|
|
@@ -9291,10 +9293,10 @@ function getRoundContextProfile(_a) {
|
|
|
9291
9293
|
return stageSequence !== null && stageSequence !== void 0 ? stageSequence : 1;
|
|
9292
9294
|
})), false), [0], false)) : 0;
|
|
9293
9295
|
var preQualifyingSequence = qualifyingStageSequences
|
|
9294
|
-
? qualifyingStageSequences - (structure.stageSequence
|
|
9296
|
+
? qualifyingStageSequences - ((_c = structure.stageSequence) !== null && _c !== void 0 ? _c : 1) || ''
|
|
9295
9297
|
: '';
|
|
9296
9298
|
var preQualifyingAffix = preQualifyingSequence
|
|
9297
|
-
? ((
|
|
9299
|
+
? ((_d = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _d === void 0 ? void 0 : _d.preQualifying) ||
|
|
9298
9300
|
defaultRoundNamingPolicy.affixes.preQualifying ||
|
|
9299
9301
|
''
|
|
9300
9302
|
: '';
|
|
@@ -9304,9 +9306,9 @@ function getRoundContextProfile(_a) {
|
|
|
9304
9306
|
var abbreviatedRoundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.abbreviatedRoundNamingMap) ||
|
|
9305
9307
|
defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
|
|
9306
9308
|
{};
|
|
9307
|
-
var preFeedAffix = ((
|
|
9309
|
+
var preFeedAffix = ((_e = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _e === void 0 ? void 0 : _e.preFeedRound) ||
|
|
9308
9310
|
defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
9309
|
-
var roundNumberAffix = ((
|
|
9311
|
+
var roundNumberAffix = ((_f = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _f === void 0 ? void 0 : _f.roundNumber) ||
|
|
9310
9312
|
defaultRoundNamingPolicy.affixes.roundNumber;
|
|
9311
9313
|
var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
|
|
9312
9314
|
defaultRoundNamingPolicy.namingConventions;
|
|
@@ -9625,7 +9627,13 @@ function getAllStructureMatchUps(_a) {
|
|
|
9625
9627
|
matchUps: matchUps,
|
|
9626
9628
|
}).collectionPositionMatchUps);
|
|
9627
9629
|
}
|
|
9628
|
-
return {
|
|
9630
|
+
return {
|
|
9631
|
+
collectionPositionMatchUps: collectionPositionMatchUps,
|
|
9632
|
+
roundMatchUps: roundMatchUps,
|
|
9633
|
+
roundProfile: roundProfile,
|
|
9634
|
+
matchUpsMap: matchUpsMap,
|
|
9635
|
+
matchUps: matchUps,
|
|
9636
|
+
};
|
|
9629
9637
|
function addMatchUpContext(_a) {
|
|
9630
9638
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
9631
9639
|
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;
|
|
@@ -19570,7 +19578,7 @@ function parseScoreString(_a) {
|
|
|
19570
19578
|
isSide1: winningSide === 2,
|
|
19571
19579
|
tiebreakTo: tiebreakTo,
|
|
19572
19580
|
});
|
|
19573
|
-
var setTiebreak = side1TiebreakPerspective
|
|
19581
|
+
var setTiebreak = side1TiebreakPerspective !== null && side1TiebreakPerspective !== void 0 ? side1TiebreakPerspective : [];
|
|
19574
19582
|
var _b = __read(setScores || [], 2), side1Score = _b[0], side2Score = _b[1];
|
|
19575
19583
|
var _c = __read(matchTiebreak || setTiebreak || [], 2), side1TiebreakScore = _c[0], side2TiebreakScore = _c[1];
|
|
19576
19584
|
return {
|
|
@@ -19739,7 +19747,9 @@ function getSuper(values, index) {
|
|
|
19739
19747
|
index ? values.slice(0, 1) : values.slice(2),
|
|
19740
19748
|
].map(function (n) { return parseInt(n.join('')); });
|
|
19741
19749
|
// preserve order
|
|
19742
|
-
|
|
19750
|
+
if (index)
|
|
19751
|
+
parts.reverse();
|
|
19752
|
+
var scores = parts;
|
|
19743
19753
|
var diff = Math.abs(scores.reduce(function (a, b) { return +a - +b; }));
|
|
19744
19754
|
if (diff >= 2)
|
|
19745
19755
|
return scores.join('-');
|
|
@@ -20880,7 +20890,6 @@ function handleNumeric(params) {
|
|
|
20880
20890
|
score = score.toString().toLowerCase();
|
|
20881
20891
|
if (allNumeric)
|
|
20882
20892
|
score = onlyNumbers.join('');
|
|
20883
|
-
// const numbers = score.split('').map((n) => parseInt(n));
|
|
20884
20893
|
var numbers = allNumeric
|
|
20885
20894
|
? onlyNumbers.map(function (n) { return parseInt(n); })
|
|
20886
20895
|
: score.split('').map(function (n) { return parseInt(n); });
|
|
@@ -20943,12 +20952,12 @@ function handleNumeric(params) {
|
|
|
20943
20952
|
getDiff(numbers.slice(2, 4)) === 1 &&
|
|
20944
20953
|
getDiff(numbers.slice(5, 7)) > 1) {
|
|
20945
20954
|
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
|
-
|
|
20955
|
+
/**
|
|
20956
|
+
if (tb === 1) {
|
|
20957
|
+
console.log('BOO');
|
|
20958
|
+
score = `${s1}-${s2} ${s3}-${s4} [${tb}${s5}-${s6}]`;
|
|
20959
|
+
applied.push('numericTiebreakPattern8');
|
|
20960
|
+
} else {
|
|
20952
20961
|
*/
|
|
20953
20962
|
score = "".concat(s1, "-").concat(s2, " ").concat(s3, "-").concat(s4, "(").concat(tb, ") ").concat(s5, "-").concat(s6);
|
|
20954
20963
|
applied.push('numericTiebreakPattern8');
|
|
@@ -21042,7 +21051,7 @@ function handleNumeric(params) {
|
|
|
21042
21051
|
if (superParse && score !== superParse) {
|
|
21043
21052
|
applied.push('parsedSuperPattern');
|
|
21044
21053
|
}
|
|
21045
|
-
score = superParse
|
|
21054
|
+
score = superParse !== null && superParse !== void 0 ? superParse : score;
|
|
21046
21055
|
}
|
|
21047
21056
|
}
|
|
21048
21057
|
return { score: score, applied: applied, matchUpStatus: matchUpStatus };
|
|
@@ -21081,6 +21090,7 @@ function sensibleSets(_a) {
|
|
|
21081
21090
|
var setsCount = sets.length;
|
|
21082
21091
|
score = sets
|
|
21083
21092
|
.map(function (set, index) {
|
|
21093
|
+
var _a;
|
|
21084
21094
|
if (new RegExp(tiebreakSet).test(set)) {
|
|
21085
21095
|
var tiebreak = set.slice(3);
|
|
21086
21096
|
var setScores = set.slice(0, 3);
|
|
@@ -21089,9 +21099,9 @@ function sensibleSets(_a) {
|
|
|
21089
21099
|
var maxSetScore = Math.max.apply(Math, __spreadArray([], __read(sideScores), false));
|
|
21090
21100
|
var maxIndex = setScores.indexOf(maxSetScore);
|
|
21091
21101
|
var sensibleSetScores = [maxSetScore, maxSetScore - 1];
|
|
21092
|
-
|
|
21093
|
-
|
|
21094
|
-
|
|
21102
|
+
if (maxIndex)
|
|
21103
|
+
sensibleSetScores.reverse();
|
|
21104
|
+
var sensibleSetScore = sensibleSetScores.join('-');
|
|
21095
21105
|
return sensibleSetScore + tiebreak;
|
|
21096
21106
|
}
|
|
21097
21107
|
}
|
|
@@ -21106,7 +21116,7 @@ function sensibleSets(_a) {
|
|
|
21106
21116
|
profile.push(setType);
|
|
21107
21117
|
// check for reasonable set scores in the first two sets
|
|
21108
21118
|
if (setsCount > 1 && setType === 'standard' && index < 2) {
|
|
21109
|
-
var
|
|
21119
|
+
var _b = __read(set.split('-'), 2), s1 = _b[0], s2 = _b[1];
|
|
21110
21120
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21111
21121
|
var max = Math.max(s1, s2);
|
|
21112
21122
|
var min_1 = Math.min(s1, s2);
|
|
@@ -21115,10 +21125,10 @@ function sensibleSets(_a) {
|
|
|
21115
21125
|
// coerce larger value to something reasonable
|
|
21116
21126
|
if (max > 9 && diff > 2) {
|
|
21117
21127
|
var splitMax = max.toString().split('');
|
|
21118
|
-
var reasonable = splitMax.find(function (value) {
|
|
21128
|
+
var reasonable = (_a = splitMax.find(function (value) {
|
|
21119
21129
|
return parseInt(value) > min_1 ||
|
|
21120
21130
|
(index && parseInt(value) <= maxSetValue);
|
|
21121
|
-
})
|
|
21131
|
+
})) !== null && _a !== void 0 ? _a : splitMax[0];
|
|
21122
21132
|
if (reasonable) {
|
|
21123
21133
|
set = minIndex
|
|
21124
21134
|
? [reasonable, min_1].join('-')
|
|
@@ -21130,7 +21140,7 @@ function sensibleSets(_a) {
|
|
|
21130
21140
|
}
|
|
21131
21141
|
// throw out any sets where the values are equal and there is no retirement
|
|
21132
21142
|
if (setType === 'standard') {
|
|
21133
|
-
var
|
|
21143
|
+
var _c = __read(set.split('-'), 2), s1 = _c[0], s2 = _c[1];
|
|
21134
21144
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21135
21145
|
if (!diff && matchUpStatus !== 'RETIRED') {
|
|
21136
21146
|
return '';
|
|
@@ -21690,7 +21700,6 @@ function getVenuesAndCourts(_a) {
|
|
|
21690
21700
|
try {
|
|
21691
21701
|
for (var _c = __values(tournamentRecord.venues || []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
21692
21702
|
var venue = _d.value;
|
|
21693
|
-
tournamentRecord.venues;
|
|
21694
21703
|
if (venueIds.length && !venueIds.includes(venue.venueId))
|
|
21695
21704
|
continue;
|
|
21696
21705
|
if (ignoreDisabled) {
|
|
@@ -23127,7 +23136,7 @@ function getContainedStructures(_a) {
|
|
|
23127
23136
|
.flat()
|
|
23128
23137
|
.filter(Boolean);
|
|
23129
23138
|
var _loop_1 = function (structureContainer) {
|
|
23130
|
-
var _c = structureContainer
|
|
23139
|
+
var _c = structureContainer !== null && structureContainer !== void 0 ? structureContainer : {}, structures = _c.structures, structureId = _c.structureId;
|
|
23131
23140
|
structures &&
|
|
23132
23141
|
structureId &&
|
|
23133
23142
|
(containedStructures[structureId] = structures === null || structures === void 0 ? void 0 : structures.map(function (structure) { return structure.structureId; })) &&
|
|
@@ -30200,10 +30209,11 @@ function filterParticipants(_a) {
|
|
|
30200
30209
|
var participantIds_1 = tournamentEvents
|
|
30201
30210
|
.filter(function (event) { return eventIds.includes(event.eventId); })
|
|
30202
30211
|
.map(function (event) {
|
|
30212
|
+
var _a;
|
|
30203
30213
|
var enteredParticipantIds = (event.entries || []).map(function (entry) { return entry.participantId; });
|
|
30204
30214
|
if (event.eventType === SINGLES)
|
|
30205
30215
|
return enteredParticipantIds;
|
|
30206
|
-
var individualParticipantIds = ((tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30216
|
+
var individualParticipantIds = ((_a = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _a !== void 0 ? _a : [])
|
|
30207
30217
|
.filter(function (participant) {
|
|
30208
30218
|
return enteredParticipantIds.includes(participant.participantId);
|
|
30209
30219
|
})
|
|
@@ -30574,6 +30584,7 @@ var penaltyTemplate = function (_a) {
|
|
|
30574
30584
|
};
|
|
30575
30585
|
|
|
30576
30586
|
function addPenalty$1(_a) {
|
|
30587
|
+
var _b;
|
|
30577
30588
|
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
30589
|
if (!tournamentRecord)
|
|
30579
30590
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30582,7 +30593,7 @@ function addPenalty$1(_a) {
|
|
|
30582
30593
|
if (!penaltyType)
|
|
30583
30594
|
return { error: MISSING_PENALTY_TYPE };
|
|
30584
30595
|
// TODO: add penalty timeItem to matchUp.timeItems[]
|
|
30585
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30596
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30586
30597
|
var relevantParticipants = participants.filter(function (participant) {
|
|
30587
30598
|
return participantIds.includes(participant.participantId);
|
|
30588
30599
|
});
|
|
@@ -30618,18 +30629,20 @@ function addPenalty$1(_a) {
|
|
|
30618
30629
|
return __assign(__assign({}, SUCCESS), { penaltyId: penaltyItem.penaltyId });
|
|
30619
30630
|
}
|
|
30620
30631
|
function removePenalty$1(_a) {
|
|
30632
|
+
var _b;
|
|
30621
30633
|
var tournamentRecord = _a.tournamentRecord, penaltyId = _a.penaltyId;
|
|
30622
30634
|
if (!tournamentRecord)
|
|
30623
30635
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30624
30636
|
if (!penaltyId)
|
|
30625
30637
|
return { error: MISSING_PENALTY_ID };
|
|
30626
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30638
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30627
30639
|
var modifiedParticipants = [];
|
|
30628
30640
|
var penaltyRemoved = false;
|
|
30629
30641
|
var removedPenalty;
|
|
30630
30642
|
participants.forEach(function (participant) {
|
|
30643
|
+
var _a;
|
|
30631
30644
|
var participantModified = false;
|
|
30632
|
-
participant.penalties = (participant.penalties
|
|
30645
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).filter(function (penalty) {
|
|
30633
30646
|
if (penalty.penaltyId === penaltyId) {
|
|
30634
30647
|
participantModified = true;
|
|
30635
30648
|
if (!penaltyRemoved) {
|
|
@@ -30655,13 +30668,15 @@ function removePenalty$1(_a) {
|
|
|
30655
30668
|
? __assign(__assign({}, SUCCESS), { penalty: removedPenalty }) : { error: PENALTY_NOT_FOUND };
|
|
30656
30669
|
}
|
|
30657
30670
|
function getTournamentPenalties(_a) {
|
|
30671
|
+
var _b;
|
|
30658
30672
|
var tournamentRecord = _a.tournamentRecord;
|
|
30659
30673
|
if (!tournamentRecord)
|
|
30660
30674
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30661
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30675
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30662
30676
|
var allPenalties = participants.reduce(function (penalties, participant) {
|
|
30677
|
+
var _a;
|
|
30663
30678
|
var participantId = participant.participantId;
|
|
30664
|
-
(participant.penalties
|
|
30679
|
+
((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).forEach(function (penalty) {
|
|
30665
30680
|
var penaltyId = (penalty || {}).penaltyId;
|
|
30666
30681
|
if (penalties[penaltyId]) {
|
|
30667
30682
|
penalties[penaltyId].participants.push(participantId);
|
|
@@ -30675,6 +30690,7 @@ function getTournamentPenalties(_a) {
|
|
|
30675
30690
|
return { penalties: Object.values(allPenalties) };
|
|
30676
30691
|
}
|
|
30677
30692
|
function modifyPenalty$1(_a) {
|
|
30693
|
+
var _b;
|
|
30678
30694
|
var tournamentRecord = _a.tournamentRecord, modifications = _a.modifications, penaltyId = _a.penaltyId;
|
|
30679
30695
|
if (!tournamentRecord)
|
|
30680
30696
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30682,7 +30698,7 @@ function modifyPenalty$1(_a) {
|
|
|
30682
30698
|
return { error: INVALID_VALUES, modifications: modifications };
|
|
30683
30699
|
if (!penaltyId)
|
|
30684
30700
|
return { error: MISSING_PENALTY_ID };
|
|
30685
|
-
var participants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
30701
|
+
var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
30686
30702
|
var validAttributes = Object.keys(penaltyTemplate()).filter(function (attribute) { return attribute !== 'penaltyId'; });
|
|
30687
30703
|
var validModificationAttributes = Object.keys(modifications).filter(function (attribute) { return validAttributes.includes(attribute); });
|
|
30688
30704
|
if (!validModificationAttributes.length)
|
|
@@ -30690,8 +30706,9 @@ function modifyPenalty$1(_a) {
|
|
|
30690
30706
|
var updatedPenalty;
|
|
30691
30707
|
var modifiedParticipants = [];
|
|
30692
30708
|
participants.forEach(function (participant) {
|
|
30709
|
+
var _a;
|
|
30693
30710
|
var participantModified = false;
|
|
30694
|
-
participant.penalties = (participant.penalties
|
|
30711
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).map(function (penalty) {
|
|
30695
30712
|
if (penalty.penaltyId === penaltyId) {
|
|
30696
30713
|
participantModified = true;
|
|
30697
30714
|
validModificationAttributes.forEach(function (attribute) {
|
|
@@ -30721,18 +30738,18 @@ function modifyPenalty$1(_a) {
|
|
|
30721
30738
|
|
|
30722
30739
|
function addPenalty(params) {
|
|
30723
30740
|
var e_1, _a;
|
|
30724
|
-
var _b;
|
|
30741
|
+
var _b, _c;
|
|
30725
30742
|
var tournamentRecords = params.tournamentRecords, participantIds = params.participantIds;
|
|
30726
30743
|
var penaltyId;
|
|
30727
30744
|
try {
|
|
30728
|
-
for (var
|
|
30729
|
-
var tournamentRecord =
|
|
30745
|
+
for (var _d = __values(Object.values(tournamentRecords)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
30746
|
+
var tournamentRecord = _e.value;
|
|
30730
30747
|
var participants = (_b = getParticipants$1({
|
|
30731
30748
|
tournamentRecord: tournamentRecord,
|
|
30732
30749
|
}).participants) !== null && _b !== void 0 ? _b : [];
|
|
30733
30750
|
var tournamentParticipantIds = participants === null || participants === void 0 ? void 0 : participants.map(extractAttributes('participantId')).filter(function (participantId) { return participantIds.includes(participantId); });
|
|
30734
30751
|
if (tournamentParticipantIds.length) {
|
|
30735
|
-
var result = addPenalty$1(__assign(__assign({}, params), { penaltyId: params.penaltyId
|
|
30752
|
+
var result = addPenalty$1(__assign(__assign({}, params), { penaltyId: (_c = params.penaltyId) !== null && _c !== void 0 ? _c : penaltyId, tournamentRecord: tournamentRecord, participantIds: tournamentParticipantIds }));
|
|
30736
30753
|
penaltyId = result.penaltyId;
|
|
30737
30754
|
}
|
|
30738
30755
|
}
|
|
@@ -30740,7 +30757,7 @@ function addPenalty(params) {
|
|
|
30740
30757
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
30741
30758
|
finally {
|
|
30742
30759
|
try {
|
|
30743
|
-
if (
|
|
30760
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
30744
30761
|
}
|
|
30745
30762
|
finally { if (e_1) throw e_1.error; }
|
|
30746
30763
|
}
|
|
@@ -30804,7 +30821,7 @@ function getCompetitionPenalties(_a) {
|
|
|
30804
30821
|
for (var _c = __values(Object.values(tournamentRecords)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
30805
30822
|
var tournamentRecord = _d.value;
|
|
30806
30823
|
var penalties = getTournamentPenalties({ tournamentRecord: tournamentRecord }).penalties;
|
|
30807
|
-
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties
|
|
30824
|
+
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties !== null && penalties !== void 0 ? penalties : [])), false));
|
|
30808
30825
|
}
|
|
30809
30826
|
}
|
|
30810
30827
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -36652,7 +36669,8 @@ function modifyPersonRequests(_a) {
|
|
|
36652
36669
|
|
|
36653
36670
|
function clearScheduledMatchUps$1(_a) {
|
|
36654
36671
|
var e_1, _b;
|
|
36655
|
-
var _c
|
|
36672
|
+
var _c, _d, _e;
|
|
36673
|
+
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
36674
|
if (typeof tournamentRecord !== 'object')
|
|
36657
36675
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36658
36676
|
if (!Array.isArray(ignoreMatchUpStatuses) || !Array.isArray(venueIds)) {
|
|
@@ -36660,10 +36678,10 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36660
36678
|
}
|
|
36661
36679
|
if (venueIds.length)
|
|
36662
36680
|
scheduleAttributes.push('venueId');
|
|
36663
|
-
var inContextMatchUps = allTournamentMatchUps({
|
|
36681
|
+
var inContextMatchUps = (_c = allTournamentMatchUps({
|
|
36664
36682
|
matchUpFilters: { scheduledDates: scheduledDates },
|
|
36665
36683
|
tournamentRecord: tournamentRecord,
|
|
36666
|
-
}).matchUps
|
|
36684
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
36667
36685
|
var relevantMatchUpIds = inContextMatchUps
|
|
36668
36686
|
.filter(function (matchUp) {
|
|
36669
36687
|
return matchUp.matchUpStatus &&
|
|
@@ -36672,16 +36690,16 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36672
36690
|
(!(venueIds === null || venueIds === void 0 ? void 0 : venueIds.length) || venueIds.includes(matchUp.schedule.venueId));
|
|
36673
36691
|
})
|
|
36674
36692
|
.map(getMatchUpId);
|
|
36675
|
-
var matchUps = allTournamentMatchUps({
|
|
36693
|
+
var matchUps = (_d = allTournamentMatchUps({
|
|
36676
36694
|
tournamentRecord: tournamentRecord,
|
|
36677
36695
|
inContext: false,
|
|
36678
|
-
}).matchUps
|
|
36696
|
+
}).matchUps) !== null && _d !== void 0 ? _d : [];
|
|
36679
36697
|
var clearedScheduleCount = 0;
|
|
36680
36698
|
try {
|
|
36681
36699
|
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
36682
36700
|
var matchUp = matchUps_1_1.value;
|
|
36683
36701
|
if (relevantMatchUpIds.includes(matchUp.matchUpId)) {
|
|
36684
|
-
matchUp.timeItems = (matchUp.timeItems
|
|
36702
|
+
matchUp.timeItems = ((_e = matchUp.timeItems) !== null && _e !== void 0 ? _e : []).filter(function (timeItem) {
|
|
36685
36703
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) &&
|
|
36686
36704
|
![
|
|
36687
36705
|
ALLOCATE_COURTS,
|
|
@@ -39721,18 +39739,19 @@ function getEventAlternateParticipantIds(_a) {
|
|
|
39721
39739
|
}
|
|
39722
39740
|
|
|
39723
39741
|
function matchUpActions$1(_a) {
|
|
39742
|
+
var _b, _c;
|
|
39724
39743
|
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
39744
|
if (!tournamentRecord)
|
|
39726
39745
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
39727
39746
|
if (!drawId) {
|
|
39728
39747
|
// if matchUp did not have context, find drawId by brute force
|
|
39729
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps
|
|
39748
|
+
var matchUps = (_b = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _b !== void 0 ? _b : [];
|
|
39730
39749
|
drawId = matchUps.reduce(function (drawId, candidate) {
|
|
39731
39750
|
return candidate.matchUpId === matchUpId ? candidate.drawId : drawId;
|
|
39732
39751
|
}, undefined);
|
|
39733
|
-
var events = tournamentRecord.events
|
|
39752
|
+
var events = (_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [];
|
|
39734
39753
|
var drawDefinitions = events
|
|
39735
|
-
.map(function (event) { return event.drawDefinitions
|
|
39754
|
+
.map(function (event) { var _a; return (_a = event.drawDefinitions) !== null && _a !== void 0 ? _a : []; })
|
|
39736
39755
|
.flat();
|
|
39737
39756
|
drawDefinition = drawDefinitions.reduce(function (drawDefinition, candidate) {
|
|
39738
39757
|
return candidate.drawId === drawId ? candidate : drawDefinition;
|
|
@@ -39744,7 +39763,7 @@ function matchUpActions$1(_a) {
|
|
|
39744
39763
|
drawDefinition: drawDefinition,
|
|
39745
39764
|
event: event,
|
|
39746
39765
|
}).policyDefinitions;
|
|
39747
|
-
policyDefinitions = policyDefinitions
|
|
39766
|
+
policyDefinitions = policyDefinitions !== null && policyDefinitions !== void 0 ? policyDefinitions : attachedPolicy;
|
|
39748
39767
|
if (drawDefinition) {
|
|
39749
39768
|
return matchUpActions$2({
|
|
39750
39769
|
tournamentParticipants: tournamentRecord.participants,
|
|
@@ -40231,16 +40250,17 @@ function deletionMessage(_a) {
|
|
|
40231
40250
|
|
|
40232
40251
|
function deleteVenue$1(_a) {
|
|
40233
40252
|
var e_1, _b;
|
|
40253
|
+
var _c, _d;
|
|
40234
40254
|
var tournamentRecord = _a.tournamentRecord, venueId = _a.venueId, force = _a.force;
|
|
40235
40255
|
if (!tournamentRecord)
|
|
40236
40256
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
40237
40257
|
if (typeof venueId !== 'string')
|
|
40238
40258
|
return { error: MISSING_VENUE_ID };
|
|
40239
40259
|
var contextFilters = { venueIds: [venueId] };
|
|
40240
|
-
var matchUpsToUnschedule = allTournamentMatchUps({
|
|
40260
|
+
var matchUpsToUnschedule = (_c = allTournamentMatchUps({
|
|
40241
40261
|
tournamentRecord: tournamentRecord,
|
|
40242
40262
|
contextFilters: contextFilters,
|
|
40243
|
-
}).matchUps
|
|
40263
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
40244
40264
|
if (!matchUpsToUnschedule.length || force) {
|
|
40245
40265
|
try {
|
|
40246
40266
|
// if no matchUpsToUnschedule this does nothing but avoid the deletionMessage
|
|
@@ -40267,7 +40287,7 @@ function deleteVenue$1(_a) {
|
|
|
40267
40287
|
return deletionMessage({ matchUpsCount: matchUpsToUnschedule.length });
|
|
40268
40288
|
}
|
|
40269
40289
|
var deleted;
|
|
40270
|
-
tournamentRecord.venues = (tournamentRecord.venues
|
|
40290
|
+
tournamentRecord.venues = ((_d = tournamentRecord.venues) !== null && _d !== void 0 ? _d : []).filter(function (venue) {
|
|
40271
40291
|
if ((venue === null || venue === void 0 ? void 0 : venue.venueId) !== venueId)
|
|
40272
40292
|
return true;
|
|
40273
40293
|
deleted = true;
|
|
@@ -40487,6 +40507,7 @@ function getScheduledVenueMatchUps(_a) {
|
|
|
40487
40507
|
|
|
40488
40508
|
function deleteCourt$1(_a) {
|
|
40489
40509
|
var e_1, _b;
|
|
40510
|
+
var _c;
|
|
40490
40511
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, disableNotice = _a.disableNotice, courtId = _a.courtId, force = _a.force;
|
|
40491
40512
|
var result = findCourt({ tournamentRecord: tournamentRecord, courtId: courtId });
|
|
40492
40513
|
if (result.error)
|
|
@@ -40498,8 +40519,8 @@ function deleteCourt$1(_a) {
|
|
|
40498
40519
|
}).matchUps;
|
|
40499
40520
|
if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length) || force) {
|
|
40500
40521
|
try {
|
|
40501
|
-
for (var
|
|
40502
|
-
var matchUp =
|
|
40522
|
+
for (var _d = __values(matchUps !== null && matchUps !== void 0 ? matchUps : []), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
40523
|
+
var matchUp = _e.value;
|
|
40503
40524
|
var result_1 = removeCourtAssignment({
|
|
40504
40525
|
matchUpId: matchUp.matchUpId,
|
|
40505
40526
|
drawId: matchUp.drawId,
|
|
@@ -40513,12 +40534,12 @@ function deleteCourt$1(_a) {
|
|
|
40513
40534
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40514
40535
|
finally {
|
|
40515
40536
|
try {
|
|
40516
|
-
if (
|
|
40537
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
40517
40538
|
}
|
|
40518
40539
|
finally { if (e_1) throw e_1.error; }
|
|
40519
40540
|
}
|
|
40520
40541
|
if (venue) {
|
|
40521
|
-
venue.courts = (venue.courts
|
|
40542
|
+
venue.courts = ((_c = venue.courts) !== null && _c !== void 0 ? _c : []).filter(function (courtRecord) {
|
|
40522
40543
|
return courtRecord.courtId !== courtId;
|
|
40523
40544
|
});
|
|
40524
40545
|
if (!disableNotice)
|
|
@@ -41930,7 +41951,7 @@ function treeMatchUps(_a) {
|
|
|
41930
41951
|
uuids: uuids,
|
|
41931
41952
|
}), roundNodes = _b.roundNodes, matchUps = _b.matchUps);
|
|
41932
41953
|
roundNumber++;
|
|
41933
|
-
roundLimit = roundLimit
|
|
41954
|
+
roundLimit = roundLimit !== null && roundLimit !== void 0 ? roundLimit : qualifyingRoundNumber;
|
|
41934
41955
|
while (roundNodes.length > 1) {
|
|
41935
41956
|
if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
|
|
41936
41957
|
roundLimit = roundNumber - 1;
|
|
@@ -41960,7 +41981,7 @@ function treeMatchUps(_a) {
|
|
|
41960
41981
|
roundLimit = roundNumber - 1;
|
|
41961
41982
|
}
|
|
41962
41983
|
else {
|
|
41963
|
-
matchUps = matchUps.filter(function (matchUp) { return roundLimit && (matchUp.roundNumber
|
|
41984
|
+
matchUps = matchUps.filter(function (matchUp) { var _a; return roundLimit && ((_a = matchUp.roundNumber) !== null && _a !== void 0 ? _a : 0) <= roundLimit; });
|
|
41964
41985
|
}
|
|
41965
41986
|
return { drawSize: drawSize, matchUps: matchUps, roundsCount: roundsCount, roundLimit: roundLimit };
|
|
41966
41987
|
}
|
|
@@ -42101,7 +42122,6 @@ function generateQualifyingStructures(_a) {
|
|
|
42101
42122
|
roundTarget: roundTarget,
|
|
42102
42123
|
linkType: linkType,
|
|
42103
42124
|
});
|
|
42104
|
-
targetRoundQualifiersCount = 0;
|
|
42105
42125
|
roundTarget += 1;
|
|
42106
42126
|
}
|
|
42107
42127
|
}
|
|
@@ -42116,16 +42136,19 @@ function generateQualifyingStructures(_a) {
|
|
|
42116
42136
|
}
|
|
42117
42137
|
|
|
42118
42138
|
function getStructureRoundProfile(_a) {
|
|
42119
|
-
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42139
|
+
var drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId;
|
|
42120
42140
|
var result = findStructure({
|
|
42121
42141
|
drawDefinition: drawDefinition,
|
|
42122
42142
|
structureId: structureId,
|
|
42123
42143
|
});
|
|
42124
42144
|
if (result.error)
|
|
42125
|
-
return result;
|
|
42145
|
+
return decorateResult({ result: result });
|
|
42126
42146
|
// DEV-NOTE cannot pass drawDefinition parameter in this scenario; callstack error
|
|
42127
|
-
var matchUps = getAllStructureMatchUps({
|
|
42128
|
-
|
|
42147
|
+
var matchUps = getAllStructureMatchUps({
|
|
42148
|
+
structure: result.structure,
|
|
42149
|
+
matchUpsMap: matchUpsMap,
|
|
42150
|
+
}).matchUps;
|
|
42151
|
+
return __assign(__assign({}, getRoundMatchUps$1({ matchUps: matchUps })), { matchUps: matchUps, matchUpsMap: matchUpsMap });
|
|
42129
42152
|
}
|
|
42130
42153
|
|
|
42131
42154
|
function getFinishingPositionSourceRoundsMap(_a) {
|
|
@@ -42172,23 +42195,24 @@ function roundValueRanges(values) {
|
|
|
42172
42195
|
}
|
|
42173
42196
|
|
|
42174
42197
|
function getPositionsPlayedOff(_a) {
|
|
42175
|
-
var
|
|
42198
|
+
var _b;
|
|
42199
|
+
var drawDefinition = _a.drawDefinition, structureIds = _a.structureIds, matchUpsMap = _a.matchUpsMap;
|
|
42176
42200
|
if (structureIds && !Array.isArray(structureIds))
|
|
42177
42201
|
return { error: INVALID_VALUES, context: { structureIds: structureIds } };
|
|
42178
42202
|
if (!drawDefinition)
|
|
42179
42203
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42180
42204
|
structureIds =
|
|
42181
|
-
structureIds
|
|
42182
|
-
(
|
|
42183
|
-
|
|
42184
|
-
|
|
42185
|
-
|
|
42186
|
-
|
|
42187
|
-
});
|
|
42205
|
+
structureIds !== null && structureIds !== void 0 ? structureIds : ((_b = drawDefinition.structures) !== null && _b !== void 0 ? _b : [])
|
|
42206
|
+
.filter(function (structure) { return structure.stage !== QUALIFYING; })
|
|
42207
|
+
.map(function (_a) {
|
|
42208
|
+
var structureId = _a.structureId;
|
|
42209
|
+
return structureId;
|
|
42210
|
+
});
|
|
42188
42211
|
var allFinishingPositionRanges = structureIds
|
|
42189
42212
|
.map(function (structureId) {
|
|
42190
42213
|
var roundProfile = getStructureRoundProfile({
|
|
42191
42214
|
drawDefinition: drawDefinition,
|
|
42215
|
+
matchUpsMap: matchUpsMap,
|
|
42192
42216
|
structureId: structureId,
|
|
42193
42217
|
}).roundProfile;
|
|
42194
42218
|
var values = roundProfile && Object.values(roundProfile);
|
|
@@ -42304,20 +42328,21 @@ function getAvailablePlayoffProfiles$1(_a) {
|
|
|
42304
42328
|
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42305
42329
|
if (!drawDefinition)
|
|
42306
42330
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42331
|
+
var _c = allDrawMatchUps$1({
|
|
42332
|
+
inContext: true,
|
|
42333
|
+
drawDefinition: drawDefinition,
|
|
42334
|
+
}), matchUps = _c.matchUps, matchUpsMap = _c.matchUpsMap;
|
|
42307
42335
|
// positions which are being played off by existing structure(s)
|
|
42308
|
-
var
|
|
42336
|
+
var _d = getPositionsPlayedOff({
|
|
42309
42337
|
drawDefinition: drawDefinition,
|
|
42310
|
-
|
|
42338
|
+
matchUpsMap: matchUpsMap,
|
|
42339
|
+
}), positionsNotPlayedOff = _d.positionsNotPlayedOff, positionsPlayedOff = _d.positionsPlayedOff;
|
|
42311
42340
|
var structures = getDrawStructures({ drawDefinition: drawDefinition }).structures;
|
|
42312
42341
|
var filteredStructures = structures.filter(function (structure) {
|
|
42313
42342
|
return (!structureId && structure.stage !== VOLUNTARY_CONSOLATION) ||
|
|
42314
42343
|
structure.structureId === structureId;
|
|
42315
42344
|
});
|
|
42316
42345
|
var available = {};
|
|
42317
|
-
var matchUps = allDrawMatchUps$1({
|
|
42318
|
-
inContext: true,
|
|
42319
|
-
drawDefinition: drawDefinition,
|
|
42320
|
-
}).matchUps;
|
|
42321
42346
|
try {
|
|
42322
42347
|
for (var filteredStructures_1 = __values(filteredStructures), filteredStructures_1_1 = filteredStructures_1.next(); !filteredStructures_1_1.done; filteredStructures_1_1 = filteredStructures_1.next()) {
|
|
42323
42348
|
var structure = filteredStructures_1_1.value;
|
|
@@ -46880,12 +46905,12 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
46880
46905
|
// not for use when generating structures from qualifyingProfiles
|
|
46881
46906
|
function generateQualifyingStructure$1(params) {
|
|
46882
46907
|
var _a;
|
|
46883
|
-
var _b, _c, _d, _e;
|
|
46908
|
+
var _b, _c, _d, _e, _f;
|
|
46884
46909
|
if (!params.drawDefinition)
|
|
46885
46910
|
return { error: MISSING_DRAW_DEFINITION };
|
|
46886
46911
|
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;
|
|
46912
|
+
var drawSize = (_b = params.drawSize) !== null && _b !== void 0 ? _b : coerceEven(params.participantsCount);
|
|
46913
|
+
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
46914
|
var roundLimit, roundsCount, structure, matchUps;
|
|
46890
46915
|
var qualifiersCount = 0;
|
|
46891
46916
|
var finishingPositions;
|
|
@@ -46918,8 +46943,9 @@ function generateQualifyingStructure$1(params) {
|
|
|
46918
46943
|
var nextStageSequence = 2;
|
|
46919
46944
|
var chainModified = void 0;
|
|
46920
46945
|
while (!chainModified && nextStructureId_1) {
|
|
46946
|
+
console.log('check getRoundContextProfile preqQualifyingStageSequence');
|
|
46921
46947
|
targetStructure.stageSequence = nextStageSequence;
|
|
46922
|
-
var targetTargetStructureId = (
|
|
46948
|
+
var targetTargetStructureId = (_e = (_d = (_c = drawDefinition.links) === null || _c === void 0 ? void 0 : _c.find(function (link) { return link.source.structureId === nextStructureId_1; })) === null || _d === void 0 ? void 0 : _d.target) === null || _e === void 0 ? void 0 : _e.structureId;
|
|
46923
46949
|
nextStructureId_1 = targetTargetStructureId;
|
|
46924
46950
|
nextStageSequence += 1;
|
|
46925
46951
|
if (!targetTargetStructureId) {
|
|
@@ -46947,14 +46973,13 @@ function generateQualifyingStructure$1(params) {
|
|
|
46947
46973
|
}
|
|
46948
46974
|
var roundTargetName = roundTarget ? "".concat(roundTarget, "-") : '';
|
|
46949
46975
|
var stageSequenceName = "".concat(stageSequence);
|
|
46950
|
-
var qualifyingStructureName = structureName ||
|
|
46951
|
-
(
|
|
46952
|
-
|
|
46953
|
-
: constantToString(QUALIFYING));
|
|
46976
|
+
var qualifyingStructureName = structureName !== null && structureName !== void 0 ? structureName : (roundTargetName || stageSequenceName
|
|
46977
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
46978
|
+
: constantToString(QUALIFYING));
|
|
46954
46979
|
if (drawType === ROUND_ROBIN) {
|
|
46955
|
-
var
|
|
46956
|
-
structureName: structureName
|
|
46957
|
-
structureId: structureId
|
|
46980
|
+
var _g = generateRoundRobin({
|
|
46981
|
+
structureName: structureName !== null && structureName !== void 0 ? structureName : qualifyingStructureName,
|
|
46982
|
+
structureId: structureId !== null && structureId !== void 0 ? structureId : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
46958
46983
|
stage: QUALIFYING,
|
|
46959
46984
|
structureOptions: structureOptions,
|
|
46960
46985
|
appliedPolicies: appliedPolicies,
|
|
@@ -46965,7 +46990,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46965
46990
|
drawSize: drawSize,
|
|
46966
46991
|
isMock: isMock,
|
|
46967
46992
|
uuids: uuids,
|
|
46968
|
-
}), maxRoundNumber =
|
|
46993
|
+
}), maxRoundNumber = _g.maxRoundNumber /*, groupSize*/, structures = _g.structures, groupCount = _g.groupCount;
|
|
46969
46994
|
qualifiersCount = groupCount;
|
|
46970
46995
|
roundLimit = maxRoundNumber;
|
|
46971
46996
|
structure = structures[0];
|
|
@@ -46984,10 +47009,11 @@ function generateQualifyingStructure$1(params) {
|
|
|
46984
47009
|
if (!roundLimit)
|
|
46985
47010
|
roundLimit = roundsCount;
|
|
46986
47011
|
structure = structureTemplate({
|
|
46987
|
-
structureName: structureName
|
|
46988
|
-
structureId: structureId
|
|
47012
|
+
structureName: structureName !== null && structureName !== void 0 ? structureName : qualifyingStructureName,
|
|
47013
|
+
structureId: structureId !== null && structureId !== void 0 ? structureId : uuids === null || uuids === void 0 ? void 0 : uuids.pop(),
|
|
46989
47014
|
qualifyingRoundNumber: roundLimit,
|
|
46990
47015
|
stage: QUALIFYING,
|
|
47016
|
+
matchUpFormat: matchUpFormat,
|
|
46991
47017
|
stageSequence: stageSequence,
|
|
46992
47018
|
matchUpType: matchUpType,
|
|
46993
47019
|
roundLimit: roundLimit,
|
|
@@ -46999,7 +47025,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46999
47025
|
extension: { name: ROUND_TARGET, value: roundTarget },
|
|
47000
47026
|
});
|
|
47001
47027
|
}
|
|
47002
|
-
qualifiersCount = (
|
|
47028
|
+
qualifiersCount = (_f = matchUps === null || matchUps === void 0 ? void 0 : matchUps.filter(function (matchUp) { return matchUp.roundNumber === roundLimit; })) === null || _f === void 0 ? void 0 : _f.length;
|
|
47003
47029
|
}
|
|
47004
47030
|
// order of operations is important here!! finalQualifier positions is not yet updated when this step occurs
|
|
47005
47031
|
var linkType = drawType === ROUND_ROBIN ? LinkTypeEnum.Position : LinkTypeEnum.Winner;
|
|
@@ -47581,7 +47607,7 @@ function renameStructures$1(_a) {
|
|
|
47581
47607
|
}
|
|
47582
47608
|
|
|
47583
47609
|
function removeStructure(_a) {
|
|
47584
|
-
var _b, _c;
|
|
47610
|
+
var _b, _c, _d;
|
|
47585
47611
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, event = _a.event;
|
|
47586
47612
|
if (typeof structureId !== 'string')
|
|
47587
47613
|
return { error: INVALID_VALUES };
|
|
@@ -47596,13 +47622,16 @@ function removeStructure(_a) {
|
|
|
47596
47622
|
return stage === MAIN && stageSequence === 1;
|
|
47597
47623
|
});
|
|
47598
47624
|
var isMainStageSequence1 = structureId === mainStageSequence1.structureId;
|
|
47599
|
-
var
|
|
47625
|
+
var qualifyingStructureIds = structures
|
|
47626
|
+
.filter(function (_a) {
|
|
47600
47627
|
var stage = _a.stage;
|
|
47601
47628
|
return stage === QUALIFYING;
|
|
47602
|
-
})
|
|
47603
|
-
|
|
47629
|
+
})
|
|
47630
|
+
.map(extractAttributes('structureId'));
|
|
47631
|
+
if (isMainStageSequence1 && !qualifyingStructureIds.length) {
|
|
47604
47632
|
return { error: CANNOT_REMOVE_MAIN_STRUCTURE };
|
|
47605
47633
|
}
|
|
47634
|
+
var structureIds = structures.map(extractAttributes('structureId'));
|
|
47606
47635
|
var removedMatchUpIds = [];
|
|
47607
47636
|
var idsToRemove = [structureId];
|
|
47608
47637
|
var getTargetedStructureIds = function (structureId) {
|
|
@@ -47613,16 +47642,21 @@ function removeStructure(_a) {
|
|
|
47613
47642
|
link.target.structureId;
|
|
47614
47643
|
}).filter(Boolean);
|
|
47615
47644
|
};
|
|
47616
|
-
var
|
|
47617
|
-
var structureId = _a.structureId;
|
|
47618
|
-
return structureId;
|
|
47619
|
-
});
|
|
47620
|
-
var targetedStructureIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(structureIds.map(function (structureId) {
|
|
47645
|
+
var getQualifyingSourceStructureIds = function (structureId) {
|
|
47621
47646
|
var _a;
|
|
47622
|
-
return (_a = {
|
|
47623
|
-
|
|
47624
|
-
|
|
47625
|
-
|
|
47647
|
+
return (_a = drawDefinition.links) === null || _a === void 0 ? void 0 : _a.map(function (link) {
|
|
47648
|
+
return qualifyingStructureIds.includes(link.source.structureId) &&
|
|
47649
|
+
link.target.structureId === structureId &&
|
|
47650
|
+
link.source.structureId;
|
|
47651
|
+
}).filter(Boolean);
|
|
47652
|
+
};
|
|
47653
|
+
var isQualifyingStructure = qualifyingStructureIds.includes(structureId);
|
|
47654
|
+
var relatedStructureIdsMap = new Map();
|
|
47655
|
+
structureIds.forEach(function (id) {
|
|
47656
|
+
return relatedStructureIdsMap.set(id, isQualifyingStructure
|
|
47657
|
+
? getQualifyingSourceStructureIds(id)
|
|
47658
|
+
: getTargetedStructureIds(id));
|
|
47659
|
+
});
|
|
47626
47660
|
var _loop_1 = function () {
|
|
47627
47661
|
var idBeingRemoved = idsToRemove.pop();
|
|
47628
47662
|
var structure = findStructure({
|
|
@@ -47645,11 +47679,13 @@ function removeStructure(_a) {
|
|
|
47645
47679
|
});
|
|
47646
47680
|
}
|
|
47647
47681
|
var targetedStructureIds = idBeingRemoved &&
|
|
47648
|
-
|
|
47682
|
+
(
|
|
47683
|
+
// targetedStructureIdsMap[idBeingRemoved].filter(
|
|
47684
|
+
(_d = relatedStructureIdsMap.get(idBeingRemoved)) === null || _d === void 0 ? void 0 : _d.filter(function (id) {
|
|
47649
47685
|
// IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
|
|
47650
47686
|
return id !== mainStageSequence1.structureId ||
|
|
47651
47687
|
structureId === mainStageSequence1.structureId;
|
|
47652
|
-
});
|
|
47688
|
+
}));
|
|
47653
47689
|
if (targetedStructureIds === null || targetedStructureIds === void 0 ? void 0 : targetedStructureIds.length)
|
|
47654
47690
|
idsToRemove.push.apply(idsToRemove, __spreadArray([], __read(targetedStructureIds), false));
|
|
47655
47691
|
};
|
|
@@ -48477,8 +48513,8 @@ function isUngrouped(entryStatus) {
|
|
|
48477
48513
|
|
|
48478
48514
|
function modifyEntriesStatus(_a) {
|
|
48479
48515
|
var e_1, _b, e_2, _c;
|
|
48480
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
48481
|
-
var
|
|
48516
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
48517
|
+
var _w = _a.autoEntryPositions, autoEntryPositions = _w === void 0 ? true : _w, ignoreAssignment = _a.ignoreAssignment, // override check for existing assignments
|
|
48482
48518
|
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
48519
|
eventSync = _a.eventSync, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
48484
48520
|
if (!participantIds || !Array.isArray(participantIds))
|
|
@@ -48520,7 +48556,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48520
48556
|
}).assignedParticipantIds) !== null && _a !== void 0 ? _a : [];
|
|
48521
48557
|
assignedParticipantIds.push.apply(assignedParticipantIds, __spreadArray([], __read(participantIds), false));
|
|
48522
48558
|
});
|
|
48523
|
-
var tournamentParticipants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
48559
|
+
var tournamentParticipants = (_e = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _e !== void 0 ? _e : [];
|
|
48524
48560
|
var validEntryStatusForAllParticipantIds = participantIds.every(function (participantId) {
|
|
48525
48561
|
var _a;
|
|
48526
48562
|
var participantType = (_a = findParticipant({
|
|
@@ -48539,7 +48575,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48539
48575
|
if (!validEntryStatusForAllParticipantIds)
|
|
48540
48576
|
return { error: INVALID_ENTRY_STATUS };
|
|
48541
48577
|
var flightProfile = event && getFlightProfile({ event: event }).flightProfile;
|
|
48542
|
-
var flight = (
|
|
48578
|
+
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
48579
|
// ------------------------------------------------------------------------
|
|
48544
48580
|
// reusable functions
|
|
48545
48581
|
var updateEntryStatus = function (entries) {
|
|
@@ -48586,10 +48622,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48586
48622
|
? __assign({}, SUCCESS) : { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
48587
48623
|
};
|
|
48588
48624
|
var autoPosition = function (_a) {
|
|
48625
|
+
var _b;
|
|
48589
48626
|
var flight = _a.flight, drawDefinition = _a.drawDefinition;
|
|
48590
48627
|
if (event) {
|
|
48591
48628
|
event.entries = refreshEntryPositions({
|
|
48592
|
-
entries: event.entries
|
|
48629
|
+
entries: (_b = event.entries) !== null && _b !== void 0 ? _b : [],
|
|
48593
48630
|
});
|
|
48594
48631
|
}
|
|
48595
48632
|
if (flight) {
|
|
@@ -48622,18 +48659,17 @@ function modifyEntriesStatus(_a) {
|
|
|
48622
48659
|
};
|
|
48623
48660
|
// ------------------------------------------------------------------------
|
|
48624
48661
|
// before modifying, if autoEntryPositions: true, pre-assign entryPositions
|
|
48625
|
-
var entryPositionsExist = ((
|
|
48662
|
+
var entryPositionsExist = (_h = (_g = event === null || event === void 0 ? void 0 : event.entries) === null || _g === void 0 ? void 0 : _g.find(function (_a) {
|
|
48663
|
+
var entryPosition = _a.entryPosition;
|
|
48664
|
+
return entryPosition;
|
|
48665
|
+
})) !== 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
48666
|
var entryPosition = _a.entryPosition;
|
|
48627
48667
|
return entryPosition;
|
|
48628
48668
|
})) ||
|
|
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) {
|
|
48669
|
+
((_k = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) === null || _k === void 0 ? void 0 : _k.find(function (_a) {
|
|
48634
48670
|
var entryPosition = _a.entryPosition;
|
|
48635
48671
|
return entryPosition;
|
|
48636
|
-
}));
|
|
48672
|
+
})));
|
|
48637
48673
|
if (autoEntryPositions && !entryPositionsExist)
|
|
48638
48674
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48639
48675
|
// ------------------------------------------------------------------------
|
|
@@ -48645,11 +48681,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48645
48681
|
}
|
|
48646
48682
|
// ------------------------------------------------------------------------
|
|
48647
48683
|
// update any flights which have no draw generated to keep entries in sync
|
|
48648
|
-
var generatedDrawIds = ((
|
|
48684
|
+
var generatedDrawIds = (_m = (_l = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _l === void 0 ? void 0 : _l.map(function (_a) {
|
|
48649
48685
|
var drawId = _a.drawId;
|
|
48650
48686
|
return drawId;
|
|
48651
|
-
}))
|
|
48652
|
-
var flightsNoDraw = ((
|
|
48687
|
+
})) !== null && _m !== void 0 ? _m : [];
|
|
48688
|
+
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
48689
|
try {
|
|
48654
48690
|
for (var flightsNoDraw_1 = __values(flightsNoDraw), flightsNoDraw_1_1 = flightsNoDraw_1.next(); !flightsNoDraw_1_1.done; flightsNoDraw_1_1 = flightsNoDraw_1.next()) {
|
|
48655
48691
|
var flight_1 = flightsNoDraw_1_1.value;
|
|
@@ -48666,8 +48702,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48666
48702
|
finally { if (e_1) throw e_1.error; }
|
|
48667
48703
|
}
|
|
48668
48704
|
// ------------------------------------------------------------------------
|
|
48669
|
-
var singleDraw = ((
|
|
48670
|
-
(((
|
|
48705
|
+
var singleDraw = ((_p = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _p === void 0 ? void 0 : _p.length) === 1 &&
|
|
48706
|
+
((_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
48707
|
if (!flight &&
|
|
48672
48708
|
!drawDefinition &&
|
|
48673
48709
|
entryStatus &&
|
|
@@ -48684,7 +48720,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48684
48720
|
return decorateResult({ result: result, stack: stack });
|
|
48685
48721
|
var error_1;
|
|
48686
48722
|
if (entryStatus === WITHDRAWN) {
|
|
48687
|
-
(
|
|
48723
|
+
(_t = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _t === void 0 ? void 0 : _t.every(function (flight) {
|
|
48688
48724
|
var result = updateEntryStatus(flight.drawEntries);
|
|
48689
48725
|
if (result.error) {
|
|
48690
48726
|
error_1 = result.error;
|
|
@@ -48696,7 +48732,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48696
48732
|
});
|
|
48697
48733
|
return true;
|
|
48698
48734
|
});
|
|
48699
|
-
(
|
|
48735
|
+
(_u = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _u === void 0 ? void 0 : _u.every(function (drawDefinition) {
|
|
48700
48736
|
var _a;
|
|
48701
48737
|
var result = updateEntryStatus(drawDefinition.entries);
|
|
48702
48738
|
if (result.error) {
|
|
@@ -48716,8 +48752,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48716
48752
|
if (autoEntryPositions)
|
|
48717
48753
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48718
48754
|
try {
|
|
48719
|
-
for (var
|
|
48720
|
-
var drawDefinition_1 =
|
|
48755
|
+
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()) {
|
|
48756
|
+
var drawDefinition_1 = _y.value;
|
|
48721
48757
|
if (modifiedDrawIds.length &&
|
|
48722
48758
|
!modifiedDrawIds.includes(drawDefinition_1.drawId))
|
|
48723
48759
|
continue;
|
|
@@ -48731,7 +48767,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48731
48767
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
48732
48768
|
finally {
|
|
48733
48769
|
try {
|
|
48734
|
-
if (
|
|
48770
|
+
if (_y && !_y.done && (_c = _x.return)) _c.call(_x);
|
|
48735
48771
|
}
|
|
48736
48772
|
finally { if (e_2) throw e_2.error; }
|
|
48737
48773
|
}
|
|
@@ -49019,8 +49055,8 @@ function participantInFlightEntries(_a) {
|
|
|
49019
49055
|
}
|
|
49020
49056
|
|
|
49021
49057
|
function removeEventEntries(_a) {
|
|
49022
|
-
var _b, _c, _d, _e, _f;
|
|
49023
|
-
var
|
|
49058
|
+
var _b, _c, _d, _e, _f, _g;
|
|
49059
|
+
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
49060
|
var stack = 'removeEventEntries';
|
|
49025
49061
|
if (!(event === null || event === void 0 ? void 0 : event.eventId))
|
|
49026
49062
|
return { error: MISSING_EVENT };
|
|
@@ -49070,7 +49106,7 @@ function removeEventEntries(_a) {
|
|
|
49070
49106
|
if (!(participantIds === null || participantIds === void 0 ? void 0 : participantIds.length))
|
|
49071
49107
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: [] });
|
|
49072
49108
|
var participantIdsRemoved = [];
|
|
49073
|
-
event.entries = (event.entries
|
|
49109
|
+
event.entries = ((_e = event.entries) !== null && _e !== void 0 ? _e : []).filter(function (entry) {
|
|
49074
49110
|
var keepEntry = !participantIds.includes(entry === null || entry === void 0 ? void 0 : entry.participantId);
|
|
49075
49111
|
if (!keepEntry)
|
|
49076
49112
|
participantIdsRemoved.push(entry.participantId);
|
|
@@ -49083,11 +49119,12 @@ function removeEventEntries(_a) {
|
|
|
49083
49119
|
}
|
|
49084
49120
|
// also remove entry from all flights and drawDefinitions
|
|
49085
49121
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
49086
|
-
(
|
|
49122
|
+
(_f = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _f === void 0 ? void 0 : _f.forEach(function (flight) {
|
|
49087
49123
|
flight.drawEntries = (flight.drawEntries || []).filter(function (entry) { return !participantIds.includes(entry.participantId); });
|
|
49088
49124
|
});
|
|
49089
|
-
(
|
|
49090
|
-
|
|
49125
|
+
(_g = event.drawDefinitions) === null || _g === void 0 ? void 0 : _g.forEach(function (drawDefinition) {
|
|
49126
|
+
var _a;
|
|
49127
|
+
drawDefinition.entries = ((_a = drawDefinition.entries) !== null && _a !== void 0 ? _a : []).filter(function (entry) { return !participantIds.includes(entry.participantId); });
|
|
49091
49128
|
});
|
|
49092
49129
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: participantIdsRemoved });
|
|
49093
49130
|
}
|
|
@@ -49264,6 +49301,7 @@ function addEventEntries(params) {
|
|
|
49264
49301
|
|
|
49265
49302
|
function removeIndividualParticipantIds(_a) {
|
|
49266
49303
|
var e_1, _b;
|
|
49304
|
+
var _c, _d, _e;
|
|
49267
49305
|
var addIndividualParticipantsToEvents = _a.addIndividualParticipantsToEvents, individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, tournamentRecord = _a.tournamentRecord, suppressErrors = _a.suppressErrors;
|
|
49268
49306
|
var stack = 'removeIndividualParticipantIds';
|
|
49269
49307
|
if (!tournamentRecord)
|
|
@@ -49273,7 +49311,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49273
49311
|
});
|
|
49274
49312
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
49275
49313
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
49276
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49314
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
49277
49315
|
var groupingParticipant = tournamentParticipants.find(function (participant) {
|
|
49278
49316
|
return participant.participantId === groupingParticipantId;
|
|
49279
49317
|
});
|
|
@@ -49299,7 +49337,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49299
49337
|
return decorateResult({ result: result, stack: stack });
|
|
49300
49338
|
if (addIndividualParticipantsToEvents) {
|
|
49301
49339
|
var _loop_1 = function (event_1) {
|
|
49302
|
-
var enteredIds = (event_1.entries
|
|
49340
|
+
var enteredIds = ((_e = event_1.entries) !== null && _e !== void 0 ? _e : [])
|
|
49303
49341
|
.map(function (_a) {
|
|
49304
49342
|
var participantId = _a.participantId;
|
|
49305
49343
|
return participantId;
|
|
@@ -49316,15 +49354,15 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49316
49354
|
}
|
|
49317
49355
|
};
|
|
49318
49356
|
try {
|
|
49319
|
-
for (var
|
|
49320
|
-
var event_1 =
|
|
49357
|
+
for (var _f = __values((_d = tournamentRecord.events) !== null && _d !== void 0 ? _d : []), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
49358
|
+
var event_1 = _g.value;
|
|
49321
49359
|
_loop_1(event_1);
|
|
49322
49360
|
}
|
|
49323
49361
|
}
|
|
49324
49362
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
49325
49363
|
finally {
|
|
49326
49364
|
try {
|
|
49327
|
-
if (
|
|
49365
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
49328
49366
|
}
|
|
49329
49367
|
finally { if (e_1) throw e_1.error; }
|
|
49330
49368
|
}
|
|
@@ -49342,8 +49380,8 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49342
49380
|
}
|
|
49343
49381
|
function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
49344
49382
|
var _b;
|
|
49345
|
-
var _c;
|
|
49346
|
-
var
|
|
49383
|
+
var _c, _d;
|
|
49384
|
+
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
49385
|
var removed = [];
|
|
49348
49386
|
if (!groupingParticipant)
|
|
49349
49387
|
return { removed: removed };
|
|
@@ -49364,9 +49402,9 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49364
49402
|
var eventId = _a.eventId;
|
|
49365
49403
|
return eventId;
|
|
49366
49404
|
});
|
|
49367
|
-
var updatedIndividualParticipantIds = (groupingParticipant.individualParticipantIds
|
|
49405
|
+
var updatedIndividualParticipantIds = ((_d = groupingParticipant.individualParticipantIds) !== null && _d !== void 0 ? _d : []).filter(function (participantId) {
|
|
49368
49406
|
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
49369
|
-
var _e;
|
|
49407
|
+
var _e, _f, _g, _h, _j, _k;
|
|
49370
49408
|
var targetParticipant = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.includes(participantId);
|
|
49371
49409
|
var scoredParticipantGroupingMatchUps = targetParticipant &&
|
|
49372
49410
|
((_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 +49424,30 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49386
49424
|
if (removeParticipant) {
|
|
49387
49425
|
removed.push(participantId);
|
|
49388
49426
|
try {
|
|
49389
|
-
for (var
|
|
49390
|
-
var event_2 =
|
|
49427
|
+
for (var _l = __values((_f = tournamentRecord.events) !== null && _f !== void 0 ? _f : []), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
49428
|
+
var event_2 = _m.value;
|
|
49391
49429
|
try {
|
|
49392
|
-
for (var
|
|
49393
|
-
var drawDefinition =
|
|
49430
|
+
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()) {
|
|
49431
|
+
var drawDefinition = _p.value;
|
|
49394
49432
|
var extension = findExtension$2({
|
|
49395
49433
|
element: drawDefinition,
|
|
49396
49434
|
name: LINEUPS,
|
|
49397
49435
|
}).extension;
|
|
49398
49436
|
var lineUp = extension === null || extension === void 0 ? void 0 : extension.value[groupingParticipant.participantId];
|
|
49399
49437
|
if (extension && lineUp) {
|
|
49400
|
-
|
|
49438
|
+
extension.value[groupingParticipant.participantId] = lineUp.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
49401
49439
|
addExtension$1({ element: drawDefinition, extension: extension });
|
|
49402
49440
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
49403
49441
|
}
|
|
49404
|
-
var matchUps = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps
|
|
49405
|
-
[];
|
|
49442
|
+
var matchUps = (_h = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps) !== null && _h !== void 0 ? _h : [];
|
|
49406
49443
|
try {
|
|
49407
49444
|
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
49445
|
var matchUp = matchUps_1_1.value;
|
|
49409
|
-
var sides = matchUp.sides
|
|
49446
|
+
var sides = (_j = matchUp.sides) !== null && _j !== void 0 ? _j : [];
|
|
49410
49447
|
try {
|
|
49411
49448
|
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
49449
|
var side = sides_1_1.value;
|
|
49413
|
-
var lineUp_1 = side.lineUp
|
|
49450
|
+
var lineUp_1 = (_k = side.lineUp) !== null && _k !== void 0 ? _k : [];
|
|
49414
49451
|
var containsParticipant = lineUp_1.find(function (assignment) { return assignment.participantId === participantId; });
|
|
49415
49452
|
if (containsParticipant) {
|
|
49416
49453
|
side.lineUp = lineUp_1.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
@@ -49443,7 +49480,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49443
49480
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
49444
49481
|
finally {
|
|
49445
49482
|
try {
|
|
49446
|
-
if (
|
|
49483
|
+
if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
|
|
49447
49484
|
}
|
|
49448
49485
|
finally { if (e_3) throw e_3.error; }
|
|
49449
49486
|
}
|
|
@@ -49452,7 +49489,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49452
49489
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
49453
49490
|
finally {
|
|
49454
49491
|
try {
|
|
49455
|
-
if (
|
|
49492
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
49456
49493
|
}
|
|
49457
49494
|
finally { if (e_2) throw e_2.error; }
|
|
49458
49495
|
}
|
|
@@ -49475,15 +49512,16 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49475
49512
|
result);
|
|
49476
49513
|
}
|
|
49477
49514
|
function removeParticipantIdsFromAllTeams(_a) {
|
|
49478
|
-
var _b
|
|
49515
|
+
var _b;
|
|
49516
|
+
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
49517
|
if (!tournamentRecord)
|
|
49480
49518
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
49481
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49482
|
-
var
|
|
49519
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49520
|
+
var _f = getParticipants$1({
|
|
49483
49521
|
withMatchUps: true,
|
|
49484
49522
|
tournamentRecord: tournamentRecord,
|
|
49485
49523
|
withEvents: true,
|
|
49486
|
-
}), participants =
|
|
49524
|
+
}), participants = _f.participants, mappedMatchUps = _f.mappedMatchUps;
|
|
49487
49525
|
var modifications = 0;
|
|
49488
49526
|
tournamentParticipants
|
|
49489
49527
|
.filter(function (participant) {
|
|
@@ -49538,10 +49576,11 @@ function deleteParticipants(params) {
|
|
|
49538
49576
|
withDraws: true,
|
|
49539
49577
|
}).participants) !== null && _f !== void 0 ? _f : [];
|
|
49540
49578
|
var getPlacedPairParticipantIds = function () {
|
|
49541
|
-
var
|
|
49579
|
+
var _a;
|
|
49580
|
+
var matchUps = (_a = allTournamentMatchUps({
|
|
49542
49581
|
matchUpFilters: { drawIds: teamDrawIds, matchUpTypes: [DOUBLES$1] },
|
|
49543
49582
|
tournamentRecord: tournamentRecord,
|
|
49544
|
-
}).matchUps
|
|
49583
|
+
}).matchUps) !== null && _a !== void 0 ? _a : [];
|
|
49545
49584
|
var placedPairParticipantIds = matchUps
|
|
49546
49585
|
.map(function (_a) {
|
|
49547
49586
|
var sides = _a.sides;
|
|
@@ -49697,7 +49736,7 @@ function getStageEntries(_a) {
|
|
|
49697
49736
|
}
|
|
49698
49737
|
|
|
49699
49738
|
function destroyGroupEntry(_a) {
|
|
49700
|
-
var _b;
|
|
49739
|
+
var _b, _c, _d;
|
|
49701
49740
|
var removeGroupParticipant = _a.removeGroupParticipant, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, participantId = _a.participantId, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
49702
49741
|
var stack = 'destroyGroupEntry';
|
|
49703
49742
|
if (!tournamentRecord)
|
|
@@ -49710,7 +49749,7 @@ function destroyGroupEntry(_a) {
|
|
|
49710
49749
|
![TypeEnum.Doubles, TypeEnum.Team].includes(event.eventType)) {
|
|
49711
49750
|
return decorateResult({ result: { error: INVALID_EVENT_TYPE }, stack: stack });
|
|
49712
49751
|
}
|
|
49713
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49752
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49714
49753
|
var participant = tournamentParticipants.find(function (participant) { return participant.participantId === participantId; });
|
|
49715
49754
|
if (!participant) {
|
|
49716
49755
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -49721,7 +49760,7 @@ function destroyGroupEntry(_a) {
|
|
|
49721
49760
|
(participant.participantType === PAIR && event.eventType !== DOUBLES)) {
|
|
49722
49761
|
return { error: INVALID_PARTICIPANT_TYPE };
|
|
49723
49762
|
}
|
|
49724
|
-
var eventEntries = event.entries
|
|
49763
|
+
var eventEntries = (_c = event.entries) !== null && _c !== void 0 ? _c : [];
|
|
49725
49764
|
var entry = eventEntries.find(function (entry) { return entry.participantId === participantId; });
|
|
49726
49765
|
if (!entry)
|
|
49727
49766
|
return { error: PARTICIPANT_ENTRY_NOT_FOUND };
|
|
@@ -49746,10 +49785,9 @@ function destroyGroupEntry(_a) {
|
|
|
49746
49785
|
.filter(Boolean);
|
|
49747
49786
|
// find only those individualParticipantIds which do not occur MULTIPLE TIMES in PAIRs/GROUPs in the event.entries or drawEntries
|
|
49748
49787
|
// this scenario can occur in e.g. ITA tournaments where an individual participant is paired multiple times across flights
|
|
49749
|
-
var individualParticipantIds = (
|
|
49788
|
+
var individualParticipantIds = (_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.filter(function (participantId) {
|
|
49750
49789
|
return arrayIndices(participantId, individualParticipantIdsInGroups).length === 1;
|
|
49751
49790
|
});
|
|
49752
|
-
// const individualParticipantIds = participant.individualParticipantIds;
|
|
49753
49791
|
// remove the group participant from event entries
|
|
49754
49792
|
var result = removeEventEntries({
|
|
49755
49793
|
participantIds: [participantId],
|
|
@@ -49820,16 +49858,6 @@ function destroyPairEntries(params) {
|
|
|
49820
49858
|
return destroyedCount ? __assign({ destroyedCount: destroyedCount }, SUCCESS) : { error: errors };
|
|
49821
49859
|
}
|
|
49822
49860
|
|
|
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
49861
|
function removeDrawPositionAssignment(params) {
|
|
49834
49862
|
var tournamentRecord = params.tournamentRecord, replaceWithBye = params.replaceWithBye, drawDefinition = params.drawDefinition, destroyPair = params.destroyPair, entryStatus = params.entryStatus, matchUpsMap = params.matchUpsMap, drawId = params.drawId;
|
|
49835
49863
|
var stack = 'removeDrawPositionAssignment';
|
|
@@ -49844,7 +49872,7 @@ function removeDrawPositionAssignment(params) {
|
|
|
49844
49872
|
tournamentRecord: tournamentRecord_1,
|
|
49845
49873
|
participantId: participantId,
|
|
49846
49874
|
}).participant;
|
|
49847
|
-
var _a = participant
|
|
49875
|
+
var _a = participant !== null && participant !== void 0 ? participant : {}, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
49848
49876
|
if (destroyPair && participantType === PAIR) {
|
|
49849
49877
|
var result_1 = destroyPairEntry({
|
|
49850
49878
|
tournamentRecord: tournamentRecord_1,
|
|
@@ -53766,13 +53794,14 @@ function getEligibleVoluntaryConsolationParticipants(params) {
|
|
|
53766
53794
|
}
|
|
53767
53795
|
|
|
53768
53796
|
function getParticipantEventDetails(_a) {
|
|
53797
|
+
var _b, _c;
|
|
53769
53798
|
var tournamentRecord = _a.tournamentRecord, participantId = _a.participantId;
|
|
53770
53799
|
if (!tournamentRecord)
|
|
53771
53800
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53772
53801
|
if (!participantId)
|
|
53773
53802
|
return { error: MISSING_PARTICIPANT_ID };
|
|
53774
53803
|
// relveantParticipantIds is the target participantId along with any TEAM or PAIR participantIds to which participantId belongs
|
|
53775
|
-
var relevantParticipantIds = [participantId].concat((tournamentRecord.participants
|
|
53804
|
+
var relevantParticipantIds = [participantId].concat(((_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [])
|
|
53776
53805
|
.filter(function (participant) {
|
|
53777
53806
|
var _a;
|
|
53778
53807
|
return (participant === null || participant === void 0 ? void 0 : participant.participantType) &&
|
|
@@ -53780,9 +53809,10 @@ function getParticipantEventDetails(_a) {
|
|
|
53780
53809
|
((_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId));
|
|
53781
53810
|
})
|
|
53782
53811
|
.map(function (participant) { return participant.participantId; }));
|
|
53783
|
-
var relevantEvents = (tournamentRecord.events
|
|
53812
|
+
var relevantEvents = ((_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [])
|
|
53784
53813
|
.filter(function (event) {
|
|
53785
|
-
var
|
|
53814
|
+
var _a;
|
|
53815
|
+
var enteredParticipantIds = ((_a = event === null || event === void 0 ? void 0 : event.entries) !== null && _a !== void 0 ? _a : []).map(function (entry) { return entry.participantId; });
|
|
53786
53816
|
return overlap(enteredParticipantIds, relevantParticipantIds);
|
|
53787
53817
|
})
|
|
53788
53818
|
.map(function (event) { return ({ eventName: event.eventName, eventId: event.eventId }); });
|
|
@@ -53811,6 +53841,7 @@ function getDerivedPositionAssignments(_a) {
|
|
|
53811
53841
|
}
|
|
53812
53842
|
|
|
53813
53843
|
function getRelevantParticipantIdsMap(_a) {
|
|
53844
|
+
var _b;
|
|
53814
53845
|
var processParticipantId = _a.processParticipantId, // optional method which is passed each participantId
|
|
53815
53846
|
tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord;
|
|
53816
53847
|
if (typeof tournamentRecord !== 'object' &&
|
|
@@ -53822,7 +53853,7 @@ function getRelevantParticipantIdsMap(_a) {
|
|
|
53822
53853
|
? Object.values(tournamentRecords)
|
|
53823
53854
|
.map(function (tournamentRecord) { return (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || []; })
|
|
53824
53855
|
.flat()
|
|
53825
|
-
: (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants)
|
|
53856
|
+
: (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
53826
53857
|
var relevantParticipantIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(allParticipants.map(function (_a) {
|
|
53827
53858
|
var _b;
|
|
53828
53859
|
var participantId = _a.participantId, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
@@ -53900,21 +53931,21 @@ function participantScheduledMatchUps(_a) {
|
|
|
53900
53931
|
|
|
53901
53932
|
function annotateParticipant(params) {
|
|
53902
53933
|
var e_1, _a, e_2, _b;
|
|
53903
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
53904
|
-
var
|
|
53934
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
53935
|
+
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
53936
|
var scheduleConflicts = [];
|
|
53906
53937
|
var scheduleItems = [];
|
|
53907
53938
|
if (withIOC || withISO2)
|
|
53908
53939
|
addNationalityCode({ participant: participant, withIOC: withIOC, withISO2: withISO2 });
|
|
53909
53940
|
if (withScaleValues) {
|
|
53910
|
-
var
|
|
53941
|
+
var _t = getScaleValues({ participant: participant }), ratings = _t.ratings, rankings = _t.rankings;
|
|
53911
53942
|
participant.rankings = rankings;
|
|
53912
53943
|
participant.ratings = ratings;
|
|
53913
53944
|
}
|
|
53914
53945
|
var participantId = participant === null || participant === void 0 ? void 0 : participant.participantId;
|
|
53915
53946
|
if (!participantId || !participantIdMap[participantId])
|
|
53916
53947
|
return {};
|
|
53917
|
-
var
|
|
53948
|
+
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
53949
|
var denominator = wins + losses;
|
|
53919
53950
|
var numerator = wins;
|
|
53920
53951
|
var statValue = denominator && numerator / denominator;
|
|
@@ -53972,7 +54003,7 @@ function annotateParticipant(params) {
|
|
|
53972
54003
|
_b);
|
|
53973
54004
|
})), false));
|
|
53974
54005
|
var _loop_1 = function (participantEvent) {
|
|
53975
|
-
var e_3,
|
|
54006
|
+
var e_3, _v, e_4, _w, e_5, _x;
|
|
53976
54007
|
var getScaleAccessor = function (scaleName) {
|
|
53977
54008
|
return [SCALE$1, SEEDING$1, participantEvent.eventType, scaleName].join('.');
|
|
53978
54009
|
};
|
|
@@ -54024,15 +54055,15 @@ function annotateParticipant(params) {
|
|
|
54024
54055
|
participantEvent.seedAssignments = seedAssignments;
|
|
54025
54056
|
}
|
|
54026
54057
|
else {
|
|
54027
|
-
var
|
|
54058
|
+
var _y = participantEvent.category || {}, categoryName = _y.categoryName, ageCategoryCode = _y.ageCategoryCode;
|
|
54028
54059
|
var scaleItem = void 0;
|
|
54029
54060
|
try {
|
|
54030
|
-
for (var
|
|
54061
|
+
for (var _z = (e_3 = void 0, __values([
|
|
54031
54062
|
participantEvent.eventId,
|
|
54032
54063
|
ageCategoryCode,
|
|
54033
54064
|
categoryName,
|
|
54034
|
-
])),
|
|
54035
|
-
var scaleName =
|
|
54065
|
+
])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
54066
|
+
var scaleName = _0.value;
|
|
54036
54067
|
var scaleAttributes = {
|
|
54037
54068
|
eventType: participantEvent.eventType,
|
|
54038
54069
|
scaleType: SEEDING$1,
|
|
@@ -54051,7 +54082,7 @@ function annotateParticipant(params) {
|
|
|
54051
54082
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
54052
54083
|
finally {
|
|
54053
54084
|
try {
|
|
54054
|
-
if (
|
|
54085
|
+
if (_0 && !_0.done && (_v = _z.return)) _v.call(_z);
|
|
54055
54086
|
}
|
|
54056
54087
|
finally { if (e_3) throw e_3.error; }
|
|
54057
54088
|
}
|
|
@@ -54068,8 +54099,8 @@ function annotateParticipant(params) {
|
|
|
54068
54099
|
}
|
|
54069
54100
|
if ((_k = participantEvent.drawIds) === null || _k === void 0 ? void 0 : _k.length) {
|
|
54070
54101
|
try {
|
|
54071
|
-
for (var
|
|
54072
|
-
var flightDrawId =
|
|
54102
|
+
for (var _1 = (e_4 = void 0, __values(participantEvent.drawIds || [])), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
54103
|
+
var flightDrawId = _2.value;
|
|
54073
54104
|
var drawSeedPublishingDisabled = ((_l = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _l === void 0 ? void 0 : _l.length) &&
|
|
54074
54105
|
!((_m = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _m === void 0 ? void 0 : _m.includes(flightDrawId));
|
|
54075
54106
|
if (eventSeedingPublished && !drawSeedPublishingDisabled) {
|
|
@@ -54081,15 +54112,15 @@ function annotateParticipant(params) {
|
|
|
54081
54112
|
// preserve filtering of MAIN/QUALIFYING seedValues, if present
|
|
54082
54113
|
if (seedAssignments && participantEvent.seedAssignments) {
|
|
54083
54114
|
try {
|
|
54084
|
-
for (var
|
|
54085
|
-
var key =
|
|
54115
|
+
for (var _3 = (e_5 = void 0, __values(Object.keys(participantEvent.seedAssignments))), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
54116
|
+
var key = _4.value;
|
|
54086
54117
|
participantEvent.seedAssignments[key] = seedAssignments[key];
|
|
54087
54118
|
}
|
|
54088
54119
|
}
|
|
54089
54120
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
54090
54121
|
finally {
|
|
54091
54122
|
try {
|
|
54092
|
-
if (
|
|
54123
|
+
if (_4 && !_4.done && (_x = _3.return)) _x.call(_3);
|
|
54093
54124
|
}
|
|
54094
54125
|
finally { if (e_5) throw e_5.error; }
|
|
54095
54126
|
}
|
|
@@ -54103,7 +54134,7 @@ function annotateParticipant(params) {
|
|
|
54103
54134
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
54104
54135
|
finally {
|
|
54105
54136
|
try {
|
|
54106
|
-
if (
|
|
54137
|
+
if (_2 && !_2.done && (_w = _1.return)) _w.call(_1);
|
|
54107
54138
|
}
|
|
54108
54139
|
finally { if (e_4) throw e_4.error; }
|
|
54109
54140
|
}
|
|
@@ -54139,9 +54170,9 @@ function annotateParticipant(params) {
|
|
|
54139
54170
|
}
|
|
54140
54171
|
var allParticipantMatchUps = participantMatchUps.concat(participantPotentialMatchUps);
|
|
54141
54172
|
// scheduledMatchUps are a participant's matchUps separated by date and sorted by scheduledTime
|
|
54142
|
-
var scheduledMatchUps = ((_o = participantScheduledMatchUps({
|
|
54173
|
+
var scheduledMatchUps = (_p = (_o = participantScheduledMatchUps({
|
|
54143
54174
|
matchUps: allParticipantMatchUps,
|
|
54144
|
-
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps)
|
|
54175
|
+
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps) !== null && _p !== void 0 ? _p : [];
|
|
54145
54176
|
var scheduledMinutesDifference = (scheduleAnalysis || {}).scheduledMinutesDifference;
|
|
54146
54177
|
var dates = Object.keys(scheduledMatchUps);
|
|
54147
54178
|
dates.forEach(function (date) {
|
|
@@ -54967,7 +54998,7 @@ function getParticipantMembership(_a) {
|
|
|
54967
54998
|
participantFilters: { participantTypes: [TEAM, PAIR, GROUP] },
|
|
54968
54999
|
tournamentRecord: tournamentRecord,
|
|
54969
55000
|
}).participants;
|
|
54970
|
-
var memberOf = (participants
|
|
55001
|
+
var memberOf = (participants !== null && participants !== void 0 ? participants : []).filter(function (participant) {
|
|
54971
55002
|
var _a;
|
|
54972
55003
|
return (_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId);
|
|
54973
55004
|
});
|
|
@@ -54984,16 +55015,17 @@ function getParticipantMembership(_a) {
|
|
|
54984
55015
|
|
|
54985
55016
|
function getParticipantSchedules(_a) {
|
|
54986
55017
|
var e_1, _b;
|
|
54987
|
-
var _c
|
|
55018
|
+
var _c, _d, _e;
|
|
55019
|
+
var _f = _a.participantFilters, participantFilters = _f === void 0 ? {} : _f, tournamentRecord = _a.tournamentRecord;
|
|
54988
55020
|
if (!tournamentRecord)
|
|
54989
55021
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
54990
55022
|
if (typeof participantFilters !== 'object')
|
|
54991
55023
|
return { error: INVALID_OBJECT, context: { participantFilters: participantFilters } };
|
|
54992
55024
|
var contextFilters = { eventIds: participantFilters.eventIds };
|
|
54993
|
-
var matchUps = allTournamentMatchUps({
|
|
55025
|
+
var matchUps = (_c = allTournamentMatchUps({
|
|
54994
55026
|
tournamentRecord: tournamentRecord,
|
|
54995
55027
|
contextFilters: contextFilters,
|
|
54996
|
-
}).matchUps
|
|
55028
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
54997
55029
|
var matchUpsMap = Object.assign.apply(Object, __spreadArray([{}], __read(matchUps.map(function (matchUp) {
|
|
54998
55030
|
var _a;
|
|
54999
55031
|
return (_a = {}, _a[matchUp.matchUpId] = matchUp, _a);
|
|
@@ -55002,33 +55034,31 @@ function getParticipantSchedules(_a) {
|
|
|
55002
55034
|
var schedule = _a.schedule;
|
|
55003
55035
|
return schedule && Object.keys(schedule).length;
|
|
55004
55036
|
});
|
|
55005
|
-
var sourceMatchUpIds = getMatchUpDependencies({
|
|
55037
|
+
var sourceMatchUpIds = (_d = getMatchUpDependencies({
|
|
55006
55038
|
tournamentRecord: tournamentRecord,
|
|
55007
55039
|
matchUps: matchUps,
|
|
55008
|
-
}).sourceMatchUpIds
|
|
55040
|
+
}).sourceMatchUpIds) !== null && _d !== void 0 ? _d : [];
|
|
55009
55041
|
var participantAggregator = {};
|
|
55010
55042
|
var _loop_1 = function (matchUp) {
|
|
55011
|
-
var e_2,
|
|
55043
|
+
var e_2, _g, e_3, _h;
|
|
55012
55044
|
var sides = matchUp.sides;
|
|
55013
55045
|
var relevantSourceMatchUps;
|
|
55014
|
-
var participants = (sides === null || sides === void 0 ? void 0 : sides.map(function (side) {
|
|
55046
|
+
var participants = (_e = sides === null || sides === void 0 ? void 0 : sides.map(function (side) {
|
|
55015
55047
|
var _a;
|
|
55016
55048
|
if (side.participant) {
|
|
55017
55049
|
return (_a = [side.participant]).concat.apply(_a, __spreadArray([], __read((side.participant.individualParticipants || [])), false));
|
|
55018
55050
|
}
|
|
55019
|
-
else
|
|
55020
|
-
|
|
55021
|
-
|
|
55022
|
-
|
|
55023
|
-
|
|
55024
|
-
|
|
55025
|
-
|
|
55026
|
-
|
|
55027
|
-
});
|
|
55028
|
-
}
|
|
55051
|
+
else if (sourceMatchUpIds[matchUp.matchUpId] &&
|
|
55052
|
+
!relevantSourceMatchUps) {
|
|
55053
|
+
relevantSourceMatchUps = (sourceMatchUpIds[matchUp.matchUpId] || [])
|
|
55054
|
+
.map(function (matchUpId) { return matchUpsMap[matchUpId]; })
|
|
55055
|
+
.filter(function (_a) {
|
|
55056
|
+
var winningSide = _a.winningSide, bye = _a.bye;
|
|
55057
|
+
return !winningSide && !bye;
|
|
55058
|
+
});
|
|
55029
55059
|
}
|
|
55030
55060
|
return undefined;
|
|
55031
|
-
}).filter(Boolean).flat())
|
|
55061
|
+
}).filter(Boolean).flat()) !== null && _e !== void 0 ? _e : [];
|
|
55032
55062
|
try {
|
|
55033
55063
|
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
55064
|
var participant = participants_1_1.value;
|
|
@@ -55046,7 +55076,7 @@ function getParticipantSchedules(_a) {
|
|
|
55046
55076
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
55047
55077
|
finally {
|
|
55048
55078
|
try {
|
|
55049
|
-
if (participants_1_1 && !participants_1_1.done && (
|
|
55079
|
+
if (participants_1_1 && !participants_1_1.done && (_g = participants_1.return)) _g.call(participants_1);
|
|
55050
55080
|
}
|
|
55051
55081
|
finally { if (e_2) throw e_2.error; }
|
|
55052
55082
|
}
|
|
@@ -55075,7 +55105,7 @@ function getParticipantSchedules(_a) {
|
|
|
55075
55105
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55076
55106
|
finally {
|
|
55077
55107
|
try {
|
|
55078
|
-
if (potentialParticipants_1_1 && !potentialParticipants_1_1.done && (
|
|
55108
|
+
if (potentialParticipants_1_1 && !potentialParticipants_1_1.done && (_h = potentialParticipants_1.return)) _h.call(potentialParticipants_1);
|
|
55079
55109
|
}
|
|
55080
55110
|
finally { if (e_3) throw e_3.error; }
|
|
55081
55111
|
}
|
|
@@ -55146,8 +55176,8 @@ var participantRoles = {
|
|
|
55146
55176
|
// add persons to a tournamentRecord and create participants in the process
|
|
55147
55177
|
// include ability to specify a doubles partner by personId
|
|
55148
55178
|
function addPersons(_a) {
|
|
55149
|
-
var _b;
|
|
55150
|
-
var
|
|
55179
|
+
var _b, _c;
|
|
55180
|
+
var _d = _a.participantRole, participantRole = _d === void 0 ? COMPETITOR : _d, tournamentRecord = _a.tournamentRecord, persons = _a.persons;
|
|
55151
55181
|
if (!tournamentRecord)
|
|
55152
55182
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55153
55183
|
if (!Array.isArray(persons))
|
|
@@ -55206,10 +55236,10 @@ function addPersons(_a) {
|
|
|
55206
55236
|
return result;
|
|
55207
55237
|
addedIndividualParticipantsCount = result.addedCount || 0;
|
|
55208
55238
|
var pairParticipants = [];
|
|
55209
|
-
var tournamentParticipants = ((_b = getParticipants$1({
|
|
55239
|
+
var tournamentParticipants = (_c = (_b = getParticipants$1({
|
|
55210
55240
|
participantFilters: { participantTypes: [INDIVIDUAL] },
|
|
55211
55241
|
tournamentRecord: tournamentRecord,
|
|
55212
|
-
})) === null || _b === void 0 ? void 0 : _b.participants)
|
|
55242
|
+
})) === null || _b === void 0 ? void 0 : _b.participants) !== null && _c !== void 0 ? _c : [];
|
|
55213
55243
|
if (participantRole === COMPETITOR) {
|
|
55214
55244
|
persons
|
|
55215
55245
|
.filter(function (_a) {
|
|
@@ -55291,6 +55321,7 @@ function updateTeamEventEntries(_a) {
|
|
|
55291
55321
|
|
|
55292
55322
|
function addIndividualParticipantIds(_a) {
|
|
55293
55323
|
var _b;
|
|
55324
|
+
var _c;
|
|
55294
55325
|
var individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, removeFromOtherTeams = _a.removeFromOtherTeams, tournamentRecord = _a.tournamentRecord;
|
|
55295
55326
|
var stack = 'addIndividualParticipantIds';
|
|
55296
55327
|
if (!tournamentRecord)
|
|
@@ -55300,7 +55331,7 @@ function addIndividualParticipantIds(_a) {
|
|
|
55300
55331
|
});
|
|
55301
55332
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
55302
55333
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
55303
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
55334
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
55304
55335
|
var groupingParticipant = tournamentParticipants.find(function (participant) { return participant.participantId === groupingParticipantId; });
|
|
55305
55336
|
if (!groupingParticipant)
|
|
55306
55337
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -55443,13 +55474,13 @@ function modifyIndividualParticipantIds(_a) {
|
|
|
55443
55474
|
|
|
55444
55475
|
function generateTeamsFromParticipantAttribute(_a) {
|
|
55445
55476
|
var e_1, _b;
|
|
55446
|
-
var _c, _d;
|
|
55447
|
-
var
|
|
55477
|
+
var _c, _d, _e, _f, _g, _h;
|
|
55478
|
+
var _j = _a.addParticipants, addParticipants = _j === void 0 ? true : _j, // optional boolean to disable add
|
|
55448
55479
|
participantAttribute = _a.participantAttribute, tournamentRecord = _a.tournamentRecord, personAttribute = _a.personAttribute, teamNames = _a.teamNames, accessor = _a.accessor, uuids = _a.uuids;
|
|
55449
55480
|
if (!tournamentRecord)
|
|
55450
55481
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55451
55482
|
var teams = {};
|
|
55452
|
-
var individualParticipants = (tournamentRecord.participants
|
|
55483
|
+
var individualParticipants = ((_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : []).filter(function (_a) {
|
|
55453
55484
|
var participantType = _a.participantType, participantRole = _a.participantRole;
|
|
55454
55485
|
return participantType === INDIVIDUAL && participantRole === COMPETITOR;
|
|
55455
55486
|
});
|
|
@@ -55458,25 +55489,25 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55458
55489
|
for (var individualParticipants_1 = __values(individualParticipants), individualParticipants_1_1 = individualParticipants_1.next(); !individualParticipants_1_1.done; individualParticipants_1_1 = individualParticipants_1.next()) {
|
|
55459
55490
|
var individualParticipant = individualParticipants_1_1.value;
|
|
55460
55491
|
var accessorValue = accessor &&
|
|
55461
|
-
((
|
|
55492
|
+
((_d = getAccessorValue({
|
|
55462
55493
|
element: individualParticipant,
|
|
55463
55494
|
accessor: accessor,
|
|
55464
|
-
})) === null ||
|
|
55495
|
+
})) === null || _d === void 0 ? void 0 : _d.value);
|
|
55465
55496
|
var attributeValue = accessorValue ||
|
|
55466
|
-
(personAttribute && ((
|
|
55497
|
+
(personAttribute && ((_e = individualParticipant.person) === null || _e === void 0 ? void 0 : _e[personAttribute])) ||
|
|
55467
55498
|
(participantAttribute && individualParticipant[participantAttribute]);
|
|
55468
55499
|
if (attributeValue) {
|
|
55469
55500
|
if (!Object.keys(teams).includes(attributeValue)) {
|
|
55470
55501
|
teams[attributeValue] = {
|
|
55471
|
-
participantName: (teamNames === null || teamNames === void 0 ? void 0 : teamNames[teamIndex])
|
|
55472
|
-
participantId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop())
|
|
55502
|
+
participantName: (_f = teamNames === null || teamNames === void 0 ? void 0 : teamNames[teamIndex]) !== null && _f !== void 0 ? _f : attributeValue,
|
|
55503
|
+
participantId: (_g = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _g !== void 0 ? _g : UUID(),
|
|
55473
55504
|
individualParticipantIds: [],
|
|
55474
55505
|
participantRole: COMPETITOR,
|
|
55475
55506
|
participantType: TEAM,
|
|
55476
55507
|
};
|
|
55477
55508
|
var extension = {
|
|
55509
|
+
value: personAttribute !== null && personAttribute !== void 0 ? personAttribute : participantAttribute,
|
|
55478
55510
|
name: GROUPING_ATTRIBUTE,
|
|
55479
|
-
value: personAttribute || participantAttribute,
|
|
55480
55511
|
};
|
|
55481
55512
|
addExtension$1({ element: teams[attributeValue], extension: extension });
|
|
55482
55513
|
teamIndex += 1;
|
|
@@ -55493,7 +55524,7 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55493
55524
|
finally { if (e_1) throw e_1.error; }
|
|
55494
55525
|
}
|
|
55495
55526
|
var groupingAttributes = Object.keys(teams);
|
|
55496
|
-
var overlappingTeamParticipantIds = (tournamentRecord.participants
|
|
55527
|
+
var overlappingTeamParticipantIds = ((_h = tournamentRecord.participants) !== null && _h !== void 0 ? _h : [])
|
|
55497
55528
|
.map(function (participant) {
|
|
55498
55529
|
if (participant.participantType !== TEAM)
|
|
55499
55530
|
return undefined;
|
|
@@ -55605,14 +55636,14 @@ function modifyParticipantsSignInStatus(_a) {
|
|
|
55605
55636
|
|
|
55606
55637
|
function scaledTeamAssignment(_a) {
|
|
55607
55638
|
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
|
|
55639
|
+
var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
55640
|
+
var _x = _a.clearExistingAssignments, clearExistingAssignments = _x === void 0 ? true : _x, // by default remove all existing individualParticipantIds from targeted teams
|
|
55610
55641
|
individualParticipantIds = _a.individualParticipantIds, // if scaledParticipants are provided, individualParticipants is ignored
|
|
55611
55642
|
reverseAssignmentOrder = _a.reverseAssignmentOrder, // optional - reverses team order; useful for sequential assignment of participant groupings to ensure balanced distribution
|
|
55612
|
-
|
|
55613
|
-
initialTeamIndex =
|
|
55614
|
-
|
|
55615
|
-
scaledParticipants =
|
|
55643
|
+
_y = _a.initialTeamIndex, // optional - reverses team order; useful for sequential assignment of participant groupings to ensure balanced distribution
|
|
55644
|
+
initialTeamIndex = _y === void 0 ? 0 : _y, // optional - allows assignment to begin at a specified array index; useful for sequential assignment of groups of scaledParticipants
|
|
55645
|
+
_z = _a.scaledParticipants, // optional - allows assignment to begin at a specified array index; useful for sequential assignment of groups of scaledParticipants
|
|
55646
|
+
scaledParticipants = _z === void 0 ? [] : _z, // optional - either scaledParticipants or (individualParticipantIds and scaleName) must be provided
|
|
55616
55647
|
teamParticipantIds = _a.teamParticipantIds, // optional, IF teamsCount is provided then teams will be created
|
|
55617
55648
|
tournamentRecord = _a.tournamentRecord, // supplied automatically by tournamentEngine
|
|
55618
55649
|
scaleAttributes = _a.scaleAttributes, // ignored if scaledParticipants are provided; { scaleName, scaleType, sortOrder, eventType }
|
|
@@ -55650,23 +55681,22 @@ function scaledTeamAssignment(_a) {
|
|
|
55650
55681
|
error: MISSING_VALUE,
|
|
55651
55682
|
};
|
|
55652
55683
|
}
|
|
55653
|
-
var participantIdsToAssign = individualParticipantIds
|
|
55654
|
-
|
|
55655
|
-
|
|
55656
|
-
|
|
55657
|
-
});
|
|
55684
|
+
var participantIdsToAssign = individualParticipantIds !== null && individualParticipantIds !== void 0 ? individualParticipantIds : scaledParticipants.map(function (_a) {
|
|
55685
|
+
var participantId = _a.participantId;
|
|
55686
|
+
return participantId;
|
|
55687
|
+
});
|
|
55658
55688
|
if (reverseAssignmentOrder) {
|
|
55659
55689
|
teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.reverse();
|
|
55660
55690
|
initialTeamIndex += 1; // ensures that the targeted team remains the first team to receive an assignment
|
|
55661
55691
|
}
|
|
55662
55692
|
if (initialTeamIndex > ((teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.length) || 0) - 1)
|
|
55663
55693
|
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)))
|
|
55694
|
+
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
55695
|
var relevantTeams = [];
|
|
55666
55696
|
try {
|
|
55667
55697
|
// build up an array of targeted TEAM participants
|
|
55668
|
-
for (var
|
|
55669
|
-
var participant =
|
|
55698
|
+
for (var _0 = __values((_m = tournamentRecord.participants) !== null && _m !== void 0 ? _m : []), _1 = _0.next(); !_1.done; _1 = _0.next()) {
|
|
55699
|
+
var participant = _1.value;
|
|
55670
55700
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55671
55701
|
if (!orderedTeamParticipantIds.includes(participantId))
|
|
55672
55702
|
continue;
|
|
@@ -55678,28 +55708,28 @@ function scaledTeamAssignment(_a) {
|
|
|
55678
55708
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55679
55709
|
finally {
|
|
55680
55710
|
try {
|
|
55681
|
-
if (
|
|
55711
|
+
if (_1 && !_1.done && (_c = _0.return)) _c.call(_0);
|
|
55682
55712
|
}
|
|
55683
55713
|
finally { if (e_1) throw e_1.error; }
|
|
55684
55714
|
}
|
|
55685
55715
|
if (teamsCount && relevantTeams.length < teamsCount) {
|
|
55686
55716
|
var addCount = teamsCount - ((relevantTeams === null || relevantTeams === void 0 ? void 0 : relevantTeams.length) || 0);
|
|
55687
|
-
var nameBase_1 = teamNameBase
|
|
55717
|
+
var nameBase_1 = teamNameBase !== null && teamNameBase !== void 0 ? teamNameBase : 'Team';
|
|
55688
55718
|
var teamParticipants = generateRange(0, addCount).map(function (i) { return ({
|
|
55689
55719
|
participantName: "".concat(nameBase_1, " ").concat(i + 1),
|
|
55690
55720
|
participantType: TEAM_PARTICIPANT,
|
|
55691
55721
|
participantRole: COMPETITOR,
|
|
55692
55722
|
}); });
|
|
55693
|
-
var
|
|
55723
|
+
var _2 = addParticipants({
|
|
55694
55724
|
participants: teamParticipants,
|
|
55695
55725
|
returnParticipants: true,
|
|
55696
55726
|
tournamentRecord: tournamentRecord,
|
|
55697
|
-
}).participants, participants =
|
|
55727
|
+
}).participants, participants = _2 === void 0 ? [] : _2;
|
|
55698
55728
|
var addedParticipantIds_1 = participants.map(getParticipantId);
|
|
55699
|
-
var addedParticipants = (
|
|
55729
|
+
var addedParticipants = (_p = (_o = tournamentRecord.participants) === null || _o === void 0 ? void 0 : _o.filter(function (_a) {
|
|
55700
55730
|
var participantId = _a.participantId;
|
|
55701
55731
|
return addedParticipantIds_1.includes(participantId);
|
|
55702
|
-
})) !== null &&
|
|
55732
|
+
})) !== null && _p !== void 0 ? _p : [];
|
|
55703
55733
|
relevantTeams.push.apply(relevantTeams, __spreadArray([], __read(addedParticipants), false));
|
|
55704
55734
|
}
|
|
55705
55735
|
if (!relevantTeams.length)
|
|
@@ -55739,19 +55769,19 @@ function scaledTeamAssignment(_a) {
|
|
|
55739
55769
|
}
|
|
55740
55770
|
if (!scaledParticipants.length) {
|
|
55741
55771
|
try {
|
|
55742
|
-
for (var
|
|
55743
|
-
var participant =
|
|
55772
|
+
for (var _3 = __values((_q = tournamentRecord.participants) !== null && _q !== void 0 ? _q : []), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
55773
|
+
var participant = _4.value;
|
|
55744
55774
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55745
55775
|
if (!participantIdsToAssign.includes(participantId))
|
|
55746
55776
|
continue;
|
|
55747
55777
|
if (participantType !== INDIVIDUAL)
|
|
55748
55778
|
return { error: INVALID_PARTICIPANT_TYPE, participant: participant };
|
|
55749
|
-
var scaleItem = (
|
|
55779
|
+
var scaleItem = (_r = participantScaleItem({
|
|
55750
55780
|
scaleAttributes: scaleAttributes,
|
|
55751
55781
|
participant: participant,
|
|
55752
|
-
})) === null ||
|
|
55782
|
+
})) === null || _r === void 0 ? void 0 : _r.scaleItem;
|
|
55753
55783
|
var scaleValue = (scaleAttributes === null || scaleAttributes === void 0 ? void 0 : scaleAttributes.accessor)
|
|
55754
|
-
? (
|
|
55784
|
+
? (_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
55785
|
: scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue;
|
|
55756
55786
|
var scaledParticipant = { participantId: participantId, scaleValue: scaleValue };
|
|
55757
55787
|
scaledParticipants.push(scaledParticipant);
|
|
@@ -55760,7 +55790,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55760
55790
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55761
55791
|
finally {
|
|
55762
55792
|
try {
|
|
55763
|
-
if (
|
|
55793
|
+
if (_4 && !_4.done && (_e = _3.return)) _e.call(_3);
|
|
55764
55794
|
}
|
|
55765
55795
|
finally { if (e_3) throw e_3.error; }
|
|
55766
55796
|
}
|
|
@@ -55811,11 +55841,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55811
55841
|
try {
|
|
55812
55842
|
// for all events, check if any relevant teams are present
|
|
55813
55843
|
// if a relevant team is present, remove any UNGROUPED participants that are part of that team
|
|
55814
|
-
for (var
|
|
55815
|
-
var event_1 =
|
|
55844
|
+
for (var _5 = __values((_t = tournamentRecord.events) !== null && _t !== void 0 ? _t : []), _6 = _5.next(); !_6.done; _6 = _5.next()) {
|
|
55845
|
+
var event_1 = _6.value;
|
|
55816
55846
|
if (event_1.eventType !== TEAM_EVENT)
|
|
55817
55847
|
continue;
|
|
55818
|
-
var relevantTeamEntries = (event_1.entries
|
|
55848
|
+
var relevantTeamEntries = ((_u = event_1.entries) !== null && _u !== void 0 ? _u : []).filter(function (entry) {
|
|
55819
55849
|
return relevantTeamParticipantIds.includes(entry.participantId);
|
|
55820
55850
|
});
|
|
55821
55851
|
var _loop_1 = function (relevantEntry) {
|
|
@@ -55825,10 +55855,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55825
55855
|
});
|
|
55826
55856
|
var individualParticipantIds_1 = relevantTeam === null || relevantTeam === void 0 ? void 0 : relevantTeam.individualParticipantIds;
|
|
55827
55857
|
// remove any relevant individualParticipant entries from event.entries
|
|
55828
|
-
event_1.entries = (event_1.entries
|
|
55858
|
+
event_1.entries = ((_v = event_1.entries) !== null && _v !== void 0 ? _v : []).filter(function (entry) { return !individualParticipantIds_1.includes(entry.participantId); });
|
|
55829
55859
|
// also remove any relevant individualParticipant entries from drawDefinition.entries
|
|
55830
|
-
(event_1.drawDefinitions
|
|
55831
|
-
|
|
55860
|
+
((_w = event_1.drawDefinitions) !== null && _w !== void 0 ? _w : []).forEach(function (drawDefinition) {
|
|
55861
|
+
var _a;
|
|
55862
|
+
drawDefinition.entries = ((_a = drawDefinition.entries) !== null && _a !== void 0 ? _a : []).filter(function (entry) { return !individualParticipantIds_1.includes(entry.participantId); });
|
|
55832
55863
|
});
|
|
55833
55864
|
// also remove any relevant individualParticipant any flight.drawEntries
|
|
55834
55865
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
@@ -55854,7 +55885,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55854
55885
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
55855
55886
|
finally {
|
|
55856
55887
|
try {
|
|
55857
|
-
if (
|
|
55888
|
+
if (_6 && !_6.done && (_h = _5.return)) _h.call(_5);
|
|
55858
55889
|
}
|
|
55859
55890
|
finally { if (e_6) throw e_6.error; }
|
|
55860
55891
|
}
|
|
@@ -57077,9 +57108,9 @@ function getEventData(params) {
|
|
|
57077
57108
|
|
|
57078
57109
|
function publishEvent(params) {
|
|
57079
57110
|
var _a;
|
|
57080
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
57111
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
57081
57112
|
var policyDefinitions = params.policyDefinitions, drawIds = params.drawIds, structureIds = params.structureIds, stages = params.stages;
|
|
57082
|
-
var includePositionAssignments = params.includePositionAssignments, removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord,
|
|
57113
|
+
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
57114
|
if (!tournamentRecord)
|
|
57084
57115
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57085
57116
|
if (!event)
|
|
@@ -57089,10 +57120,10 @@ function publishEvent(params) {
|
|
|
57089
57120
|
policyDefinitions = appliedPolicies;
|
|
57090
57121
|
}
|
|
57091
57122
|
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
57092
|
-
var eventDrawIds = ((_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
57123
|
+
var eventDrawIds = (_c = (_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
57093
57124
|
var drawId = _a.drawId;
|
|
57094
57125
|
return drawId;
|
|
57095
|
-
}))
|
|
57126
|
+
})) !== null && _c !== void 0 ? _c : [];
|
|
57096
57127
|
var timeItem = getEventTimeItem({
|
|
57097
57128
|
itemType: itemType,
|
|
57098
57129
|
event: event,
|
|
@@ -57102,17 +57133,17 @@ function publishEvent(params) {
|
|
|
57102
57133
|
drawIds = eventDrawIds;
|
|
57103
57134
|
}
|
|
57104
57135
|
else if (!drawIds && ((drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) || (drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.length))) {
|
|
57105
|
-
drawIds = ((
|
|
57136
|
+
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
57137
|
}
|
|
57107
|
-
drawIds = (drawIds
|
|
57138
|
+
drawIds = (drawIds !== null && drawIds !== void 0 ? drawIds : []).filter(function (drawId) { return !(drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.length) || !drawIdsToRemove.includes(drawId); });
|
|
57108
57139
|
if (drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) {
|
|
57109
57140
|
drawIds = unique(drawIds.concat.apply(drawIds, __spreadArray([], __read(drawIdsToAdd.filter(function (drawId) { return eventDrawIds.includes(drawId); })), false)));
|
|
57110
57141
|
}
|
|
57111
57142
|
if (!structureIds &&
|
|
57112
57143
|
((structureIdsToAdd === null || structureIdsToAdd === void 0 ? void 0 : structureIdsToAdd.length) || (structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length))) {
|
|
57113
|
-
structureIds = ((
|
|
57144
|
+
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
57145
|
}
|
|
57115
|
-
structureIds = (structureIds
|
|
57146
|
+
structureIds = (structureIds !== null && structureIds !== void 0 ? structureIds : []).filter(function (structureId) {
|
|
57116
57147
|
return !(structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length) ||
|
|
57117
57148
|
!structureIdsToRemove.includes(structureId);
|
|
57118
57149
|
});
|
|
@@ -57120,13 +57151,13 @@ function publishEvent(params) {
|
|
|
57120
57151
|
structureIds = unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(structureIdsToAdd), false)));
|
|
57121
57152
|
}
|
|
57122
57153
|
if (!stages && ((stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) || (stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length))) {
|
|
57123
|
-
stages = ((
|
|
57154
|
+
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
57155
|
}
|
|
57125
|
-
stages = (stages
|
|
57156
|
+
stages = (stages !== null && stages !== void 0 ? stages : []).filter(function (stage) { return !(stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length) || !stagesToRemove.includes(stage); });
|
|
57126
57157
|
if (stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) {
|
|
57127
57158
|
stages = unique(stages.concat.apply(stages, __spreadArray([], __read(stagesToAdd), false)));
|
|
57128
57159
|
}
|
|
57129
|
-
var existingStatusValue = (
|
|
57160
|
+
var existingStatusValue = (_k = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _k === void 0 ? void 0 : _k[status];
|
|
57130
57161
|
var updatedTimeItem = {
|
|
57131
57162
|
itemValue: (_a = {},
|
|
57132
57163
|
_a[status] = __assign(__assign({}, existingStatusValue), { drawIds: drawIds, structureIds: structureIds, stages: stages }),
|
|
@@ -57142,7 +57173,7 @@ function publishEvent(params) {
|
|
|
57142
57173
|
event: event,
|
|
57143
57174
|
}).eventData;
|
|
57144
57175
|
// filter out drawData for unPublished draws
|
|
57145
|
-
var publishState = (
|
|
57176
|
+
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
57177
|
eventData.drawsData = eventData.drawsData.filter(function (_a) {
|
|
57147
57178
|
var _b;
|
|
57148
57179
|
var drawId = _a.drawId;
|
|
@@ -58526,6 +58557,7 @@ function analyzeDraws(_a) {
|
|
|
58526
58557
|
var event = eventsMap[eventId];
|
|
58527
58558
|
var structures = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || [];
|
|
58528
58559
|
var structuresData = structures.map(function (structure) {
|
|
58560
|
+
var _a, _b, _c, _d;
|
|
58529
58561
|
var stage = structure.stage, stageSequence = structure.stageSequence, structureId = structure.structureId;
|
|
58530
58562
|
var orderNumber = stageOrder$1[stage];
|
|
58531
58563
|
var inContextStructureMatchUps = getStructureDrawPositionProfiles({
|
|
@@ -58555,9 +58587,9 @@ function analyzeDraws(_a) {
|
|
|
58555
58587
|
var participantId = _a.participantId;
|
|
58556
58588
|
return participantId;
|
|
58557
58589
|
});
|
|
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
|
|
58590
|
+
positionsAssignedCount += (_a = positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) !== null && _a !== void 0 ? _a : 0;
|
|
58591
|
+
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);
|
|
58592
|
+
var _e = getRoundMatchUps$1({ matchUps: inContextStructureMatchUps }), roundMatchUps = _e.roundMatchUps, roundProfile = _e.roundProfile, roundNumbers = _e.roundNumbers, maxMatchUpsCount = _e.maxMatchUpsCount;
|
|
58561
58593
|
var activeRounds = roundProfile &&
|
|
58562
58594
|
Object.keys(roundProfile)
|
|
58563
58595
|
.filter(function (roundNumber) { return !roundProfile[roundNumber].inactiveRound; })
|
|
@@ -58569,7 +58601,7 @@ function analyzeDraws(_a) {
|
|
|
58569
58601
|
var inactiveStructure = roundProfile &&
|
|
58570
58602
|
Object.values(roundProfile).every(function (profile) { return profile.inactiveRound; });
|
|
58571
58603
|
return {
|
|
58572
|
-
positionsAssignedCount: (positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length)
|
|
58604
|
+
positionsAssignedCount: (_d = positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length) !== null && _d !== void 0 ? _d : 0,
|
|
58573
58605
|
maxWinningSideFirstRoundPosition: maxWinningSideFirstRoundPosition,
|
|
58574
58606
|
unassignedPositionsCount: unassignedPositionsCount,
|
|
58575
58607
|
inactiveStructure: inactiveStructure,
|
|
@@ -58693,7 +58725,7 @@ function setTournamentCategories(_a) {
|
|
|
58693
58725
|
// bulk update when tournament dates change
|
|
58694
58726
|
function updateCourtAvailability(_a) {
|
|
58695
58727
|
var e_1, _b, e_2, _c;
|
|
58696
|
-
var _d, _e;
|
|
58728
|
+
var _d, _e, _f;
|
|
58697
58729
|
var tournamentRecord = _a.tournamentRecord;
|
|
58698
58730
|
if (!tournamentRecord)
|
|
58699
58731
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -58701,8 +58733,8 @@ function updateCourtAvailability(_a) {
|
|
|
58701
58733
|
var tournamentDates = dateRange(startDate, endDate);
|
|
58702
58734
|
var courts = [];
|
|
58703
58735
|
try {
|
|
58704
|
-
for (var
|
|
58705
|
-
var venue =
|
|
58736
|
+
for (var _g = __values(tournamentRecord.venues || []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
58737
|
+
var venue = _h.value;
|
|
58706
58738
|
if ((_d = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _d === void 0 ? void 0 : _d.length)
|
|
58707
58739
|
courts.push.apply(courts, __spreadArray([], __read(venue.courts), false));
|
|
58708
58740
|
}
|
|
@@ -58710,12 +58742,12 @@ function updateCourtAvailability(_a) {
|
|
|
58710
58742
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58711
58743
|
finally {
|
|
58712
58744
|
try {
|
|
58713
|
-
if (
|
|
58745
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
58714
58746
|
}
|
|
58715
58747
|
finally { if (e_1) throw e_1.error; }
|
|
58716
58748
|
}
|
|
58717
58749
|
var _loop_1 = function (court) {
|
|
58718
|
-
var
|
|
58750
|
+
var _j = ((_e = court.dateAvailability) !== null && _e !== void 0 ? _e : []).reduce(function (extents, availability) {
|
|
58719
58751
|
var startMinutes = timeStringMinutes(extents.startTime);
|
|
58720
58752
|
var endMinutes = timeStringMinutes(extents.endTime);
|
|
58721
58753
|
if (availability.startTime &&
|
|
@@ -58725,13 +58757,13 @@ function updateCourtAvailability(_a) {
|
|
|
58725
58757
|
timeStringMinutes(availability.endTime) > endMinutes)
|
|
58726
58758
|
extents.endTime = availability.endTime;
|
|
58727
58759
|
return extents;
|
|
58728
|
-
}, { startTime: '08:00', endTime: '18:00' }), startTime =
|
|
58760
|
+
}, { startTime: '08:00', endTime: '18:00' }), startTime = _j.startTime, endTime = _j.endTime;
|
|
58729
58761
|
var updatedDateAvailability = tournamentDates.map(function (date) {
|
|
58730
58762
|
var _a;
|
|
58731
58763
|
var existing = (_a = court.dateAvailability) === null || _a === void 0 ? void 0 : _a.find(function (availability) { return availability.date === date; });
|
|
58732
|
-
return existing
|
|
58764
|
+
return existing !== null && existing !== void 0 ? existing : { date: date, startTime: startTime, endTime: endTime };
|
|
58733
58765
|
});
|
|
58734
|
-
var defaultAvailability = (
|
|
58766
|
+
var defaultAvailability = (_f = court.dateAvailability) === null || _f === void 0 ? void 0 : _f.find(function (availability) { return !availability.date; });
|
|
58735
58767
|
if (defaultAvailability)
|
|
58736
58768
|
updatedDateAvailability.unshift(defaultAvailability);
|
|
58737
58769
|
court.dateAvailability = updatedDateAvailability;
|
|
@@ -58981,8 +59013,8 @@ function getMatchUpDailyLimitsUpdate(_a) {
|
|
|
58981
59013
|
}
|
|
58982
59014
|
|
|
58983
59015
|
function clearMatchUpSchedule(_a) {
|
|
58984
|
-
var _b, _c;
|
|
58985
|
-
var
|
|
59016
|
+
var _b, _c, _d;
|
|
59017
|
+
var _e = _a.scheduleAttributes, scheduleAttributes = _e === void 0 ? [
|
|
58986
59018
|
ALLOCATE_COURTS,
|
|
58987
59019
|
ASSIGN_COURT,
|
|
58988
59020
|
ASSIGN_VENUE,
|
|
@@ -58992,7 +59024,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
58992
59024
|
END_TIME,
|
|
58993
59025
|
RESUME_TIME,
|
|
58994
59026
|
STOP_TIME,
|
|
58995
|
-
] :
|
|
59027
|
+
] : _e, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId;
|
|
58996
59028
|
var stack = 'clearMatchUpSchedule';
|
|
58997
59029
|
var matchUp = drawDefinition
|
|
58998
59030
|
? (_b = allDrawMatchUps$1({
|
|
@@ -59007,7 +59039,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
59007
59039
|
}).matchUps) === null || _c === void 0 ? void 0 : _c[0];
|
|
59008
59040
|
if (!matchUp)
|
|
59009
59041
|
return { error: MATCHUP_NOT_FOUND };
|
|
59010
|
-
var newTimeItems = (matchUp.timeItems
|
|
59042
|
+
var newTimeItems = ((_d = matchUp.timeItems) !== null && _d !== void 0 ? _d : []).filter(function (timeItem) {
|
|
59011
59043
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) && !scheduleAttributes.includes(timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType);
|
|
59012
59044
|
});
|
|
59013
59045
|
matchUp.timeItems = newTimeItems;
|
|
@@ -60065,8 +60097,8 @@ function assignMatchUpSideParticipant(_a) {
|
|
|
60065
60097
|
};
|
|
60066
60098
|
if (matchUp) {
|
|
60067
60099
|
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; }))
|
|
60100
|
+
var _a, _b;
|
|
60101
|
+
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
60102
|
return sideNumber === currentSideNumber
|
|
60071
60103
|
? __assign(__assign({}, existingSide), { participantId: participantId }) : existingSide;
|
|
60072
60104
|
});
|
|
@@ -60509,7 +60541,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60509
60541
|
if (matchUpType === DOUBLES$1 &&
|
|
60510
60542
|
participantToRemove.participantType === INDIVIDUAL) {
|
|
60511
60543
|
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
|
|
60544
|
+
var pairParticipantId = (tieMatchUpSide !== null && tieMatchUpSide !== void 0 ? tieMatchUpSide : {}).participantId;
|
|
60513
60545
|
var pairParticipant = pairParticipantId &&
|
|
60514
60546
|
((_s = (_r = getParticipants$1({
|
|
60515
60547
|
participantFilters: { participantIds: [pairParticipantId] },
|
|
@@ -60547,26 +60579,24 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60547
60579
|
console.log('cleanup', { result: result });
|
|
60548
60580
|
}
|
|
60549
60581
|
}
|
|
60550
|
-
else {
|
|
60551
|
-
|
|
60552
|
-
|
|
60553
|
-
|
|
60582
|
+
else if (individualParticipantIds.length === 1) {
|
|
60583
|
+
var existingParticipant = getPairedParticipant({
|
|
60584
|
+
participantIds: individualParticipantIds,
|
|
60585
|
+
tournamentRecord: tournamentRecord,
|
|
60586
|
+
}).participant;
|
|
60587
|
+
if (!existingParticipant) {
|
|
60588
|
+
var newPairParticipant = {
|
|
60589
|
+
participantRole: COMPETITOR,
|
|
60590
|
+
individualParticipantIds: individualParticipantIds,
|
|
60591
|
+
participantType: PAIR,
|
|
60592
|
+
};
|
|
60593
|
+
var result = addParticipant$1({
|
|
60594
|
+
participant: newPairParticipant,
|
|
60595
|
+
pairOverride: true,
|
|
60554
60596
|
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
|
-
}
|
|
60597
|
+
});
|
|
60598
|
+
if (result.error)
|
|
60599
|
+
return decorateResult({ result: result, stack: stack });
|
|
60570
60600
|
}
|
|
60571
60601
|
}
|
|
60572
60602
|
}
|
|
@@ -60634,9 +60664,9 @@ function getPositionAssignments(_a) {
|
|
|
60634
60664
|
structure: structure,
|
|
60635
60665
|
}), error = _d.error, assignments = _d.positionAssignments;
|
|
60636
60666
|
return {
|
|
60637
|
-
|
|
60638
|
-
positionAssignments: assignments || [],
|
|
60667
|
+
positionAssignments: assignments !== null && assignments !== void 0 ? assignments : [],
|
|
60639
60668
|
structureId: structure === null || structure === void 0 ? void 0 : structure.structureId,
|
|
60669
|
+
error: error,
|
|
60640
60670
|
};
|
|
60641
60671
|
}
|
|
60642
60672
|
|
|
@@ -60960,14 +60990,15 @@ function assignDrawPosition(_a) {
|
|
|
60960
60990
|
}
|
|
60961
60991
|
|
|
60962
60992
|
function addEventEntryPairs(_a) {
|
|
60963
|
-
var
|
|
60993
|
+
var _b;
|
|
60994
|
+
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
60995
|
if (!tournamentRecord)
|
|
60965
60996
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
60966
60997
|
if (!event)
|
|
60967
60998
|
return { error: MISSING_EVENT };
|
|
60968
60999
|
if (event.eventType !== DOUBLES$1)
|
|
60969
61000
|
return { error: INVALID_EVENT_TYPE };
|
|
60970
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
61001
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
60971
61002
|
var individualParticipantIds = tournamentParticipants
|
|
60972
61003
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
60973
61004
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -60984,12 +61015,15 @@ function addEventEntryPairs(_a) {
|
|
|
60984
61015
|
.filter(function (participant) { return participant.participantType === PAIR; })
|
|
60985
61016
|
.map(function (participant) { return participant.individualParticipantIds; });
|
|
60986
61017
|
// create provisional participant objects
|
|
60987
|
-
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
60988
|
-
|
|
60989
|
-
|
|
60990
|
-
|
|
60991
|
-
|
|
60992
|
-
|
|
61018
|
+
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
61019
|
+
var _a;
|
|
61020
|
+
return ({
|
|
61021
|
+
participantId: (_a = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _a !== void 0 ? _a : UUID(),
|
|
61022
|
+
participantRole: COMPETITOR,
|
|
61023
|
+
individualParticipantIds: individualParticipantIds,
|
|
61024
|
+
participantType: PAIR,
|
|
61025
|
+
});
|
|
61026
|
+
});
|
|
60993
61027
|
// filter out existing participants unless allowDuplicateParticipantIdPairs is true
|
|
60994
61028
|
var newParticipants = allowDuplicateParticipantIdPairs
|
|
60995
61029
|
? provisionalParticipants
|
|
@@ -61134,7 +61168,7 @@ function assignSeedPositions(params) {
|
|
|
61134
61168
|
/**
|
|
61135
61169
|
* mergeObject and seedLimit ensure that new assignments do not go beyond already established number of seeds
|
|
61136
61170
|
*/
|
|
61137
|
-
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments
|
|
61171
|
+
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments !== null && seedAssignments !== void 0 ? seedAssignments : [])
|
|
61138
61172
|
.filter(function (assignment) { return assignment.seedNumber; })
|
|
61139
61173
|
.map(function (assignment) {
|
|
61140
61174
|
var _a;
|
|
@@ -61403,7 +61437,7 @@ var tieFormatDefaults = function (params) {
|
|
|
61403
61437
|
|
|
61404
61438
|
function addEvent(_a) {
|
|
61405
61439
|
var e_1, _b;
|
|
61406
|
-
var _c, _d, _e, _f;
|
|
61440
|
+
var _c, _d, _e, _f, _g;
|
|
61407
61441
|
var suppressNotifications = _a.suppressNotifications, tournamentRecord = _a.tournamentRecord, internalUse = _a.internalUse, event = _a.event;
|
|
61408
61442
|
if (!tournamentRecord)
|
|
61409
61443
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -61426,13 +61460,7 @@ function addEvent(_a) {
|
|
|
61426
61460
|
context: context,
|
|
61427
61461
|
};
|
|
61428
61462
|
}
|
|
61429
|
-
var eventRecord =
|
|
61430
|
-
drawDefinitions: [],
|
|
61431
|
-
eventType: TypeEnum.Singles,
|
|
61432
|
-
entries: [],
|
|
61433
|
-
startDate: startDate,
|
|
61434
|
-
endDate: endDate,
|
|
61435
|
-
}, event);
|
|
61463
|
+
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
61436
61464
|
if (event.eventType === TypeEnum.Team) {
|
|
61437
61465
|
if (event.tieFormat) {
|
|
61438
61466
|
var result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
@@ -61463,7 +61491,7 @@ function addEvent(_a) {
|
|
|
61463
61491
|
if (!suppressNotifications) {
|
|
61464
61492
|
var topics = getTopics().topics;
|
|
61465
61493
|
if (topics.includes(ADD_MATCHUPS)) {
|
|
61466
|
-
var matchUps = allEventMatchUps({ event: event }).matchUps
|
|
61494
|
+
var matchUps = (_g = allEventMatchUps({ event: event }).matchUps) !== null && _g !== void 0 ? _g : [];
|
|
61467
61495
|
addMatchUpsNotice({
|
|
61468
61496
|
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
61469
61497
|
eventId: event.eventId,
|
|
@@ -61471,15 +61499,15 @@ function addEvent(_a) {
|
|
|
61471
61499
|
});
|
|
61472
61500
|
}
|
|
61473
61501
|
try {
|
|
61474
|
-
for (var
|
|
61475
|
-
var drawDefinition =
|
|
61502
|
+
for (var _h = __values(event.drawDefinitions || []), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
61503
|
+
var drawDefinition = _j.value;
|
|
61476
61504
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
61477
61505
|
}
|
|
61478
61506
|
}
|
|
61479
61507
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61480
61508
|
finally {
|
|
61481
61509
|
try {
|
|
61482
|
-
if (
|
|
61510
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
61483
61511
|
}
|
|
61484
61512
|
finally { if (e_1) throw e_1.error; }
|
|
61485
61513
|
}
|
|
@@ -62170,11 +62198,9 @@ function setMatchUpFormat(_a) {
|
|
|
62170
62198
|
finally { if (e_2) throw e_2.error; }
|
|
62171
62199
|
}
|
|
62172
62200
|
}
|
|
62173
|
-
else {
|
|
62174
|
-
|
|
62175
|
-
|
|
62176
|
-
modificationsCount += 1;
|
|
62177
|
-
}
|
|
62201
|
+
else if (event_1.matchUpFormat !== matchUpFormat) {
|
|
62202
|
+
event_1.matchUpFormat = matchUpFormat;
|
|
62203
|
+
modificationsCount += 1;
|
|
62178
62204
|
}
|
|
62179
62205
|
}
|
|
62180
62206
|
}
|
|
@@ -62399,10 +62425,11 @@ function getParticipantScaleItem(_a) {
|
|
|
62399
62425
|
}
|
|
62400
62426
|
|
|
62401
62427
|
function getScaledEntries(_a) {
|
|
62402
|
-
var _b
|
|
62428
|
+
var _b;
|
|
62429
|
+
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
62430
|
if (!tournamentRecord)
|
|
62404
62431
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
62405
|
-
entries = entries
|
|
62432
|
+
entries = (_b = entries !== null && entries !== void 0 ? entries : event === null || event === void 0 ? void 0 : event.entries) !== null && _b !== void 0 ? _b : [];
|
|
62406
62433
|
var stageEntries = entries.filter(function (entry) {
|
|
62407
62434
|
return (!stage || !entry.entryStage || entry.entryStage === stage) &&
|
|
62408
62435
|
(!stageSequence ||
|
|
@@ -62440,15 +62467,6 @@ function getScaledEntries(_a) {
|
|
|
62440
62467
|
}
|
|
62441
62468
|
}
|
|
62442
62469
|
|
|
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
62470
|
function removeSeeding(_a) {
|
|
62453
62471
|
var _b, _c;
|
|
62454
62472
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, entryStatuses = _a.entryStatuses, scaleName = _a.scaleName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
@@ -62740,16 +62758,16 @@ var flightConstants = {
|
|
|
62740
62758
|
};
|
|
62741
62759
|
|
|
62742
62760
|
function generateFlightProfile(params) {
|
|
62743
|
-
var _a;
|
|
62744
|
-
var
|
|
62761
|
+
var _a, _b;
|
|
62762
|
+
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
62763
|
if (!event)
|
|
62746
62764
|
return { error: MISSING_EVENT };
|
|
62747
|
-
var eventEntries = event.entries
|
|
62765
|
+
var eventEntries = (_a = event.entries) !== null && _a !== void 0 ? _a : [];
|
|
62748
62766
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
62749
62767
|
if (flightProfile && attachFlightProfile$1 && !deleteExisting) {
|
|
62750
62768
|
return { error: EXISTING_PROFILE };
|
|
62751
62769
|
}
|
|
62752
|
-
var scaledEntries = (
|
|
62770
|
+
var scaledEntries = (_b = params.scaledEntries) !== null && _b !== void 0 ? _b : getScaledEntries({
|
|
62753
62771
|
tournamentRecord: tournamentRecord,
|
|
62754
62772
|
scaleAttributes: scaleAttributes,
|
|
62755
62773
|
scaleSortMethod: scaleSortMethod,
|
|
@@ -62798,10 +62816,11 @@ function generateFlightProfile(params) {
|
|
|
62798
62816
|
});
|
|
62799
62817
|
}
|
|
62800
62818
|
var flights = generateRange(0, flightsCount).map(function (index) {
|
|
62819
|
+
var _a;
|
|
62801
62820
|
var flightNumber = index + 1;
|
|
62802
62821
|
return {
|
|
62803
62822
|
flightNumber: flightNumber,
|
|
62804
|
-
drawId: (uuids === null || uuids === void 0 ? void 0 : uuids.pop())
|
|
62823
|
+
drawId: (_a = uuids === null || uuids === void 0 ? void 0 : uuids.pop()) !== null && _a !== void 0 ? _a : UUID(),
|
|
62805
62824
|
drawEntries: getDrawEntries(splitEntries[index]),
|
|
62806
62825
|
drawName: ((drawNames === null || drawNames === void 0 ? void 0 : drawNames.length) && drawNames[index]) ||
|
|
62807
62826
|
"".concat(drawNameRoot, " ").concat(flightNumber),
|
|
@@ -63087,8 +63106,8 @@ function resetDrawDefinition(_a) {
|
|
|
63087
63106
|
}
|
|
63088
63107
|
|
|
63089
63108
|
function pruneDrawDefinition(_a) {
|
|
63090
|
-
var _b;
|
|
63091
|
-
var
|
|
63109
|
+
var _b, _c;
|
|
63110
|
+
var _d = _a.matchPlayDrawPositions, matchPlayDrawPositions = _d === void 0 ? true : _d, // when simply extracting matchUps for aggregation, drawPositions are unnecessary
|
|
63092
63111
|
tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, drawId = _a.drawId;
|
|
63093
63112
|
if (!tournamentRecord)
|
|
63094
63113
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -63099,16 +63118,16 @@ function pruneDrawDefinition(_a) {
|
|
|
63099
63118
|
if (drawsAnalysis.canBePruned.includes(drawId)) {
|
|
63100
63119
|
var isMatchPlay = drawsAnalysis.matchPlay.includes(drawId);
|
|
63101
63120
|
var drawAnalysis = drawsAnalysis.drawAnalysis[drawId];
|
|
63102
|
-
var
|
|
63121
|
+
var _e = __read(getDrawStructures({
|
|
63103
63122
|
stageSequence: 1,
|
|
63104
63123
|
drawDefinition: drawDefinition,
|
|
63105
63124
|
stage: MAIN,
|
|
63106
|
-
}).structures, 1), mainStructure_1 =
|
|
63125
|
+
}).structures, 1), mainStructure_1 = _e[0];
|
|
63107
63126
|
var structureData_1 = drawAnalysis.structuresData.find(function (_a) {
|
|
63108
63127
|
var structureId = _a.structureId;
|
|
63109
63128
|
return mainStructure_1.structureId === structureId;
|
|
63110
63129
|
});
|
|
63111
|
-
var matchUps = mainStructure_1.matchUps
|
|
63130
|
+
var matchUps = (_b = mainStructure_1.matchUps) !== null && _b !== void 0 ? _b : [];
|
|
63112
63131
|
relevantMatchUps = matchUps
|
|
63113
63132
|
.sort(function (a, b) { return a.roundPosition - b.roundPosition; })
|
|
63114
63133
|
.filter(function (_a) {
|
|
@@ -63135,7 +63154,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63135
63154
|
var matchUpIdsToDelete = relevantMatchUpIds_1.filter(function (matchUpId) { return !matchPlayMatchUpIds_1.includes(matchUpId); });
|
|
63136
63155
|
deletedMatchUpIds.push.apply(deletedMatchUpIds, __spreadArray([], __read(matchUpIdsToDelete), false));
|
|
63137
63156
|
var existingDrawPositionPairings = matchPlayMatchUps
|
|
63138
|
-
.flatMap(function (matchUp) { return matchUp.drawPositions
|
|
63157
|
+
.flatMap(function (matchUp) { var _a; return (_a = matchUp.drawPositions) !== null && _a !== void 0 ? _a : []; })
|
|
63139
63158
|
.filter(Boolean);
|
|
63140
63159
|
var existingDrawPositions_1 = existingDrawPositionPairings.flat();
|
|
63141
63160
|
var drawPositionsMap_1 = Object.assign.apply(Object, __spreadArray([{}], __read(existingDrawPositions_1.map(function (drawPosition, i) {
|
|
@@ -63153,7 +63172,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63153
63172
|
}
|
|
63154
63173
|
});
|
|
63155
63174
|
if (matchPlayDrawPositions) {
|
|
63156
|
-
var updatedPositionAssignments = (
|
|
63175
|
+
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
63176
|
return existingDrawPositions_1.includes(assignment.drawPosition);
|
|
63158
63177
|
}).map(function (assignment) {
|
|
63159
63178
|
assignment.drawPosition = drawPositionsMap_1[assignment.drawPosition];
|
|
@@ -63183,12 +63202,13 @@ function setOrderOfFinish(params) {
|
|
|
63183
63202
|
|
|
63184
63203
|
function modifyEventEntries(_a) {
|
|
63185
63204
|
var _b;
|
|
63186
|
-
var _c
|
|
63205
|
+
var _c, _d;
|
|
63206
|
+
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
63207
|
if (!tournamentRecord)
|
|
63188
63208
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63189
63209
|
if (!event)
|
|
63190
63210
|
return { error: MISSING_EVENT };
|
|
63191
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
63211
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
63192
63212
|
var individualParticipantIds = tournamentParticipants
|
|
63193
63213
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
63194
63214
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -63243,7 +63263,7 @@ function modifyEventEntries(_a) {
|
|
|
63243
63263
|
entryStage: entryStage,
|
|
63244
63264
|
}); });
|
|
63245
63265
|
// remove all entries matching the stage which has been modified
|
|
63246
|
-
event.entries = (event.entries
|
|
63266
|
+
event.entries = ((_d = event.entries) !== null && _d !== void 0 ? _d : []).filter(function (entry) { return entry.entryStage === entryStage; });
|
|
63247
63267
|
event.entries = (_b = event.entries).concat.apply(_b, __spreadArray(__spreadArray([], __read(pairParticipantEntries), false), __read(unpairedParticipantEntries), false));
|
|
63248
63268
|
return __assign({}, SUCCESS);
|
|
63249
63269
|
}
|
|
@@ -63256,8 +63276,8 @@ function drawMatic(params) {
|
|
|
63256
63276
|
}
|
|
63257
63277
|
|
|
63258
63278
|
function addFlight(_a) {
|
|
63259
|
-
var _b, _c, _d;
|
|
63260
|
-
var qualifyingPositions = _a.qualifyingPositions,
|
|
63279
|
+
var _b, _c, _d, _e;
|
|
63280
|
+
var qualifyingPositions = _a.qualifyingPositions, _f = _a.drawEntries, drawEntries = _f === void 0 ? [] : _f, // [{ entryPosition, entryStatus, participantId }]
|
|
63261
63281
|
drawName = _a.drawName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
63262
63282
|
var stack = 'addFlight';
|
|
63263
63283
|
if (!event)
|
|
@@ -63266,18 +63286,18 @@ function addFlight(_a) {
|
|
|
63266
63286
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
63267
63287
|
if (drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.length) {
|
|
63268
63288
|
// check that all drawEntries are in event.entries
|
|
63269
|
-
var enteredParticipantIds = (event.entries
|
|
63289
|
+
var enteredParticipantIds = ((_b = event.entries) !== null && _b !== void 0 ? _b : []).map(extractAttributes('participantId'));
|
|
63270
63290
|
var flightParticipantIds = drawEntries.map(extractAttributes('participantId'));
|
|
63271
63291
|
if (intersection(flightParticipantIds, enteredParticipantIds).length !==
|
|
63272
63292
|
flightParticipantIds.length) {
|
|
63273
63293
|
return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
|
|
63274
63294
|
}
|
|
63275
63295
|
}
|
|
63276
|
-
var flightProfile = (
|
|
63277
|
-
var flightNumbers = ((
|
|
63296
|
+
var flightProfile = (_c = getFlightProfile({ event: event })) === null || _c === void 0 ? void 0 : _c.flightProfile;
|
|
63297
|
+
var flightNumbers = ((_e = (_d = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
|
|
63278
63298
|
var flightNumber = _a.flightNumber;
|
|
63279
63299
|
return !isNaN(flightNumber) && ensureInt(flightNumber);
|
|
63280
|
-
})) === null ||
|
|
63300
|
+
})) === null || _e === void 0 ? void 0 : _e.filter(Boolean)) || [];
|
|
63281
63301
|
var flightNumber = Math.max.apply(Math, __spreadArray([0], __read(flightNumbers), false)) + 1;
|
|
63282
63302
|
var flightDrawId = drawId || UUID();
|
|
63283
63303
|
var flight = {
|
|
@@ -64898,7 +64918,7 @@ function getMaxEntryPosition(params) {
|
|
|
64898
64918
|
}
|
|
64899
64919
|
|
|
64900
64920
|
function getPredictiveAccuracy(params) {
|
|
64901
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
64921
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
64902
64922
|
var matchUps = params.matchUps;
|
|
64903
64923
|
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
64924
|
if (!tournamentRecord && !matchUps)
|
|
@@ -64914,14 +64934,14 @@ function getPredictiveAccuracy(params) {
|
|
|
64914
64934
|
? Math.abs(scaleProfile.range[0] - scaleProfile.range[1])
|
|
64915
64935
|
: 0;
|
|
64916
64936
|
var zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
|
|
64917
|
-
? (zonePct
|
|
64918
|
-
: params.zoneMargin
|
|
64937
|
+
? (zonePct !== null && zonePct !== void 0 ? zonePct : 0 / 100) * ratingsRangeDifference
|
|
64938
|
+
: (_d = params.zoneMargin) !== null && _d !== void 0 ? _d : ratingsRangeDifference;
|
|
64919
64939
|
var contextProfile = { withScaleValues: true, withCompetitiveness: true };
|
|
64920
64940
|
var contextFilters = {
|
|
64921
64941
|
matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
|
|
64922
64942
|
};
|
|
64923
64943
|
var participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
64924
|
-
if ((
|
|
64944
|
+
if ((_e = matchUps === null || matchUps === void 0 ? void 0 : matchUps[0]) === null || _e === void 0 ? void 0 : _e.hasContext) {
|
|
64925
64945
|
if (drawId) {
|
|
64926
64946
|
matchUps = matchUps.filter(function (matchUp) { return matchUp.drawId === drawId; });
|
|
64927
64947
|
}
|
|
@@ -64934,27 +64954,27 @@ function getPredictiveAccuracy(params) {
|
|
|
64934
64954
|
(drawId && !drawDefinition && []) ||
|
|
64935
64955
|
(!drawId && eventId && !event && []) ||
|
|
64936
64956
|
(drawId &&
|
|
64937
|
-
((
|
|
64957
|
+
((_f = allDrawMatchUps$1({
|
|
64938
64958
|
inContext: true,
|
|
64939
64959
|
drawDefinition: drawDefinition,
|
|
64940
64960
|
contextFilters: contextFilters,
|
|
64941
64961
|
contextProfile: contextProfile,
|
|
64942
64962
|
participants: participants,
|
|
64943
|
-
})) === null ||
|
|
64963
|
+
})) === null || _f === void 0 ? void 0 : _f.matchUps)) ||
|
|
64944
64964
|
(!drawId &&
|
|
64945
64965
|
eventId &&
|
|
64946
|
-
((
|
|
64966
|
+
((_g = allEventMatchUps({
|
|
64947
64967
|
inContext: true,
|
|
64948
64968
|
contextFilters: contextFilters,
|
|
64949
64969
|
contextProfile: contextProfile,
|
|
64950
64970
|
participants: participants,
|
|
64951
64971
|
event: event,
|
|
64952
|
-
})) === null ||
|
|
64953
|
-
((
|
|
64972
|
+
})) === null || _g === void 0 ? void 0 : _g.matchUps)) ||
|
|
64973
|
+
((_h = allTournamentMatchUps({
|
|
64954
64974
|
tournamentRecord: tournamentRecord,
|
|
64955
64975
|
contextFilters: contextFilters,
|
|
64956
64976
|
contextProfile: contextProfile,
|
|
64957
|
-
})) === null ||
|
|
64977
|
+
})) === null || _h === void 0 ? void 0 : _h.matchUps) ||
|
|
64958
64978
|
[];
|
|
64959
64979
|
}
|
|
64960
64980
|
if (matchUpType) {
|
|
@@ -64962,7 +64982,7 @@ function getPredictiveAccuracy(params) {
|
|
|
64962
64982
|
}
|
|
64963
64983
|
var relevantMatchUps = matchUps.filter(function (_a) {
|
|
64964
64984
|
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
|
|
64985
|
+
return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus !== null && matchUpStatus !== void 0 ? matchUpStatus : '') &&
|
|
64966
64986
|
scoreHasValue({ score: score }) &&
|
|
64967
64987
|
(sides === null || sides === void 0 ? void 0 : sides.length) === 2 &&
|
|
64968
64988
|
winningSide;
|
|
@@ -66521,7 +66541,7 @@ function getAwardPoints(_a) {
|
|
|
66521
66541
|
|
|
66522
66542
|
function getTournamentPoints(_a) {
|
|
66523
66543
|
var e_1, _b;
|
|
66524
|
-
var _c;
|
|
66544
|
+
var _c, _d;
|
|
66525
66545
|
var participantFilters = _a.participantFilters, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, saveRankings = _a.saveRankings, level = _a.level;
|
|
66526
66546
|
if (!tournamentRecord)
|
|
66527
66547
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -66529,25 +66549,24 @@ function getTournamentPoints(_a) {
|
|
|
66529
66549
|
policyTypes: [POLICY_TYPE_RANKING_POINTS],
|
|
66530
66550
|
tournamentRecord: tournamentRecord,
|
|
66531
66551
|
}).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]);
|
|
66552
|
+
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
66553
|
if (!pointsPolicy)
|
|
66535
66554
|
return { error: MISSING_POLICY_DEFINITION };
|
|
66536
66555
|
var awardProfiles = pointsPolicy.awardProfiles;
|
|
66537
66556
|
var requireWinFirstRound = pointsPolicy.requireWinFirstRound;
|
|
66538
66557
|
var requireWinForPoints = pointsPolicy.requireWinForPoints;
|
|
66539
|
-
var
|
|
66558
|
+
var _e = getParticipants$1({
|
|
66540
66559
|
withRankingProfile: true,
|
|
66541
66560
|
participantFilters: participantFilters,
|
|
66542
66561
|
tournamentRecord: tournamentRecord,
|
|
66543
|
-
}), participants =
|
|
66562
|
+
}), participants = _e.participants, derivedEventInfo = _e.derivedEventInfo, derivedDrawInfo = _e.derivedDrawInfo, mappedMatchUps = _e.mappedMatchUps;
|
|
66544
66563
|
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
66564
|
// keep track of points earned per person / per team
|
|
66546
66565
|
var personPoints = {};
|
|
66547
66566
|
var teamPoints = {};
|
|
66548
66567
|
var pairPoints = {};
|
|
66549
66568
|
var _loop_1 = function (participant) {
|
|
66550
|
-
var e_2,
|
|
66569
|
+
var e_2, _h, e_3, _j;
|
|
66551
66570
|
var participantType = participant.participantType, participantId = participant.participantId, person = participant.person, draws = participant.draws;
|
|
66552
66571
|
try {
|
|
66553
66572
|
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 +66575,7 @@ function getTournamentPoints(_a) {
|
|
|
66556
66575
|
var eventInfo = derivedEventInfo[eventId];
|
|
66557
66576
|
var drawInfo = derivedDrawInfo[drawId];
|
|
66558
66577
|
var drawType = drawInfo === null || drawInfo === void 0 ? void 0 : drawInfo.drawType;
|
|
66559
|
-
var
|
|
66578
|
+
var _k = eventInfo || {}, category = _k.category, eventType = _k.eventType;
|
|
66560
66579
|
var startDate = draw.startDate || eventInfo.startDate || tournamentRecord.startDate;
|
|
66561
66580
|
var endDate = draw.endDate || eventInfo.endDate || tournamentRecord.endDate;
|
|
66562
66581
|
// don't process INDIVIDUAL and PAIR participants in TEAM events
|
|
@@ -66567,13 +66586,12 @@ function getTournamentPoints(_a) {
|
|
|
66567
66586
|
var points = void 0;
|
|
66568
66587
|
if (awardProfiles) {
|
|
66569
66588
|
var requireWin = requireWinForPoints;
|
|
66570
|
-
// const positionAwards = []; // potential use for combining ppw w/ fpp
|
|
66571
66589
|
var totalWinsCount = 0;
|
|
66572
66590
|
var positionPoints = 0;
|
|
66573
66591
|
var perWinPoints = 0;
|
|
66574
66592
|
var rangeAccessor = void 0;
|
|
66575
66593
|
var _loop_2 = function (participation) {
|
|
66576
|
-
var
|
|
66594
|
+
var _l, _m, e_4, _o, e_5, _p;
|
|
66577
66595
|
var finishingPositionRange = participation.finishingPositionRange, participationOrder = participation.participationOrder, participantWon = participation.participantWon, flightNumber = participation.flightNumber, rankingStage = participation.rankingStage, winCount = participation.winCount;
|
|
66578
66596
|
totalWinsCount += winCount || 0;
|
|
66579
66597
|
var drawSize = drawInfo === null || drawInfo === void 0 ? void 0 : drawInfo.drawSize;
|
|
@@ -66602,27 +66620,25 @@ function getTournamentPoints(_a) {
|
|
|
66602
66620
|
requireWin = awardProfile.requireWinForPoints;
|
|
66603
66621
|
if (awardProfile.requireWinFirstRound !== undefined)
|
|
66604
66622
|
requireWinFirstRound = awardProfile.requireWinFirstRound;
|
|
66605
|
-
var
|
|
66623
|
+
var _q = awardProfile.finishingPositionPoints, finishingPositionPoints = _q === void 0 ? {} : _q, finishingPositionRanges = awardProfile.finishingPositionRanges, finishingRound = awardProfile.finishingRound, pointsPerWin = awardProfile.pointsPerWin, flights = awardProfile.flights;
|
|
66606
66624
|
var ppwProfile = Array.isArray(awardProfile.perWinPoints)
|
|
66607
|
-
? (
|
|
66625
|
+
? (_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
66626
|
: awardProfile.perWinPoints;
|
|
66609
66627
|
var participationOrders = finishingPositionPoints.participationOrders;
|
|
66610
66628
|
var awardPoints = 0;
|
|
66611
66629
|
var winRequired = void 0;
|
|
66612
|
-
// const noPositionAwards = !positionAwards.length;
|
|
66613
66630
|
var isValidOrder = !participationOrders ||
|
|
66614
66631
|
participationOrders.includes(participationOrder);
|
|
66615
66632
|
if (isValidOrder && finishingPositionRanges && accessor) {
|
|
66616
66633
|
var valueObj = finishingPositionRanges[accessor];
|
|
66617
66634
|
if (valueObj) {
|
|
66618
|
-
|
|
66619
|
-
(_k = getAwardPoints({
|
|
66635
|
+
(_l = getAwardPoints({
|
|
66620
66636
|
flightNumber: flightNumber,
|
|
66621
66637
|
valueObj: valueObj,
|
|
66622
66638
|
drawSize: drawSize,
|
|
66623
66639
|
flights: flights,
|
|
66624
66640
|
level: level,
|
|
66625
|
-
}), awardPoints =
|
|
66641
|
+
}), awardPoints = _l.awardPoints, winRequired = _l.requireWin);
|
|
66626
66642
|
}
|
|
66627
66643
|
}
|
|
66628
66644
|
if (!awardPoints &&
|
|
@@ -66631,15 +66647,14 @@ function getTournamentPoints(_a) {
|
|
|
66631
66647
|
accessor) {
|
|
66632
66648
|
var valueObj = finishingRound[accessor];
|
|
66633
66649
|
if (valueObj) {
|
|
66634
|
-
|
|
66635
|
-
(_l = getAwardPoints({
|
|
66650
|
+
(_m = getAwardPoints({
|
|
66636
66651
|
participantWon: participantWon,
|
|
66637
66652
|
flightNumber: flightNumber,
|
|
66638
66653
|
valueObj: valueObj,
|
|
66639
66654
|
drawSize: drawSize,
|
|
66640
66655
|
flights: flights,
|
|
66641
66656
|
level: level,
|
|
66642
|
-
}), awardPoints =
|
|
66657
|
+
}), awardPoints = _m.awardPoints, winRequired = _m.requireWin);
|
|
66643
66658
|
}
|
|
66644
66659
|
}
|
|
66645
66660
|
if (firstRound && requireWinFirstRound !== undefined) {
|
|
@@ -66681,8 +66696,8 @@ function getTournamentPoints(_a) {
|
|
|
66681
66696
|
continue;
|
|
66682
66697
|
}
|
|
66683
66698
|
try {
|
|
66684
|
-
for (var
|
|
66685
|
-
var tieMatchUp =
|
|
66699
|
+
for (var _r = (e_5 = void 0, __values(matchUp.tieMatchUps)), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
66700
|
+
var tieMatchUp = _s.value;
|
|
66686
66701
|
// ingore matchUps with no winningSide
|
|
66687
66702
|
if (!tieMatchUp.winningSide)
|
|
66688
66703
|
continue;
|
|
@@ -66691,7 +66706,7 @@ function getTournamentPoints(_a) {
|
|
|
66691
66706
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
66692
66707
|
finally {
|
|
66693
66708
|
try {
|
|
66694
|
-
if (
|
|
66709
|
+
if (_s && !_s.done && (_p = _r.return)) _p.call(_r);
|
|
66695
66710
|
}
|
|
66696
66711
|
finally { if (e_5) throw e_5.error; }
|
|
66697
66712
|
}
|
|
@@ -66700,7 +66715,7 @@ function getTournamentPoints(_a) {
|
|
|
66700
66715
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
66701
66716
|
finally {
|
|
66702
66717
|
try {
|
|
66703
|
-
if (teamStructureMatchUps_1_1 && !teamStructureMatchUps_1_1.done && (
|
|
66718
|
+
if (teamStructureMatchUps_1_1 && !teamStructureMatchUps_1_1.done && (_o = teamStructureMatchUps_1.return)) _o.call(teamStructureMatchUps_1);
|
|
66704
66719
|
}
|
|
66705
66720
|
finally { if (e_4) throw e_4.error; }
|
|
66706
66721
|
}
|
|
@@ -66715,7 +66730,7 @@ function getTournamentPoints(_a) {
|
|
|
66715
66730
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
66716
66731
|
finally {
|
|
66717
66732
|
try {
|
|
66718
|
-
if (structureParticipation_1_1 && !structureParticipation_1_1.done && (
|
|
66733
|
+
if (structureParticipation_1_1 && !structureParticipation_1_1.done && (_j = structureParticipation_1.return)) _j.call(structureParticipation_1);
|
|
66719
66734
|
}
|
|
66720
66735
|
finally { if (e_3) throw e_3.error; }
|
|
66721
66736
|
}
|
|
@@ -66752,21 +66767,21 @@ function getTournamentPoints(_a) {
|
|
|
66752
66767
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
66753
66768
|
finally {
|
|
66754
66769
|
try {
|
|
66755
|
-
if (draws_1_1 && !draws_1_1.done && (
|
|
66770
|
+
if (draws_1_1 && !draws_1_1.done && (_h = draws_1.return)) _h.call(draws_1);
|
|
66756
66771
|
}
|
|
66757
66772
|
finally { if (e_2) throw e_2.error; }
|
|
66758
66773
|
}
|
|
66759
66774
|
};
|
|
66760
66775
|
try {
|
|
66761
|
-
for (var
|
|
66762
|
-
var participant =
|
|
66776
|
+
for (var _f = __values(participantsWithOutcomes !== null && participantsWithOutcomes !== void 0 ? participantsWithOutcomes : []), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
66777
|
+
var participant = _g.value;
|
|
66763
66778
|
_loop_1(participant);
|
|
66764
66779
|
}
|
|
66765
66780
|
}
|
|
66766
66781
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
66767
66782
|
finally {
|
|
66768
66783
|
try {
|
|
66769
|
-
if (
|
|
66784
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
66770
66785
|
}
|
|
66771
66786
|
finally { if (e_1) throw e_1.error; }
|
|
66772
66787
|
}
|
|
@@ -66899,8 +66914,8 @@ var aggregateSets = function (sets) {
|
|
|
66899
66914
|
|
|
66900
66915
|
function generateDynamicRatings(_a) {
|
|
66901
66916
|
var e_1, _b;
|
|
66902
|
-
var _c, _d;
|
|
66903
|
-
var
|
|
66917
|
+
var _c, _d, _e;
|
|
66918
|
+
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
66919
|
if (!tournamentRecord)
|
|
66905
66920
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
66906
66921
|
if (!Array.isArray(matchUpIds))
|
|
@@ -66912,13 +66927,14 @@ function generateDynamicRatings(_a) {
|
|
|
66912
66927
|
var ratingParameter = ratingsParameters[ratingType];
|
|
66913
66928
|
var accessor = ratingParameter.accessor;
|
|
66914
66929
|
var modifiedScaleValues = {};
|
|
66915
|
-
var matchUps = allTournamentMatchUps({
|
|
66930
|
+
var matchUps = (_c = allTournamentMatchUps({
|
|
66916
66931
|
matchUpFilters: { matchUpIds: matchUpIds, matchUpStatuses: completedMatchUpStatuses },
|
|
66917
66932
|
tournamentRecord: tournamentRecord,
|
|
66918
66933
|
inContext: true,
|
|
66919
|
-
}).matchUps
|
|
66934
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
66935
|
+
matchUps.sort(matchUpSort);
|
|
66920
66936
|
var _loop_1 = function (matchUp) {
|
|
66921
|
-
var e_2,
|
|
66937
|
+
var e_2, _h, e_3, _j, _k, _l;
|
|
66922
66938
|
var endDate = matchUp.endDate, matchUpFormat = matchUp.matchUpFormat, score = matchUp.score, sides = matchUp.sides, winningSide = matchUp.winningSide;
|
|
66923
66939
|
var matchUpType = matchUp.matchUpType;
|
|
66924
66940
|
var scaleAttributes = {
|
|
@@ -66932,13 +66948,14 @@ function generateDynamicRatings(_a) {
|
|
|
66932
66948
|
eventType: matchUpType,
|
|
66933
66949
|
scaleType: RATING$2,
|
|
66934
66950
|
};
|
|
66935
|
-
var sideParticipantIds = Object.assign.apply(Object, __spreadArray([{}], __read((sides
|
|
66951
|
+
var sideParticipantIds = Object.assign.apply(Object, __spreadArray([{}], __read((sides !== null && sides !== void 0 ? sides : []).map(function (side) {
|
|
66936
66952
|
var _a;
|
|
66953
|
+
var _b;
|
|
66937
66954
|
var sideNumber = side.sideNumber, participant = side.participant;
|
|
66938
66955
|
return (sideNumber && (_a = {},
|
|
66939
66956
|
_a[sideNumber] = __spreadArray([
|
|
66940
66957
|
participant === null || participant === void 0 ? void 0 : participant.participantId
|
|
66941
|
-
], __read(((participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds)
|
|
66958
|
+
], __read(((_b = participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) !== null && _b !== void 0 ? _b : [])), false).filter(Boolean)
|
|
66942
66959
|
.flat(),
|
|
66943
66960
|
_a));
|
|
66944
66961
|
})), false));
|
|
@@ -66984,14 +67001,14 @@ function generateDynamicRatings(_a) {
|
|
|
66984
67001
|
try {
|
|
66985
67002
|
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
67003
|
var winnerParticipantId = winningSideParticipantIds_1_1.value;
|
|
66987
|
-
var winnerScaleValue = (
|
|
67004
|
+
var winnerScaleValue = (_d = scaleItemMap[winnerParticipantId]) === null || _d === void 0 ? void 0 : _d.scaleValue;
|
|
66988
67005
|
var winnerRating = typeof winnerScaleValue === 'object'
|
|
66989
67006
|
? winnerScaleValue[accessor]
|
|
66990
67007
|
: winnerScaleValue;
|
|
66991
67008
|
try {
|
|
66992
67009
|
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
67010
|
var loserParticipantId = losingSideParticipantIds_1_1.value;
|
|
66994
|
-
var loserScaleValue = (
|
|
67011
|
+
var loserScaleValue = (_e = scaleItemMap[loserParticipantId]) === null || _e === void 0 ? void 0 : _e.scaleValue;
|
|
66995
67012
|
var loserRating = typeof loserScaleValue === 'object'
|
|
66996
67013
|
? loserScaleValue[accessor]
|
|
66997
67014
|
: loserScaleValue;
|
|
@@ -66999,18 +67016,18 @@ function generateDynamicRatings(_a) {
|
|
|
66999
67016
|
var loserCountables = winningSide
|
|
67000
67017
|
? countables[3 - winningSide]
|
|
67001
67018
|
: [0, 0];
|
|
67002
|
-
var
|
|
67019
|
+
var _m = calculateNewRatings({
|
|
67003
67020
|
winnerCountables: winnerCountables,
|
|
67004
67021
|
loserCountables: loserCountables,
|
|
67005
67022
|
maxCountables: maxCountables,
|
|
67006
67023
|
winnerRating: winnerRating,
|
|
67007
67024
|
loserRating: loserRating,
|
|
67008
67025
|
ratingType: ratingType,
|
|
67009
|
-
}), newWinnerRating =
|
|
67026
|
+
}), newWinnerRating = _m.newWinnerRating, newLoserRating = _m.newLoserRating;
|
|
67010
67027
|
var newWinnerScaleValue = accessor
|
|
67011
|
-
? __assign(__assign({}, winnerScaleValue), (
|
|
67028
|
+
? __assign(__assign({}, winnerScaleValue), (_k = {}, _k[accessor] = newWinnerRating, _k)) : newWinnerRating;
|
|
67012
67029
|
var newLoserScaleValue = accessor
|
|
67013
|
-
? __assign(__assign({}, loserScaleValue), (
|
|
67030
|
+
? __assign(__assign({}, loserScaleValue), (_l = {}, _l[accessor] = newLoserRating, _l)) : newLoserRating;
|
|
67014
67031
|
scaleItemMap[winnerParticipantId].scaleValue = newWinnerScaleValue;
|
|
67015
67032
|
scaleItemMap[loserParticipantId].scaleValue = newLoserScaleValue;
|
|
67016
67033
|
var result = setParticipantScaleItem({
|
|
@@ -67034,7 +67051,7 @@ function generateDynamicRatings(_a) {
|
|
|
67034
67051
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
67035
67052
|
finally {
|
|
67036
67053
|
try {
|
|
67037
|
-
if (losingSideParticipantIds_1_1 && !losingSideParticipantIds_1_1.done && (
|
|
67054
|
+
if (losingSideParticipantIds_1_1 && !losingSideParticipantIds_1_1.done && (_j = losingSideParticipantIds_1.return)) _j.call(losingSideParticipantIds_1);
|
|
67038
67055
|
}
|
|
67039
67056
|
finally { if (e_3) throw e_3.error; }
|
|
67040
67057
|
}
|
|
@@ -67043,15 +67060,15 @@ function generateDynamicRatings(_a) {
|
|
|
67043
67060
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
67044
67061
|
finally {
|
|
67045
67062
|
try {
|
|
67046
|
-
if (winningSideParticipantIds_1_1 && !winningSideParticipantIds_1_1.done && (
|
|
67063
|
+
if (winningSideParticipantIds_1_1 && !winningSideParticipantIds_1_1.done && (_h = winningSideParticipantIds_1.return)) _h.call(winningSideParticipantIds_1);
|
|
67047
67064
|
}
|
|
67048
67065
|
finally { if (e_2) throw e_2.error; }
|
|
67049
67066
|
}
|
|
67050
67067
|
Object.assign(modifiedScaleValues, scaleItemMap);
|
|
67051
67068
|
};
|
|
67052
67069
|
try {
|
|
67053
|
-
for (var
|
|
67054
|
-
var matchUp =
|
|
67070
|
+
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
67071
|
+
var matchUp = matchUps_1_1.value;
|
|
67055
67072
|
var state_1 = _loop_1(matchUp);
|
|
67056
67073
|
if (typeof state_1 === "object")
|
|
67057
67074
|
return state_1.value;
|
|
@@ -67060,7 +67077,7 @@ function generateDynamicRatings(_a) {
|
|
|
67060
67077
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
67061
67078
|
finally {
|
|
67062
67079
|
try {
|
|
67063
|
-
if (
|
|
67080
|
+
if (matchUps_1_1 && !matchUps_1_1.done && (_b = matchUps_1.return)) _b.call(matchUps_1);
|
|
67064
67081
|
}
|
|
67065
67082
|
finally { if (e_1) throw e_1.error; }
|
|
67066
67083
|
}
|
|
@@ -68770,7 +68787,7 @@ function generateParticipants(params) {
|
|
|
68770
68787
|
if (ratingType && ratingsParameters$1[ratingType]) {
|
|
68771
68788
|
// ratingAttributes allows selected attributes of ratingParameters to be overridden
|
|
68772
68789
|
var ratingMax_1 = category.ratingMax, ratingMin_1 = category.ratingMin, ratingAttributes = category.ratingAttributes;
|
|
68773
|
-
var ratingParameters =
|
|
68790
|
+
var ratingParameters = __assign(__assign({}, ratingsParameters$1[ratingType]), (ratingAttributes || {}));
|
|
68774
68791
|
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
68792
|
var getAttributes_1 = function (attributes) {
|
|
68776
68793
|
var e_1, _a;
|
|
@@ -69130,16 +69147,14 @@ function getParticipantsCount(_a) {
|
|
|
69130
69147
|
largestDoublesDraw = drawSize + alternatesCount;
|
|
69131
69148
|
}
|
|
69132
69149
|
}
|
|
69133
|
-
else {
|
|
69134
|
-
|
|
69135
|
-
|
|
69136
|
-
|
|
69137
|
-
|
|
69138
|
-
|
|
69139
|
-
|
|
69140
|
-
|
|
69141
|
-
largestSinglesDraw = drawSize + alternatesCount;
|
|
69142
|
-
}
|
|
69150
|
+
else if (requiresUniqueParticipants) {
|
|
69151
|
+
var additionalParticipantsCount = drawSize + alternatesCount;
|
|
69152
|
+
if (gender)
|
|
69153
|
+
gendersCount[gender] += additionalParticipantsCount;
|
|
69154
|
+
uniqueParticipantsCount += additionalParticipantsCount;
|
|
69155
|
+
}
|
|
69156
|
+
else if (drawSize && drawSize > largestSinglesDraw) {
|
|
69157
|
+
largestSinglesDraw = drawSize + alternatesCount;
|
|
69143
69158
|
}
|
|
69144
69159
|
};
|
|
69145
69160
|
/*
|
|
@@ -70028,11 +70043,12 @@ function generateEventWithDraw(params) {
|
|
|
70028
70043
|
|
|
70029
70044
|
function generateVenues(_a) {
|
|
70030
70045
|
var e_1, _b;
|
|
70046
|
+
var _c;
|
|
70031
70047
|
var tournamentRecord = _a.tournamentRecord, venueProfiles = _a.venueProfiles, uuids = _a.uuids;
|
|
70032
70048
|
var startDate = tournamentRecord.startDate, endDate = tournamentRecord.endDate;
|
|
70033
70049
|
var venueIds = [];
|
|
70034
70050
|
var _loop_1 = function (index, venueProfile) {
|
|
70035
|
-
var venueAbbreviation = venueProfile.venueAbbreviation,
|
|
70051
|
+
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
70052
|
var newVenue = {
|
|
70037
70053
|
venueName: venueName || "Venue ".concat(index + 1),
|
|
70038
70054
|
venueAbbreviation: venueAbbreviation,
|
|
@@ -70066,8 +70082,8 @@ function generateVenues(_a) {
|
|
|
70066
70082
|
return { value: addResult };
|
|
70067
70083
|
};
|
|
70068
70084
|
try {
|
|
70069
|
-
for (var
|
|
70070
|
-
var
|
|
70085
|
+
for (var _d = __values(venueProfiles.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
70086
|
+
var _f = __read(_e.value, 2), index = _f[0], venueProfile = _f[1];
|
|
70071
70087
|
var state_1 = _loop_1(index, venueProfile);
|
|
70072
70088
|
if (typeof state_1 === "object")
|
|
70073
70089
|
return state_1.value;
|
|
@@ -70076,7 +70092,7 @@ function generateVenues(_a) {
|
|
|
70076
70092
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
70077
70093
|
finally {
|
|
70078
70094
|
try {
|
|
70079
|
-
if (
|
|
70095
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
70080
70096
|
}
|
|
70081
70097
|
finally { if (e_1) throw e_1.error; }
|
|
70082
70098
|
}
|
|
@@ -70307,25 +70323,26 @@ var amendsGovernor = {
|
|
|
70307
70323
|
|
|
70308
70324
|
function generateScheduledRounds(_a) {
|
|
70309
70325
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
70326
|
+
var _e, _f;
|
|
70310
70327
|
var schedulingProfile = _a.schedulingProfile, tournamentRecord = _a.tournamentRecord;
|
|
70311
70328
|
if (typeof schedulingProfile !== 'object')
|
|
70312
70329
|
return { error: INVALID_VALUES };
|
|
70313
70330
|
var containedStructures = getContainedStructures({
|
|
70314
70331
|
tournamentRecord: tournamentRecord,
|
|
70315
70332
|
}).containedStructures;
|
|
70316
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps
|
|
70333
|
+
var matchUps = (_e = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _e !== void 0 ? _e : [];
|
|
70317
70334
|
var tournamentId = tournamentRecord.tournamentId;
|
|
70318
70335
|
var scheduledRounds = [];
|
|
70319
70336
|
try {
|
|
70320
70337
|
for (var schedulingProfile_1 = __values(schedulingProfile), schedulingProfile_1_1 = schedulingProfile_1.next(); !schedulingProfile_1_1.done; schedulingProfile_1_1 = schedulingProfile_1.next()) {
|
|
70321
70338
|
var dateProfile = schedulingProfile_1_1.value;
|
|
70322
|
-
var scheduleDate = dateProfile.scheduleDate,
|
|
70339
|
+
var scheduleDate = dateProfile.scheduleDate, _g = dateProfile.venues, venues = _g === void 0 ? [] : _g;
|
|
70323
70340
|
try {
|
|
70324
70341
|
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
70342
|
var venue = venues_1_1.value;
|
|
70326
70343
|
var rounds = venue.rounds, venueId = venue.venueId;
|
|
70327
70344
|
var _loop_1 = function (round) {
|
|
70328
|
-
var
|
|
70345
|
+
var _h;
|
|
70329
70346
|
var drawId = round.drawId, winnerFinishingPositionRange = round.winnerFinishingPositionRange, roundSegment = round.roundSegment;
|
|
70330
70347
|
var targetMatchUps = matchUps.filter(function (matchUp) {
|
|
70331
70348
|
var _a;
|
|
@@ -70347,9 +70364,9 @@ function generateScheduledRounds(_a) {
|
|
|
70347
70364
|
var structureId_1 = targetMatchUp.structureId;
|
|
70348
70365
|
if (roundNumber && !winnerFinishingPositionRange) {
|
|
70349
70366
|
structureId_1 =
|
|
70350
|
-
Object.keys(containedStructures).find(function (containingStructureId) {
|
|
70367
|
+
(_f = Object.keys(containedStructures).find(function (containingStructureId) {
|
|
70351
70368
|
return containedStructures[containingStructureId].includes(structureId_1);
|
|
70352
|
-
})
|
|
70369
|
+
})) !== null && _f !== void 0 ? _f : structureId_1;
|
|
70353
70370
|
}
|
|
70354
70371
|
var roundToSchedule = {
|
|
70355
70372
|
tournamentId: tournamentId,
|
|
@@ -70360,7 +70377,7 @@ function generateScheduledRounds(_a) {
|
|
|
70360
70377
|
drawId: drawId,
|
|
70361
70378
|
};
|
|
70362
70379
|
var result = addSchedulingProfileRound({
|
|
70363
|
-
tournamentRecords: (
|
|
70380
|
+
tournamentRecords: (_h = {}, _h[tournamentId] = tournamentRecord, _h),
|
|
70364
70381
|
round: roundToSchedule,
|
|
70365
70382
|
scheduleDate: scheduleDate,
|
|
70366
70383
|
venueId: venueId,
|