tods-competition-factory 1.8.21 → 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 -23
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +21 -17
- 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 +217 -208
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +482 -465
- 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 +5 -5
|
@@ -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)
|
|
@@ -8112,7 +8114,6 @@ var DIRECT_ENTRY_STATUSES = [
|
|
|
8112
8114
|
var STRUCTURE_SELECTED_STATUSES = [
|
|
8113
8115
|
CONFIRMED,
|
|
8114
8116
|
DIRECT_ACCEPTANCE,
|
|
8115
|
-
FEED_IN,
|
|
8116
8117
|
JUNIOR_EXEMPT,
|
|
8117
8118
|
LUCKY_LOSER,
|
|
8118
8119
|
QUALIFIER,
|
|
@@ -9270,9 +9271,9 @@ var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
|
9270
9271
|
_a$h);
|
|
9271
9272
|
|
|
9272
9273
|
function getRoundContextProfile(_a) {
|
|
9273
|
-
var _b, _c, _d, _e;
|
|
9274
|
+
var _b, _c, _d, _e, _f;
|
|
9274
9275
|
var roundNamingPolicy = _a.roundNamingPolicy, drawDefinition = _a.drawDefinition, structure = _a.structure, matchUps = _a.matchUps;
|
|
9275
|
-
var
|
|
9276
|
+
var _g = getRoundMatchUps$1({ matchUps: matchUps }), roundProfile = _g.roundProfile, roundMatchUps = _g.roundMatchUps;
|
|
9276
9277
|
var structureAbbreviation = structure.structureAbbreviation, stage = structure.stage;
|
|
9277
9278
|
var isAdHocStructure = isAdHoc({ structure: structure });
|
|
9278
9279
|
var isLuckyStructure = isLucky({ structure: structure });
|
|
@@ -9292,10 +9293,10 @@ function getRoundContextProfile(_a) {
|
|
|
9292
9293
|
return stageSequence !== null && stageSequence !== void 0 ? stageSequence : 1;
|
|
9293
9294
|
})), false), [0], false)) : 0;
|
|
9294
9295
|
var preQualifyingSequence = qualifyingStageSequences
|
|
9295
|
-
? qualifyingStageSequences - (structure.stageSequence
|
|
9296
|
+
? qualifyingStageSequences - ((_c = structure.stageSequence) !== null && _c !== void 0 ? _c : 1) || ''
|
|
9296
9297
|
: '';
|
|
9297
9298
|
var preQualifyingAffix = preQualifyingSequence
|
|
9298
|
-
? ((
|
|
9299
|
+
? ((_d = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _d === void 0 ? void 0 : _d.preQualifying) ||
|
|
9299
9300
|
defaultRoundNamingPolicy.affixes.preQualifying ||
|
|
9300
9301
|
''
|
|
9301
9302
|
: '';
|
|
@@ -9305,9 +9306,9 @@ function getRoundContextProfile(_a) {
|
|
|
9305
9306
|
var abbreviatedRoundNamingMap = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.abbreviatedRoundNamingMap) ||
|
|
9306
9307
|
defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
|
|
9307
9308
|
{};
|
|
9308
|
-
var preFeedAffix = ((
|
|
9309
|
+
var preFeedAffix = ((_e = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _e === void 0 ? void 0 : _e.preFeedRound) ||
|
|
9309
9310
|
defaultRoundNamingPolicy.affixes.preFeedRound;
|
|
9310
|
-
var roundNumberAffix = ((
|
|
9311
|
+
var roundNumberAffix = ((_f = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) === null || _f === void 0 ? void 0 : _f.roundNumber) ||
|
|
9311
9312
|
defaultRoundNamingPolicy.affixes.roundNumber;
|
|
9312
9313
|
var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
|
|
9313
9314
|
defaultRoundNamingPolicy.namingConventions;
|
|
@@ -9626,7 +9627,13 @@ function getAllStructureMatchUps(_a) {
|
|
|
9626
9627
|
matchUps: matchUps,
|
|
9627
9628
|
}).collectionPositionMatchUps);
|
|
9628
9629
|
}
|
|
9629
|
-
return {
|
|
9630
|
+
return {
|
|
9631
|
+
collectionPositionMatchUps: collectionPositionMatchUps,
|
|
9632
|
+
roundMatchUps: roundMatchUps,
|
|
9633
|
+
roundProfile: roundProfile,
|
|
9634
|
+
matchUpsMap: matchUpsMap,
|
|
9635
|
+
matchUps: matchUps,
|
|
9636
|
+
};
|
|
9630
9637
|
function addMatchUpContext(_a) {
|
|
9631
9638
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
9632
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;
|
|
@@ -19571,7 +19578,7 @@ function parseScoreString(_a) {
|
|
|
19571
19578
|
isSide1: winningSide === 2,
|
|
19572
19579
|
tiebreakTo: tiebreakTo,
|
|
19573
19580
|
});
|
|
19574
|
-
var setTiebreak = side1TiebreakPerspective
|
|
19581
|
+
var setTiebreak = side1TiebreakPerspective !== null && side1TiebreakPerspective !== void 0 ? side1TiebreakPerspective : [];
|
|
19575
19582
|
var _b = __read(setScores || [], 2), side1Score = _b[0], side2Score = _b[1];
|
|
19576
19583
|
var _c = __read(matchTiebreak || setTiebreak || [], 2), side1TiebreakScore = _c[0], side2TiebreakScore = _c[1];
|
|
19577
19584
|
return {
|
|
@@ -19740,7 +19747,9 @@ function getSuper(values, index) {
|
|
|
19740
19747
|
index ? values.slice(0, 1) : values.slice(2),
|
|
19741
19748
|
].map(function (n) { return parseInt(n.join('')); });
|
|
19742
19749
|
// preserve order
|
|
19743
|
-
|
|
19750
|
+
if (index)
|
|
19751
|
+
parts.reverse();
|
|
19752
|
+
var scores = parts;
|
|
19744
19753
|
var diff = Math.abs(scores.reduce(function (a, b) { return +a - +b; }));
|
|
19745
19754
|
if (diff >= 2)
|
|
19746
19755
|
return scores.join('-');
|
|
@@ -20881,7 +20890,6 @@ function handleNumeric(params) {
|
|
|
20881
20890
|
score = score.toString().toLowerCase();
|
|
20882
20891
|
if (allNumeric)
|
|
20883
20892
|
score = onlyNumbers.join('');
|
|
20884
|
-
// const numbers = score.split('').map((n) => parseInt(n));
|
|
20885
20893
|
var numbers = allNumeric
|
|
20886
20894
|
? onlyNumbers.map(function (n) { return parseInt(n); })
|
|
20887
20895
|
: score.split('').map(function (n) { return parseInt(n); });
|
|
@@ -20944,12 +20952,12 @@ function handleNumeric(params) {
|
|
|
20944
20952
|
getDiff(numbers.slice(2, 4)) === 1 &&
|
|
20945
20953
|
getDiff(numbers.slice(5, 7)) > 1) {
|
|
20946
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];
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20955
|
+
/**
|
|
20956
|
+
if (tb === 1) {
|
|
20957
|
+
console.log('BOO');
|
|
20958
|
+
score = `${s1}-${s2} ${s3}-${s4} [${tb}${s5}-${s6}]`;
|
|
20959
|
+
applied.push('numericTiebreakPattern8');
|
|
20960
|
+
} else {
|
|
20953
20961
|
*/
|
|
20954
20962
|
score = "".concat(s1, "-").concat(s2, " ").concat(s3, "-").concat(s4, "(").concat(tb, ") ").concat(s5, "-").concat(s6);
|
|
20955
20963
|
applied.push('numericTiebreakPattern8');
|
|
@@ -21043,7 +21051,7 @@ function handleNumeric(params) {
|
|
|
21043
21051
|
if (superParse && score !== superParse) {
|
|
21044
21052
|
applied.push('parsedSuperPattern');
|
|
21045
21053
|
}
|
|
21046
|
-
score = superParse
|
|
21054
|
+
score = superParse !== null && superParse !== void 0 ? superParse : score;
|
|
21047
21055
|
}
|
|
21048
21056
|
}
|
|
21049
21057
|
return { score: score, applied: applied, matchUpStatus: matchUpStatus };
|
|
@@ -21082,6 +21090,7 @@ function sensibleSets(_a) {
|
|
|
21082
21090
|
var setsCount = sets.length;
|
|
21083
21091
|
score = sets
|
|
21084
21092
|
.map(function (set, index) {
|
|
21093
|
+
var _a;
|
|
21085
21094
|
if (new RegExp(tiebreakSet).test(set)) {
|
|
21086
21095
|
var tiebreak = set.slice(3);
|
|
21087
21096
|
var setScores = set.slice(0, 3);
|
|
@@ -21090,9 +21099,9 @@ function sensibleSets(_a) {
|
|
|
21090
21099
|
var maxSetScore = Math.max.apply(Math, __spreadArray([], __read(sideScores), false));
|
|
21091
21100
|
var maxIndex = setScores.indexOf(maxSetScore);
|
|
21092
21101
|
var sensibleSetScores = [maxSetScore, maxSetScore - 1];
|
|
21093
|
-
|
|
21094
|
-
|
|
21095
|
-
|
|
21102
|
+
if (maxIndex)
|
|
21103
|
+
sensibleSetScores.reverse();
|
|
21104
|
+
var sensibleSetScore = sensibleSetScores.join('-');
|
|
21096
21105
|
return sensibleSetScore + tiebreak;
|
|
21097
21106
|
}
|
|
21098
21107
|
}
|
|
@@ -21107,7 +21116,7 @@ function sensibleSets(_a) {
|
|
|
21107
21116
|
profile.push(setType);
|
|
21108
21117
|
// check for reasonable set scores in the first two sets
|
|
21109
21118
|
if (setsCount > 1 && setType === 'standard' && index < 2) {
|
|
21110
|
-
var
|
|
21119
|
+
var _b = __read(set.split('-'), 2), s1 = _b[0], s2 = _b[1];
|
|
21111
21120
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21112
21121
|
var max = Math.max(s1, s2);
|
|
21113
21122
|
var min_1 = Math.min(s1, s2);
|
|
@@ -21116,10 +21125,10 @@ function sensibleSets(_a) {
|
|
|
21116
21125
|
// coerce larger value to something reasonable
|
|
21117
21126
|
if (max > 9 && diff > 2) {
|
|
21118
21127
|
var splitMax = max.toString().split('');
|
|
21119
|
-
var reasonable = splitMax.find(function (value) {
|
|
21128
|
+
var reasonable = (_a = splitMax.find(function (value) {
|
|
21120
21129
|
return parseInt(value) > min_1 ||
|
|
21121
21130
|
(index && parseInt(value) <= maxSetValue);
|
|
21122
|
-
})
|
|
21131
|
+
})) !== null && _a !== void 0 ? _a : splitMax[0];
|
|
21123
21132
|
if (reasonable) {
|
|
21124
21133
|
set = minIndex
|
|
21125
21134
|
? [reasonable, min_1].join('-')
|
|
@@ -21131,7 +21140,7 @@ function sensibleSets(_a) {
|
|
|
21131
21140
|
}
|
|
21132
21141
|
// throw out any sets where the values are equal and there is no retirement
|
|
21133
21142
|
if (setType === 'standard') {
|
|
21134
|
-
var
|
|
21143
|
+
var _c = __read(set.split('-'), 2), s1 = _c[0], s2 = _c[1];
|
|
21135
21144
|
var diff = Math.abs(parseInt(s1) - parseInt(s2));
|
|
21136
21145
|
if (!diff && matchUpStatus !== 'RETIRED') {
|
|
21137
21146
|
return '';
|
|
@@ -21691,7 +21700,6 @@ function getVenuesAndCourts(_a) {
|
|
|
21691
21700
|
try {
|
|
21692
21701
|
for (var _c = __values(tournamentRecord.venues || []), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
21693
21702
|
var venue = _d.value;
|
|
21694
|
-
tournamentRecord.venues;
|
|
21695
21703
|
if (venueIds.length && !venueIds.includes(venue.venueId))
|
|
21696
21704
|
continue;
|
|
21697
21705
|
if (ignoreDisabled) {
|
|
@@ -23128,7 +23136,7 @@ function getContainedStructures(_a) {
|
|
|
23128
23136
|
.flat()
|
|
23129
23137
|
.filter(Boolean);
|
|
23130
23138
|
var _loop_1 = function (structureContainer) {
|
|
23131
|
-
var _c = structureContainer
|
|
23139
|
+
var _c = structureContainer !== null && structureContainer !== void 0 ? structureContainer : {}, structures = _c.structures, structureId = _c.structureId;
|
|
23132
23140
|
structures &&
|
|
23133
23141
|
structureId &&
|
|
23134
23142
|
(containedStructures[structureId] = structures === null || structures === void 0 ? void 0 : structures.map(function (structure) { return structure.structureId; })) &&
|
|
@@ -30201,10 +30209,11 @@ function filterParticipants(_a) {
|
|
|
30201
30209
|
var participantIds_1 = tournamentEvents
|
|
30202
30210
|
.filter(function (event) { return eventIds.includes(event.eventId); })
|
|
30203
30211
|
.map(function (event) {
|
|
30212
|
+
var _a;
|
|
30204
30213
|
var enteredParticipantIds = (event.entries || []).map(function (entry) { return entry.participantId; });
|
|
30205
30214
|
if (event.eventType === SINGLES)
|
|
30206
30215
|
return enteredParticipantIds;
|
|
30207
|
-
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 : [])
|
|
30208
30217
|
.filter(function (participant) {
|
|
30209
30218
|
return enteredParticipantIds.includes(participant.participantId);
|
|
30210
30219
|
})
|
|
@@ -30575,6 +30584,7 @@ var penaltyTemplate = function (_a) {
|
|
|
30575
30584
|
};
|
|
30576
30585
|
|
|
30577
30586
|
function addPenalty$1(_a) {
|
|
30587
|
+
var _b;
|
|
30578
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;
|
|
30579
30589
|
if (!tournamentRecord)
|
|
30580
30590
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30583,7 +30593,7 @@ function addPenalty$1(_a) {
|
|
|
30583
30593
|
if (!penaltyType)
|
|
30584
30594
|
return { error: MISSING_PENALTY_TYPE };
|
|
30585
30595
|
// TODO: add penalty timeItem to matchUp.timeItems[]
|
|
30586
|
-
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 : [];
|
|
30587
30597
|
var relevantParticipants = participants.filter(function (participant) {
|
|
30588
30598
|
return participantIds.includes(participant.participantId);
|
|
30589
30599
|
});
|
|
@@ -30619,18 +30629,20 @@ function addPenalty$1(_a) {
|
|
|
30619
30629
|
return __assign(__assign({}, SUCCESS), { penaltyId: penaltyItem.penaltyId });
|
|
30620
30630
|
}
|
|
30621
30631
|
function removePenalty$1(_a) {
|
|
30632
|
+
var _b;
|
|
30622
30633
|
var tournamentRecord = _a.tournamentRecord, penaltyId = _a.penaltyId;
|
|
30623
30634
|
if (!tournamentRecord)
|
|
30624
30635
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30625
30636
|
if (!penaltyId)
|
|
30626
30637
|
return { error: MISSING_PENALTY_ID };
|
|
30627
|
-
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 : [];
|
|
30628
30639
|
var modifiedParticipants = [];
|
|
30629
30640
|
var penaltyRemoved = false;
|
|
30630
30641
|
var removedPenalty;
|
|
30631
30642
|
participants.forEach(function (participant) {
|
|
30643
|
+
var _a;
|
|
30632
30644
|
var participantModified = false;
|
|
30633
|
-
participant.penalties = (participant.penalties
|
|
30645
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).filter(function (penalty) {
|
|
30634
30646
|
if (penalty.penaltyId === penaltyId) {
|
|
30635
30647
|
participantModified = true;
|
|
30636
30648
|
if (!penaltyRemoved) {
|
|
@@ -30656,13 +30668,15 @@ function removePenalty$1(_a) {
|
|
|
30656
30668
|
? __assign(__assign({}, SUCCESS), { penalty: removedPenalty }) : { error: PENALTY_NOT_FOUND };
|
|
30657
30669
|
}
|
|
30658
30670
|
function getTournamentPenalties(_a) {
|
|
30671
|
+
var _b;
|
|
30659
30672
|
var tournamentRecord = _a.tournamentRecord;
|
|
30660
30673
|
if (!tournamentRecord)
|
|
30661
30674
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30662
|
-
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 : [];
|
|
30663
30676
|
var allPenalties = participants.reduce(function (penalties, participant) {
|
|
30677
|
+
var _a;
|
|
30664
30678
|
var participantId = participant.participantId;
|
|
30665
|
-
(participant.penalties
|
|
30679
|
+
((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).forEach(function (penalty) {
|
|
30666
30680
|
var penaltyId = (penalty || {}).penaltyId;
|
|
30667
30681
|
if (penalties[penaltyId]) {
|
|
30668
30682
|
penalties[penaltyId].participants.push(participantId);
|
|
@@ -30676,6 +30690,7 @@ function getTournamentPenalties(_a) {
|
|
|
30676
30690
|
return { penalties: Object.values(allPenalties) };
|
|
30677
30691
|
}
|
|
30678
30692
|
function modifyPenalty$1(_a) {
|
|
30693
|
+
var _b;
|
|
30679
30694
|
var tournamentRecord = _a.tournamentRecord, modifications = _a.modifications, penaltyId = _a.penaltyId;
|
|
30680
30695
|
if (!tournamentRecord)
|
|
30681
30696
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -30683,7 +30698,7 @@ function modifyPenalty$1(_a) {
|
|
|
30683
30698
|
return { error: INVALID_VALUES, modifications: modifications };
|
|
30684
30699
|
if (!penaltyId)
|
|
30685
30700
|
return { error: MISSING_PENALTY_ID };
|
|
30686
|
-
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 : [];
|
|
30687
30702
|
var validAttributes = Object.keys(penaltyTemplate()).filter(function (attribute) { return attribute !== 'penaltyId'; });
|
|
30688
30703
|
var validModificationAttributes = Object.keys(modifications).filter(function (attribute) { return validAttributes.includes(attribute); });
|
|
30689
30704
|
if (!validModificationAttributes.length)
|
|
@@ -30691,8 +30706,9 @@ function modifyPenalty$1(_a) {
|
|
|
30691
30706
|
var updatedPenalty;
|
|
30692
30707
|
var modifiedParticipants = [];
|
|
30693
30708
|
participants.forEach(function (participant) {
|
|
30709
|
+
var _a;
|
|
30694
30710
|
var participantModified = false;
|
|
30695
|
-
participant.penalties = (participant.penalties
|
|
30711
|
+
participant.penalties = ((_a = participant.penalties) !== null && _a !== void 0 ? _a : []).map(function (penalty) {
|
|
30696
30712
|
if (penalty.penaltyId === penaltyId) {
|
|
30697
30713
|
participantModified = true;
|
|
30698
30714
|
validModificationAttributes.forEach(function (attribute) {
|
|
@@ -30722,18 +30738,18 @@ function modifyPenalty$1(_a) {
|
|
|
30722
30738
|
|
|
30723
30739
|
function addPenalty(params) {
|
|
30724
30740
|
var e_1, _a;
|
|
30725
|
-
var _b;
|
|
30741
|
+
var _b, _c;
|
|
30726
30742
|
var tournamentRecords = params.tournamentRecords, participantIds = params.participantIds;
|
|
30727
30743
|
var penaltyId;
|
|
30728
30744
|
try {
|
|
30729
|
-
for (var
|
|
30730
|
-
var tournamentRecord =
|
|
30745
|
+
for (var _d = __values(Object.values(tournamentRecords)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
30746
|
+
var tournamentRecord = _e.value;
|
|
30731
30747
|
var participants = (_b = getParticipants$1({
|
|
30732
30748
|
tournamentRecord: tournamentRecord,
|
|
30733
30749
|
}).participants) !== null && _b !== void 0 ? _b : [];
|
|
30734
30750
|
var tournamentParticipantIds = participants === null || participants === void 0 ? void 0 : participants.map(extractAttributes('participantId')).filter(function (participantId) { return participantIds.includes(participantId); });
|
|
30735
30751
|
if (tournamentParticipantIds.length) {
|
|
30736
|
-
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 }));
|
|
30737
30753
|
penaltyId = result.penaltyId;
|
|
30738
30754
|
}
|
|
30739
30755
|
}
|
|
@@ -30741,7 +30757,7 @@ function addPenalty(params) {
|
|
|
30741
30757
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
30742
30758
|
finally {
|
|
30743
30759
|
try {
|
|
30744
|
-
if (
|
|
30760
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
30745
30761
|
}
|
|
30746
30762
|
finally { if (e_1) throw e_1.error; }
|
|
30747
30763
|
}
|
|
@@ -30805,7 +30821,7 @@ function getCompetitionPenalties(_a) {
|
|
|
30805
30821
|
for (var _c = __values(Object.values(tournamentRecords)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
30806
30822
|
var tournamentRecord = _d.value;
|
|
30807
30823
|
var penalties = getTournamentPenalties({ tournamentRecord: tournamentRecord }).penalties;
|
|
30808
|
-
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties
|
|
30824
|
+
allPenalties.push.apply(allPenalties, __spreadArray([], __read((penalties !== null && penalties !== void 0 ? penalties : [])), false));
|
|
30809
30825
|
}
|
|
30810
30826
|
}
|
|
30811
30827
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
@@ -36653,7 +36669,8 @@ function modifyPersonRequests(_a) {
|
|
|
36653
36669
|
|
|
36654
36670
|
function clearScheduledMatchUps$1(_a) {
|
|
36655
36671
|
var e_1, _b;
|
|
36656
|
-
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;
|
|
36657
36674
|
if (typeof tournamentRecord !== 'object')
|
|
36658
36675
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36659
36676
|
if (!Array.isArray(ignoreMatchUpStatuses) || !Array.isArray(venueIds)) {
|
|
@@ -36661,10 +36678,10 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36661
36678
|
}
|
|
36662
36679
|
if (venueIds.length)
|
|
36663
36680
|
scheduleAttributes.push('venueId');
|
|
36664
|
-
var inContextMatchUps = allTournamentMatchUps({
|
|
36681
|
+
var inContextMatchUps = (_c = allTournamentMatchUps({
|
|
36665
36682
|
matchUpFilters: { scheduledDates: scheduledDates },
|
|
36666
36683
|
tournamentRecord: tournamentRecord,
|
|
36667
|
-
}).matchUps
|
|
36684
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
36668
36685
|
var relevantMatchUpIds = inContextMatchUps
|
|
36669
36686
|
.filter(function (matchUp) {
|
|
36670
36687
|
return matchUp.matchUpStatus &&
|
|
@@ -36673,16 +36690,16 @@ function clearScheduledMatchUps$1(_a) {
|
|
|
36673
36690
|
(!(venueIds === null || venueIds === void 0 ? void 0 : venueIds.length) || venueIds.includes(matchUp.schedule.venueId));
|
|
36674
36691
|
})
|
|
36675
36692
|
.map(getMatchUpId);
|
|
36676
|
-
var matchUps = allTournamentMatchUps({
|
|
36693
|
+
var matchUps = (_d = allTournamentMatchUps({
|
|
36677
36694
|
tournamentRecord: tournamentRecord,
|
|
36678
36695
|
inContext: false,
|
|
36679
|
-
}).matchUps
|
|
36696
|
+
}).matchUps) !== null && _d !== void 0 ? _d : [];
|
|
36680
36697
|
var clearedScheduleCount = 0;
|
|
36681
36698
|
try {
|
|
36682
36699
|
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
36683
36700
|
var matchUp = matchUps_1_1.value;
|
|
36684
36701
|
if (relevantMatchUpIds.includes(matchUp.matchUpId)) {
|
|
36685
|
-
matchUp.timeItems = (matchUp.timeItems
|
|
36702
|
+
matchUp.timeItems = ((_e = matchUp.timeItems) !== null && _e !== void 0 ? _e : []).filter(function (timeItem) {
|
|
36686
36703
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) &&
|
|
36687
36704
|
![
|
|
36688
36705
|
ALLOCATE_COURTS,
|
|
@@ -39722,18 +39739,19 @@ function getEventAlternateParticipantIds(_a) {
|
|
|
39722
39739
|
}
|
|
39723
39740
|
|
|
39724
39741
|
function matchUpActions$1(_a) {
|
|
39742
|
+
var _b, _c;
|
|
39725
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;
|
|
39726
39744
|
if (!tournamentRecord)
|
|
39727
39745
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
39728
39746
|
if (!drawId) {
|
|
39729
39747
|
// if matchUp did not have context, find drawId by brute force
|
|
39730
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps
|
|
39748
|
+
var matchUps = (_b = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _b !== void 0 ? _b : [];
|
|
39731
39749
|
drawId = matchUps.reduce(function (drawId, candidate) {
|
|
39732
39750
|
return candidate.matchUpId === matchUpId ? candidate.drawId : drawId;
|
|
39733
39751
|
}, undefined);
|
|
39734
|
-
var events = tournamentRecord.events
|
|
39752
|
+
var events = (_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [];
|
|
39735
39753
|
var drawDefinitions = events
|
|
39736
|
-
.map(function (event) { return event.drawDefinitions
|
|
39754
|
+
.map(function (event) { var _a; return (_a = event.drawDefinitions) !== null && _a !== void 0 ? _a : []; })
|
|
39737
39755
|
.flat();
|
|
39738
39756
|
drawDefinition = drawDefinitions.reduce(function (drawDefinition, candidate) {
|
|
39739
39757
|
return candidate.drawId === drawId ? candidate : drawDefinition;
|
|
@@ -39745,7 +39763,7 @@ function matchUpActions$1(_a) {
|
|
|
39745
39763
|
drawDefinition: drawDefinition,
|
|
39746
39764
|
event: event,
|
|
39747
39765
|
}).policyDefinitions;
|
|
39748
|
-
policyDefinitions = policyDefinitions
|
|
39766
|
+
policyDefinitions = policyDefinitions !== null && policyDefinitions !== void 0 ? policyDefinitions : attachedPolicy;
|
|
39749
39767
|
if (drawDefinition) {
|
|
39750
39768
|
return matchUpActions$2({
|
|
39751
39769
|
tournamentParticipants: tournamentRecord.participants,
|
|
@@ -40232,16 +40250,17 @@ function deletionMessage(_a) {
|
|
|
40232
40250
|
|
|
40233
40251
|
function deleteVenue$1(_a) {
|
|
40234
40252
|
var e_1, _b;
|
|
40253
|
+
var _c, _d;
|
|
40235
40254
|
var tournamentRecord = _a.tournamentRecord, venueId = _a.venueId, force = _a.force;
|
|
40236
40255
|
if (!tournamentRecord)
|
|
40237
40256
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
40238
40257
|
if (typeof venueId !== 'string')
|
|
40239
40258
|
return { error: MISSING_VENUE_ID };
|
|
40240
40259
|
var contextFilters = { venueIds: [venueId] };
|
|
40241
|
-
var matchUpsToUnschedule = allTournamentMatchUps({
|
|
40260
|
+
var matchUpsToUnschedule = (_c = allTournamentMatchUps({
|
|
40242
40261
|
tournamentRecord: tournamentRecord,
|
|
40243
40262
|
contextFilters: contextFilters,
|
|
40244
|
-
}).matchUps
|
|
40263
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
40245
40264
|
if (!matchUpsToUnschedule.length || force) {
|
|
40246
40265
|
try {
|
|
40247
40266
|
// if no matchUpsToUnschedule this does nothing but avoid the deletionMessage
|
|
@@ -40268,7 +40287,7 @@ function deleteVenue$1(_a) {
|
|
|
40268
40287
|
return deletionMessage({ matchUpsCount: matchUpsToUnschedule.length });
|
|
40269
40288
|
}
|
|
40270
40289
|
var deleted;
|
|
40271
|
-
tournamentRecord.venues = (tournamentRecord.venues
|
|
40290
|
+
tournamentRecord.venues = ((_d = tournamentRecord.venues) !== null && _d !== void 0 ? _d : []).filter(function (venue) {
|
|
40272
40291
|
if ((venue === null || venue === void 0 ? void 0 : venue.venueId) !== venueId)
|
|
40273
40292
|
return true;
|
|
40274
40293
|
deleted = true;
|
|
@@ -40488,6 +40507,7 @@ function getScheduledVenueMatchUps(_a) {
|
|
|
40488
40507
|
|
|
40489
40508
|
function deleteCourt$1(_a) {
|
|
40490
40509
|
var e_1, _b;
|
|
40510
|
+
var _c;
|
|
40491
40511
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, disableNotice = _a.disableNotice, courtId = _a.courtId, force = _a.force;
|
|
40492
40512
|
var result = findCourt({ tournamentRecord: tournamentRecord, courtId: courtId });
|
|
40493
40513
|
if (result.error)
|
|
@@ -40499,8 +40519,8 @@ function deleteCourt$1(_a) {
|
|
|
40499
40519
|
}).matchUps;
|
|
40500
40520
|
if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length) || force) {
|
|
40501
40521
|
try {
|
|
40502
|
-
for (var
|
|
40503
|
-
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;
|
|
40504
40524
|
var result_1 = removeCourtAssignment({
|
|
40505
40525
|
matchUpId: matchUp.matchUpId,
|
|
40506
40526
|
drawId: matchUp.drawId,
|
|
@@ -40514,12 +40534,12 @@ function deleteCourt$1(_a) {
|
|
|
40514
40534
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40515
40535
|
finally {
|
|
40516
40536
|
try {
|
|
40517
|
-
if (
|
|
40537
|
+
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
|
|
40518
40538
|
}
|
|
40519
40539
|
finally { if (e_1) throw e_1.error; }
|
|
40520
40540
|
}
|
|
40521
40541
|
if (venue) {
|
|
40522
|
-
venue.courts = (venue.courts
|
|
40542
|
+
venue.courts = ((_c = venue.courts) !== null && _c !== void 0 ? _c : []).filter(function (courtRecord) {
|
|
40523
40543
|
return courtRecord.courtId !== courtId;
|
|
40524
40544
|
});
|
|
40525
40545
|
if (!disableNotice)
|
|
@@ -41931,7 +41951,7 @@ function treeMatchUps(_a) {
|
|
|
41931
41951
|
uuids: uuids,
|
|
41932
41952
|
}), roundNodes = _b.roundNodes, matchUps = _b.matchUps);
|
|
41933
41953
|
roundNumber++;
|
|
41934
|
-
roundLimit = roundLimit
|
|
41954
|
+
roundLimit = roundLimit !== null && roundLimit !== void 0 ? roundLimit : qualifyingRoundNumber;
|
|
41935
41955
|
while (roundNodes.length > 1) {
|
|
41936
41956
|
if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
|
|
41937
41957
|
roundLimit = roundNumber - 1;
|
|
@@ -41961,7 +41981,7 @@ function treeMatchUps(_a) {
|
|
|
41961
41981
|
roundLimit = roundNumber - 1;
|
|
41962
41982
|
}
|
|
41963
41983
|
else {
|
|
41964
|
-
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; });
|
|
41965
41985
|
}
|
|
41966
41986
|
return { drawSize: drawSize, matchUps: matchUps, roundsCount: roundsCount, roundLimit: roundLimit };
|
|
41967
41987
|
}
|
|
@@ -42102,7 +42122,6 @@ function generateQualifyingStructures(_a) {
|
|
|
42102
42122
|
roundTarget: roundTarget,
|
|
42103
42123
|
linkType: linkType,
|
|
42104
42124
|
});
|
|
42105
|
-
targetRoundQualifiersCount = 0;
|
|
42106
42125
|
roundTarget += 1;
|
|
42107
42126
|
}
|
|
42108
42127
|
}
|
|
@@ -42117,16 +42136,19 @@ function generateQualifyingStructures(_a) {
|
|
|
42117
42136
|
}
|
|
42118
42137
|
|
|
42119
42138
|
function getStructureRoundProfile(_a) {
|
|
42120
|
-
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42139
|
+
var drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId;
|
|
42121
42140
|
var result = findStructure({
|
|
42122
42141
|
drawDefinition: drawDefinition,
|
|
42123
42142
|
structureId: structureId,
|
|
42124
42143
|
});
|
|
42125
42144
|
if (result.error)
|
|
42126
|
-
return result;
|
|
42145
|
+
return decorateResult({ result: result });
|
|
42127
42146
|
// DEV-NOTE cannot pass drawDefinition parameter in this scenario; callstack error
|
|
42128
|
-
var matchUps = getAllStructureMatchUps({
|
|
42129
|
-
|
|
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 });
|
|
42130
42152
|
}
|
|
42131
42153
|
|
|
42132
42154
|
function getFinishingPositionSourceRoundsMap(_a) {
|
|
@@ -42173,23 +42195,24 @@ function roundValueRanges(values) {
|
|
|
42173
42195
|
}
|
|
42174
42196
|
|
|
42175
42197
|
function getPositionsPlayedOff(_a) {
|
|
42176
|
-
var
|
|
42198
|
+
var _b;
|
|
42199
|
+
var drawDefinition = _a.drawDefinition, structureIds = _a.structureIds, matchUpsMap = _a.matchUpsMap;
|
|
42177
42200
|
if (structureIds && !Array.isArray(structureIds))
|
|
42178
42201
|
return { error: INVALID_VALUES, context: { structureIds: structureIds } };
|
|
42179
42202
|
if (!drawDefinition)
|
|
42180
42203
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42181
42204
|
structureIds =
|
|
42182
|
-
structureIds
|
|
42183
|
-
(
|
|
42184
|
-
|
|
42185
|
-
|
|
42186
|
-
|
|
42187
|
-
|
|
42188
|
-
});
|
|
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
|
+
});
|
|
42189
42211
|
var allFinishingPositionRanges = structureIds
|
|
42190
42212
|
.map(function (structureId) {
|
|
42191
42213
|
var roundProfile = getStructureRoundProfile({
|
|
42192
42214
|
drawDefinition: drawDefinition,
|
|
42215
|
+
matchUpsMap: matchUpsMap,
|
|
42193
42216
|
structureId: structureId,
|
|
42194
42217
|
}).roundProfile;
|
|
42195
42218
|
var values = roundProfile && Object.values(roundProfile);
|
|
@@ -42305,20 +42328,21 @@ function getAvailablePlayoffProfiles$1(_a) {
|
|
|
42305
42328
|
var drawDefinition = _a.drawDefinition, structureId = _a.structureId;
|
|
42306
42329
|
if (!drawDefinition)
|
|
42307
42330
|
return { error: MISSING_DRAW_DEFINITION };
|
|
42331
|
+
var _c = allDrawMatchUps$1({
|
|
42332
|
+
inContext: true,
|
|
42333
|
+
drawDefinition: drawDefinition,
|
|
42334
|
+
}), matchUps = _c.matchUps, matchUpsMap = _c.matchUpsMap;
|
|
42308
42335
|
// positions which are being played off by existing structure(s)
|
|
42309
|
-
var
|
|
42336
|
+
var _d = getPositionsPlayedOff({
|
|
42310
42337
|
drawDefinition: drawDefinition,
|
|
42311
|
-
|
|
42338
|
+
matchUpsMap: matchUpsMap,
|
|
42339
|
+
}), positionsNotPlayedOff = _d.positionsNotPlayedOff, positionsPlayedOff = _d.positionsPlayedOff;
|
|
42312
42340
|
var structures = getDrawStructures({ drawDefinition: drawDefinition }).structures;
|
|
42313
42341
|
var filteredStructures = structures.filter(function (structure) {
|
|
42314
42342
|
return (!structureId && structure.stage !== VOLUNTARY_CONSOLATION) ||
|
|
42315
42343
|
structure.structureId === structureId;
|
|
42316
42344
|
});
|
|
42317
42345
|
var available = {};
|
|
42318
|
-
var matchUps = allDrawMatchUps$1({
|
|
42319
|
-
inContext: true,
|
|
42320
|
-
drawDefinition: drawDefinition,
|
|
42321
|
-
}).matchUps;
|
|
42322
42346
|
try {
|
|
42323
42347
|
for (var filteredStructures_1 = __values(filteredStructures), filteredStructures_1_1 = filteredStructures_1.next(); !filteredStructures_1_1.done; filteredStructures_1_1 = filteredStructures_1.next()) {
|
|
42324
42348
|
var structure = filteredStructures_1_1.value;
|
|
@@ -46881,12 +46905,12 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
46881
46905
|
// not for use when generating structures from qualifyingProfiles
|
|
46882
46906
|
function generateQualifyingStructure$1(params) {
|
|
46883
46907
|
var _a;
|
|
46884
|
-
var _b, _c, _d, _e;
|
|
46908
|
+
var _b, _c, _d, _e, _f;
|
|
46885
46909
|
if (!params.drawDefinition)
|
|
46886
46910
|
return { error: MISSING_DRAW_DEFINITION };
|
|
46887
46911
|
var stack = 'generateQualifyingStructure';
|
|
46888
|
-
var drawSize = params.drawSize
|
|
46889
|
-
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;
|
|
46890
46914
|
var roundLimit, roundsCount, structure, matchUps;
|
|
46891
46915
|
var qualifiersCount = 0;
|
|
46892
46916
|
var finishingPositions;
|
|
@@ -46919,8 +46943,9 @@ function generateQualifyingStructure$1(params) {
|
|
|
46919
46943
|
var nextStageSequence = 2;
|
|
46920
46944
|
var chainModified = void 0;
|
|
46921
46945
|
while (!chainModified && nextStructureId_1) {
|
|
46946
|
+
console.log('check getRoundContextProfile preqQualifyingStageSequence');
|
|
46922
46947
|
targetStructure.stageSequence = nextStageSequence;
|
|
46923
|
-
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;
|
|
46924
46949
|
nextStructureId_1 = targetTargetStructureId;
|
|
46925
46950
|
nextStageSequence += 1;
|
|
46926
46951
|
if (!targetTargetStructureId) {
|
|
@@ -46948,14 +46973,13 @@ function generateQualifyingStructure$1(params) {
|
|
|
46948
46973
|
}
|
|
46949
46974
|
var roundTargetName = roundTarget ? "".concat(roundTarget, "-") : '';
|
|
46950
46975
|
var stageSequenceName = "".concat(stageSequence);
|
|
46951
|
-
var qualifyingStructureName = structureName ||
|
|
46952
|
-
(
|
|
46953
|
-
|
|
46954
|
-
: constantToString(QUALIFYING));
|
|
46976
|
+
var qualifyingStructureName = structureName !== null && structureName !== void 0 ? structureName : (roundTargetName || stageSequenceName
|
|
46977
|
+
? "".concat(constantToString(QUALIFYING), " ").concat(roundTargetName).concat(stageSequenceName)
|
|
46978
|
+
: constantToString(QUALIFYING));
|
|
46955
46979
|
if (drawType === ROUND_ROBIN) {
|
|
46956
|
-
var
|
|
46957
|
-
structureName: structureName
|
|
46958
|
-
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(),
|
|
46959
46983
|
stage: QUALIFYING,
|
|
46960
46984
|
structureOptions: structureOptions,
|
|
46961
46985
|
appliedPolicies: appliedPolicies,
|
|
@@ -46966,7 +46990,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
46966
46990
|
drawSize: drawSize,
|
|
46967
46991
|
isMock: isMock,
|
|
46968
46992
|
uuids: uuids,
|
|
46969
|
-
}), maxRoundNumber =
|
|
46993
|
+
}), maxRoundNumber = _g.maxRoundNumber /*, groupSize*/, structures = _g.structures, groupCount = _g.groupCount;
|
|
46970
46994
|
qualifiersCount = groupCount;
|
|
46971
46995
|
roundLimit = maxRoundNumber;
|
|
46972
46996
|
structure = structures[0];
|
|
@@ -46985,10 +47009,11 @@ function generateQualifyingStructure$1(params) {
|
|
|
46985
47009
|
if (!roundLimit)
|
|
46986
47010
|
roundLimit = roundsCount;
|
|
46987
47011
|
structure = structureTemplate({
|
|
46988
|
-
structureName: structureName
|
|
46989
|
-
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(),
|
|
46990
47014
|
qualifyingRoundNumber: roundLimit,
|
|
46991
47015
|
stage: QUALIFYING,
|
|
47016
|
+
matchUpFormat: matchUpFormat,
|
|
46992
47017
|
stageSequence: stageSequence,
|
|
46993
47018
|
matchUpType: matchUpType,
|
|
46994
47019
|
roundLimit: roundLimit,
|
|
@@ -47000,7 +47025,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
47000
47025
|
extension: { name: ROUND_TARGET, value: roundTarget },
|
|
47001
47026
|
});
|
|
47002
47027
|
}
|
|
47003
|
-
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;
|
|
47004
47029
|
}
|
|
47005
47030
|
// order of operations is important here!! finalQualifier positions is not yet updated when this step occurs
|
|
47006
47031
|
var linkType = drawType === ROUND_ROBIN ? LinkTypeEnum.Position : LinkTypeEnum.Winner;
|
|
@@ -47582,7 +47607,7 @@ function renameStructures$1(_a) {
|
|
|
47582
47607
|
}
|
|
47583
47608
|
|
|
47584
47609
|
function removeStructure(_a) {
|
|
47585
|
-
var _b, _c;
|
|
47610
|
+
var _b, _c, _d;
|
|
47586
47611
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, event = _a.event;
|
|
47587
47612
|
if (typeof structureId !== 'string')
|
|
47588
47613
|
return { error: INVALID_VALUES };
|
|
@@ -47597,13 +47622,16 @@ function removeStructure(_a) {
|
|
|
47597
47622
|
return stage === MAIN && stageSequence === 1;
|
|
47598
47623
|
});
|
|
47599
47624
|
var isMainStageSequence1 = structureId === mainStageSequence1.structureId;
|
|
47600
|
-
var
|
|
47625
|
+
var qualifyingStructureIds = structures
|
|
47626
|
+
.filter(function (_a) {
|
|
47601
47627
|
var stage = _a.stage;
|
|
47602
47628
|
return stage === QUALIFYING;
|
|
47603
|
-
})
|
|
47604
|
-
|
|
47629
|
+
})
|
|
47630
|
+
.map(extractAttributes('structureId'));
|
|
47631
|
+
if (isMainStageSequence1 && !qualifyingStructureIds.length) {
|
|
47605
47632
|
return { error: CANNOT_REMOVE_MAIN_STRUCTURE };
|
|
47606
47633
|
}
|
|
47634
|
+
var structureIds = structures.map(extractAttributes('structureId'));
|
|
47607
47635
|
var removedMatchUpIds = [];
|
|
47608
47636
|
var idsToRemove = [structureId];
|
|
47609
47637
|
var getTargetedStructureIds = function (structureId) {
|
|
@@ -47614,16 +47642,21 @@ function removeStructure(_a) {
|
|
|
47614
47642
|
link.target.structureId;
|
|
47615
47643
|
}).filter(Boolean);
|
|
47616
47644
|
};
|
|
47617
|
-
var
|
|
47618
|
-
var structureId = _a.structureId;
|
|
47619
|
-
return structureId;
|
|
47620
|
-
});
|
|
47621
|
-
var targetedStructureIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(structureIds.map(function (structureId) {
|
|
47645
|
+
var getQualifyingSourceStructureIds = function (structureId) {
|
|
47622
47646
|
var _a;
|
|
47623
|
-
return (_a = {
|
|
47624
|
-
|
|
47625
|
-
|
|
47626
|
-
|
|
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
|
+
});
|
|
47627
47660
|
var _loop_1 = function () {
|
|
47628
47661
|
var idBeingRemoved = idsToRemove.pop();
|
|
47629
47662
|
var structure = findStructure({
|
|
@@ -47646,11 +47679,13 @@ function removeStructure(_a) {
|
|
|
47646
47679
|
});
|
|
47647
47680
|
}
|
|
47648
47681
|
var targetedStructureIds = idBeingRemoved &&
|
|
47649
|
-
|
|
47682
|
+
(
|
|
47683
|
+
// targetedStructureIdsMap[idBeingRemoved].filter(
|
|
47684
|
+
(_d = relatedStructureIdsMap.get(idBeingRemoved)) === null || _d === void 0 ? void 0 : _d.filter(function (id) {
|
|
47650
47685
|
// IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
|
|
47651
47686
|
return id !== mainStageSequence1.structureId ||
|
|
47652
47687
|
structureId === mainStageSequence1.structureId;
|
|
47653
|
-
});
|
|
47688
|
+
}));
|
|
47654
47689
|
if (targetedStructureIds === null || targetedStructureIds === void 0 ? void 0 : targetedStructureIds.length)
|
|
47655
47690
|
idsToRemove.push.apply(idsToRemove, __spreadArray([], __read(targetedStructureIds), false));
|
|
47656
47691
|
};
|
|
@@ -48478,8 +48513,8 @@ function isUngrouped(entryStatus) {
|
|
|
48478
48513
|
|
|
48479
48514
|
function modifyEntriesStatus(_a) {
|
|
48480
48515
|
var e_1, _b, e_2, _c;
|
|
48481
|
-
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
48482
|
-
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
|
|
48483
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)
|
|
48484
48519
|
eventSync = _a.eventSync, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
48485
48520
|
if (!participantIds || !Array.isArray(participantIds))
|
|
@@ -48521,7 +48556,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48521
48556
|
}).assignedParticipantIds) !== null && _a !== void 0 ? _a : [];
|
|
48522
48557
|
assignedParticipantIds.push.apply(assignedParticipantIds, __spreadArray([], __read(participantIds), false));
|
|
48523
48558
|
});
|
|
48524
|
-
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 : [];
|
|
48525
48560
|
var validEntryStatusForAllParticipantIds = participantIds.every(function (participantId) {
|
|
48526
48561
|
var _a;
|
|
48527
48562
|
var participantType = (_a = findParticipant({
|
|
@@ -48540,7 +48575,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48540
48575
|
if (!validEntryStatusForAllParticipantIds)
|
|
48541
48576
|
return { error: INVALID_ENTRY_STATUS };
|
|
48542
48577
|
var flightProfile = event && getFlightProfile({ event: event }).flightProfile;
|
|
48543
|
-
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; });
|
|
48544
48579
|
// ------------------------------------------------------------------------
|
|
48545
48580
|
// reusable functions
|
|
48546
48581
|
var updateEntryStatus = function (entries) {
|
|
@@ -48587,10 +48622,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48587
48622
|
? __assign({}, SUCCESS) : { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
48588
48623
|
};
|
|
48589
48624
|
var autoPosition = function (_a) {
|
|
48625
|
+
var _b;
|
|
48590
48626
|
var flight = _a.flight, drawDefinition = _a.drawDefinition;
|
|
48591
48627
|
if (event) {
|
|
48592
48628
|
event.entries = refreshEntryPositions({
|
|
48593
|
-
entries: event.entries
|
|
48629
|
+
entries: (_b = event.entries) !== null && _b !== void 0 ? _b : [],
|
|
48594
48630
|
});
|
|
48595
48631
|
}
|
|
48596
48632
|
if (flight) {
|
|
@@ -48623,18 +48659,17 @@ function modifyEntriesStatus(_a) {
|
|
|
48623
48659
|
};
|
|
48624
48660
|
// ------------------------------------------------------------------------
|
|
48625
48661
|
// before modifying, if autoEntryPositions: true, pre-assign entryPositions
|
|
48626
|
-
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) {
|
|
48627
48666
|
var entryPosition = _a.entryPosition;
|
|
48628
48667
|
return entryPosition;
|
|
48629
48668
|
})) ||
|
|
48630
|
-
((
|
|
48631
|
-
var entryPosition = _a.entryPosition;
|
|
48632
|
-
return entryPosition;
|
|
48633
|
-
})) ||
|
|
48634
|
-
((_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) {
|
|
48635
48670
|
var entryPosition = _a.entryPosition;
|
|
48636
48671
|
return entryPosition;
|
|
48637
|
-
}));
|
|
48672
|
+
})));
|
|
48638
48673
|
if (autoEntryPositions && !entryPositionsExist)
|
|
48639
48674
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48640
48675
|
// ------------------------------------------------------------------------
|
|
@@ -48646,11 +48681,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48646
48681
|
}
|
|
48647
48682
|
// ------------------------------------------------------------------------
|
|
48648
48683
|
// update any flights which have no draw generated to keep entries in sync
|
|
48649
|
-
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) {
|
|
48650
48685
|
var drawId = _a.drawId;
|
|
48651
48686
|
return drawId;
|
|
48652
|
-
}))
|
|
48653
|
-
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); })) || [];
|
|
48654
48689
|
try {
|
|
48655
48690
|
for (var flightsNoDraw_1 = __values(flightsNoDraw), flightsNoDraw_1_1 = flightsNoDraw_1.next(); !flightsNoDraw_1_1.done; flightsNoDraw_1_1 = flightsNoDraw_1.next()) {
|
|
48656
48691
|
var flight_1 = flightsNoDraw_1_1.value;
|
|
@@ -48667,8 +48702,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48667
48702
|
finally { if (e_1) throw e_1.error; }
|
|
48668
48703
|
}
|
|
48669
48704
|
// ------------------------------------------------------------------------
|
|
48670
|
-
var singleDraw = ((
|
|
48671
|
-
(((
|
|
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);
|
|
48672
48707
|
if (!flight &&
|
|
48673
48708
|
!drawDefinition &&
|
|
48674
48709
|
entryStatus &&
|
|
@@ -48685,7 +48720,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48685
48720
|
return decorateResult({ result: result, stack: stack });
|
|
48686
48721
|
var error_1;
|
|
48687
48722
|
if (entryStatus === WITHDRAWN) {
|
|
48688
|
-
(
|
|
48723
|
+
(_t = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _t === void 0 ? void 0 : _t.every(function (flight) {
|
|
48689
48724
|
var result = updateEntryStatus(flight.drawEntries);
|
|
48690
48725
|
if (result.error) {
|
|
48691
48726
|
error_1 = result.error;
|
|
@@ -48697,7 +48732,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48697
48732
|
});
|
|
48698
48733
|
return true;
|
|
48699
48734
|
});
|
|
48700
|
-
(
|
|
48735
|
+
(_u = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _u === void 0 ? void 0 : _u.every(function (drawDefinition) {
|
|
48701
48736
|
var _a;
|
|
48702
48737
|
var result = updateEntryStatus(drawDefinition.entries);
|
|
48703
48738
|
if (result.error) {
|
|
@@ -48717,8 +48752,8 @@ function modifyEntriesStatus(_a) {
|
|
|
48717
48752
|
if (autoEntryPositions)
|
|
48718
48753
|
autoPosition({ flight: flight, drawDefinition: drawDefinition });
|
|
48719
48754
|
try {
|
|
48720
|
-
for (var
|
|
48721
|
-
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;
|
|
48722
48757
|
if (modifiedDrawIds.length &&
|
|
48723
48758
|
!modifiedDrawIds.includes(drawDefinition_1.drawId))
|
|
48724
48759
|
continue;
|
|
@@ -48732,7 +48767,7 @@ function modifyEntriesStatus(_a) {
|
|
|
48732
48767
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
48733
48768
|
finally {
|
|
48734
48769
|
try {
|
|
48735
|
-
if (
|
|
48770
|
+
if (_y && !_y.done && (_c = _x.return)) _c.call(_x);
|
|
48736
48771
|
}
|
|
48737
48772
|
finally { if (e_2) throw e_2.error; }
|
|
48738
48773
|
}
|
|
@@ -49020,8 +49055,8 @@ function participantInFlightEntries(_a) {
|
|
|
49020
49055
|
}
|
|
49021
49056
|
|
|
49022
49057
|
function removeEventEntries(_a) {
|
|
49023
|
-
var _b, _c, _d, _e, _f;
|
|
49024
|
-
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;
|
|
49025
49060
|
var stack = 'removeEventEntries';
|
|
49026
49061
|
if (!(event === null || event === void 0 ? void 0 : event.eventId))
|
|
49027
49062
|
return { error: MISSING_EVENT };
|
|
@@ -49071,7 +49106,7 @@ function removeEventEntries(_a) {
|
|
|
49071
49106
|
if (!(participantIds === null || participantIds === void 0 ? void 0 : participantIds.length))
|
|
49072
49107
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: [] });
|
|
49073
49108
|
var participantIdsRemoved = [];
|
|
49074
|
-
event.entries = (event.entries
|
|
49109
|
+
event.entries = ((_e = event.entries) !== null && _e !== void 0 ? _e : []).filter(function (entry) {
|
|
49075
49110
|
var keepEntry = !participantIds.includes(entry === null || entry === void 0 ? void 0 : entry.participantId);
|
|
49076
49111
|
if (!keepEntry)
|
|
49077
49112
|
participantIdsRemoved.push(entry.participantId);
|
|
@@ -49084,11 +49119,12 @@ function removeEventEntries(_a) {
|
|
|
49084
49119
|
}
|
|
49085
49120
|
// also remove entry from all flights and drawDefinitions
|
|
49086
49121
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
49087
|
-
(
|
|
49122
|
+
(_f = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _f === void 0 ? void 0 : _f.forEach(function (flight) {
|
|
49088
49123
|
flight.drawEntries = (flight.drawEntries || []).filter(function (entry) { return !participantIds.includes(entry.participantId); });
|
|
49089
49124
|
});
|
|
49090
|
-
(
|
|
49091
|
-
|
|
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); });
|
|
49092
49128
|
});
|
|
49093
49129
|
return __assign(__assign({}, SUCCESS), { participantIdsRemoved: participantIdsRemoved });
|
|
49094
49130
|
}
|
|
@@ -49265,6 +49301,7 @@ function addEventEntries(params) {
|
|
|
49265
49301
|
|
|
49266
49302
|
function removeIndividualParticipantIds(_a) {
|
|
49267
49303
|
var e_1, _b;
|
|
49304
|
+
var _c, _d, _e;
|
|
49268
49305
|
var addIndividualParticipantsToEvents = _a.addIndividualParticipantsToEvents, individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, tournamentRecord = _a.tournamentRecord, suppressErrors = _a.suppressErrors;
|
|
49269
49306
|
var stack = 'removeIndividualParticipantIds';
|
|
49270
49307
|
if (!tournamentRecord)
|
|
@@ -49274,7 +49311,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49274
49311
|
});
|
|
49275
49312
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
49276
49313
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
49277
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49314
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
49278
49315
|
var groupingParticipant = tournamentParticipants.find(function (participant) {
|
|
49279
49316
|
return participant.participantId === groupingParticipantId;
|
|
49280
49317
|
});
|
|
@@ -49300,7 +49337,7 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49300
49337
|
return decorateResult({ result: result, stack: stack });
|
|
49301
49338
|
if (addIndividualParticipantsToEvents) {
|
|
49302
49339
|
var _loop_1 = function (event_1) {
|
|
49303
|
-
var enteredIds = (event_1.entries
|
|
49340
|
+
var enteredIds = ((_e = event_1.entries) !== null && _e !== void 0 ? _e : [])
|
|
49304
49341
|
.map(function (_a) {
|
|
49305
49342
|
var participantId = _a.participantId;
|
|
49306
49343
|
return participantId;
|
|
@@ -49317,15 +49354,15 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49317
49354
|
}
|
|
49318
49355
|
};
|
|
49319
49356
|
try {
|
|
49320
|
-
for (var
|
|
49321
|
-
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;
|
|
49322
49359
|
_loop_1(event_1);
|
|
49323
49360
|
}
|
|
49324
49361
|
}
|
|
49325
49362
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
49326
49363
|
finally {
|
|
49327
49364
|
try {
|
|
49328
|
-
if (
|
|
49365
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
49329
49366
|
}
|
|
49330
49367
|
finally { if (e_1) throw e_1.error; }
|
|
49331
49368
|
}
|
|
@@ -49343,8 +49380,8 @@ function removeIndividualParticipantIds(_a) {
|
|
|
49343
49380
|
}
|
|
49344
49381
|
function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
49345
49382
|
var _b;
|
|
49346
|
-
var _c;
|
|
49347
|
-
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;
|
|
49348
49385
|
var removed = [];
|
|
49349
49386
|
if (!groupingParticipant)
|
|
49350
49387
|
return { removed: removed };
|
|
@@ -49365,9 +49402,9 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49365
49402
|
var eventId = _a.eventId;
|
|
49366
49403
|
return eventId;
|
|
49367
49404
|
});
|
|
49368
|
-
var updatedIndividualParticipantIds = (groupingParticipant.individualParticipantIds
|
|
49405
|
+
var updatedIndividualParticipantIds = ((_d = groupingParticipant.individualParticipantIds) !== null && _d !== void 0 ? _d : []).filter(function (participantId) {
|
|
49369
49406
|
var e_2, _a, e_3, _b, e_4, _c, e_5, _d;
|
|
49370
|
-
var _e;
|
|
49407
|
+
var _e, _f, _g, _h, _j, _k;
|
|
49371
49408
|
var targetParticipant = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.includes(participantId);
|
|
49372
49409
|
var scoredParticipantGroupingMatchUps = targetParticipant &&
|
|
49373
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) {
|
|
@@ -49387,31 +49424,30 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49387
49424
|
if (removeParticipant) {
|
|
49388
49425
|
removed.push(participantId);
|
|
49389
49426
|
try {
|
|
49390
|
-
for (var
|
|
49391
|
-
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;
|
|
49392
49429
|
try {
|
|
49393
|
-
for (var
|
|
49394
|
-
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;
|
|
49395
49432
|
var extension = findExtension$2({
|
|
49396
49433
|
element: drawDefinition,
|
|
49397
49434
|
name: LINEUPS,
|
|
49398
49435
|
}).extension;
|
|
49399
49436
|
var lineUp = extension === null || extension === void 0 ? void 0 : extension.value[groupingParticipant.participantId];
|
|
49400
49437
|
if (extension && lineUp) {
|
|
49401
|
-
|
|
49438
|
+
extension.value[groupingParticipant.participantId] = lineUp.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
49402
49439
|
addExtension$1({ element: drawDefinition, extension: extension });
|
|
49403
49440
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
49404
49441
|
}
|
|
49405
|
-
var matchUps = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps
|
|
49406
|
-
[];
|
|
49442
|
+
var matchUps = (_h = allDrawMatchUps$1({ drawDefinition: drawDefinition, inContext: false }).matchUps) !== null && _h !== void 0 ? _h : [];
|
|
49407
49443
|
try {
|
|
49408
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()) {
|
|
49409
49445
|
var matchUp = matchUps_1_1.value;
|
|
49410
|
-
var sides = matchUp.sides
|
|
49446
|
+
var sides = (_j = matchUp.sides) !== null && _j !== void 0 ? _j : [];
|
|
49411
49447
|
try {
|
|
49412
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()) {
|
|
49413
49449
|
var side = sides_1_1.value;
|
|
49414
|
-
var lineUp_1 = side.lineUp
|
|
49450
|
+
var lineUp_1 = (_k = side.lineUp) !== null && _k !== void 0 ? _k : [];
|
|
49415
49451
|
var containsParticipant = lineUp_1.find(function (assignment) { return assignment.participantId === participantId; });
|
|
49416
49452
|
if (containsParticipant) {
|
|
49417
49453
|
side.lineUp = lineUp_1.filter(function (assignment) { return assignment.participantId !== participantId; });
|
|
@@ -49444,7 +49480,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49444
49480
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
49445
49481
|
finally {
|
|
49446
49482
|
try {
|
|
49447
|
-
if (
|
|
49483
|
+
if (_p && !_p.done && (_b = _o.return)) _b.call(_o);
|
|
49448
49484
|
}
|
|
49449
49485
|
finally { if (e_3) throw e_3.error; }
|
|
49450
49486
|
}
|
|
@@ -49453,7 +49489,7 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49453
49489
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
49454
49490
|
finally {
|
|
49455
49491
|
try {
|
|
49456
|
-
if (
|
|
49492
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
49457
49493
|
}
|
|
49458
49494
|
finally { if (e_2) throw e_2.error; }
|
|
49459
49495
|
}
|
|
@@ -49476,15 +49512,16 @@ function removeParticipantIdsFromGroupingParticipant(_a) {
|
|
|
49476
49512
|
result);
|
|
49477
49513
|
}
|
|
49478
49514
|
function removeParticipantIdsFromAllTeams(_a) {
|
|
49479
|
-
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;
|
|
49480
49517
|
if (!tournamentRecord)
|
|
49481
49518
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
49482
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49483
|
-
var
|
|
49519
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49520
|
+
var _f = getParticipants$1({
|
|
49484
49521
|
withMatchUps: true,
|
|
49485
49522
|
tournamentRecord: tournamentRecord,
|
|
49486
49523
|
withEvents: true,
|
|
49487
|
-
}), participants =
|
|
49524
|
+
}), participants = _f.participants, mappedMatchUps = _f.mappedMatchUps;
|
|
49488
49525
|
var modifications = 0;
|
|
49489
49526
|
tournamentParticipants
|
|
49490
49527
|
.filter(function (participant) {
|
|
@@ -49539,10 +49576,11 @@ function deleteParticipants(params) {
|
|
|
49539
49576
|
withDraws: true,
|
|
49540
49577
|
}).participants) !== null && _f !== void 0 ? _f : [];
|
|
49541
49578
|
var getPlacedPairParticipantIds = function () {
|
|
49542
|
-
var
|
|
49579
|
+
var _a;
|
|
49580
|
+
var matchUps = (_a = allTournamentMatchUps({
|
|
49543
49581
|
matchUpFilters: { drawIds: teamDrawIds, matchUpTypes: [DOUBLES$1] },
|
|
49544
49582
|
tournamentRecord: tournamentRecord,
|
|
49545
|
-
}).matchUps
|
|
49583
|
+
}).matchUps) !== null && _a !== void 0 ? _a : [];
|
|
49546
49584
|
var placedPairParticipantIds = matchUps
|
|
49547
49585
|
.map(function (_a) {
|
|
49548
49586
|
var sides = _a.sides;
|
|
@@ -49698,7 +49736,7 @@ function getStageEntries(_a) {
|
|
|
49698
49736
|
}
|
|
49699
49737
|
|
|
49700
49738
|
function destroyGroupEntry(_a) {
|
|
49701
|
-
var _b;
|
|
49739
|
+
var _b, _c, _d;
|
|
49702
49740
|
var removeGroupParticipant = _a.removeGroupParticipant, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, participantId = _a.participantId, drawId = _a.drawId, stage = _a.stage, event = _a.event;
|
|
49703
49741
|
var stack = 'destroyGroupEntry';
|
|
49704
49742
|
if (!tournamentRecord)
|
|
@@ -49711,7 +49749,7 @@ function destroyGroupEntry(_a) {
|
|
|
49711
49749
|
![TypeEnum.Doubles, TypeEnum.Team].includes(event.eventType)) {
|
|
49712
49750
|
return decorateResult({ result: { error: INVALID_EVENT_TYPE }, stack: stack });
|
|
49713
49751
|
}
|
|
49714
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
49752
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
49715
49753
|
var participant = tournamentParticipants.find(function (participant) { return participant.participantId === participantId; });
|
|
49716
49754
|
if (!participant) {
|
|
49717
49755
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -49722,7 +49760,7 @@ function destroyGroupEntry(_a) {
|
|
|
49722
49760
|
(participant.participantType === PAIR && event.eventType !== DOUBLES)) {
|
|
49723
49761
|
return { error: INVALID_PARTICIPANT_TYPE };
|
|
49724
49762
|
}
|
|
49725
|
-
var eventEntries = event.entries
|
|
49763
|
+
var eventEntries = (_c = event.entries) !== null && _c !== void 0 ? _c : [];
|
|
49726
49764
|
var entry = eventEntries.find(function (entry) { return entry.participantId === participantId; });
|
|
49727
49765
|
if (!entry)
|
|
49728
49766
|
return { error: PARTICIPANT_ENTRY_NOT_FOUND };
|
|
@@ -49747,10 +49785,9 @@ function destroyGroupEntry(_a) {
|
|
|
49747
49785
|
.filter(Boolean);
|
|
49748
49786
|
// find only those individualParticipantIds which do not occur MULTIPLE TIMES in PAIRs/GROUPs in the event.entries or drawEntries
|
|
49749
49787
|
// this scenario can occur in e.g. ITA tournaments where an individual participant is paired multiple times across flights
|
|
49750
|
-
var individualParticipantIds = (
|
|
49788
|
+
var individualParticipantIds = (_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.filter(function (participantId) {
|
|
49751
49789
|
return arrayIndices(participantId, individualParticipantIdsInGroups).length === 1;
|
|
49752
49790
|
});
|
|
49753
|
-
// const individualParticipantIds = participant.individualParticipantIds;
|
|
49754
49791
|
// remove the group participant from event entries
|
|
49755
49792
|
var result = removeEventEntries({
|
|
49756
49793
|
participantIds: [participantId],
|
|
@@ -49821,16 +49858,6 @@ function destroyPairEntries(params) {
|
|
|
49821
49858
|
return destroyedCount ? __assign({ destroyedCount: destroyedCount }, SUCCESS) : { error: errors };
|
|
49822
49859
|
}
|
|
49823
49860
|
|
|
49824
|
-
/**
|
|
49825
|
-
*
|
|
49826
|
-
* @param {string} drawId - id of drawDefinition within which structure is found
|
|
49827
|
-
* @param {string} structureId - id of structure of drawPosition
|
|
49828
|
-
* @param {number} drawPosition - number of drawPosition for which actions are to be returned
|
|
49829
|
-
* @param {boolean} replaceWithBye - boolean whether or not to replace with BYE
|
|
49830
|
-
* @param {boolean} destroyPair - if { participantType: PAIR } it is possible to destroy pair entry before modifying entryStatus
|
|
49831
|
-
* @param {string} entryStatus - change the entry status of the removed participant to either ALTERNATE or WITHDRAWN
|
|
49832
|
-
*
|
|
49833
|
-
*/
|
|
49834
49861
|
function removeDrawPositionAssignment(params) {
|
|
49835
49862
|
var tournamentRecord = params.tournamentRecord, replaceWithBye = params.replaceWithBye, drawDefinition = params.drawDefinition, destroyPair = params.destroyPair, entryStatus = params.entryStatus, matchUpsMap = params.matchUpsMap, drawId = params.drawId;
|
|
49836
49863
|
var stack = 'removeDrawPositionAssignment';
|
|
@@ -49845,7 +49872,7 @@ function removeDrawPositionAssignment(params) {
|
|
|
49845
49872
|
tournamentRecord: tournamentRecord_1,
|
|
49846
49873
|
participantId: participantId,
|
|
49847
49874
|
}).participant;
|
|
49848
|
-
var _a = participant
|
|
49875
|
+
var _a = participant !== null && participant !== void 0 ? participant : {}, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
49849
49876
|
if (destroyPair && participantType === PAIR) {
|
|
49850
49877
|
var result_1 = destroyPairEntry({
|
|
49851
49878
|
tournamentRecord: tournamentRecord_1,
|
|
@@ -53767,13 +53794,14 @@ function getEligibleVoluntaryConsolationParticipants(params) {
|
|
|
53767
53794
|
}
|
|
53768
53795
|
|
|
53769
53796
|
function getParticipantEventDetails(_a) {
|
|
53797
|
+
var _b, _c;
|
|
53770
53798
|
var tournamentRecord = _a.tournamentRecord, participantId = _a.participantId;
|
|
53771
53799
|
if (!tournamentRecord)
|
|
53772
53800
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53773
53801
|
if (!participantId)
|
|
53774
53802
|
return { error: MISSING_PARTICIPANT_ID };
|
|
53775
53803
|
// relveantParticipantIds is the target participantId along with any TEAM or PAIR participantIds to which participantId belongs
|
|
53776
|
-
var relevantParticipantIds = [participantId].concat((tournamentRecord.participants
|
|
53804
|
+
var relevantParticipantIds = [participantId].concat(((_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [])
|
|
53777
53805
|
.filter(function (participant) {
|
|
53778
53806
|
var _a;
|
|
53779
53807
|
return (participant === null || participant === void 0 ? void 0 : participant.participantType) &&
|
|
@@ -53781,9 +53809,10 @@ function getParticipantEventDetails(_a) {
|
|
|
53781
53809
|
((_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId));
|
|
53782
53810
|
})
|
|
53783
53811
|
.map(function (participant) { return participant.participantId; }));
|
|
53784
|
-
var relevantEvents = (tournamentRecord.events
|
|
53812
|
+
var relevantEvents = ((_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [])
|
|
53785
53813
|
.filter(function (event) {
|
|
53786
|
-
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; });
|
|
53787
53816
|
return overlap(enteredParticipantIds, relevantParticipantIds);
|
|
53788
53817
|
})
|
|
53789
53818
|
.map(function (event) { return ({ eventName: event.eventName, eventId: event.eventId }); });
|
|
@@ -53812,6 +53841,7 @@ function getDerivedPositionAssignments(_a) {
|
|
|
53812
53841
|
}
|
|
53813
53842
|
|
|
53814
53843
|
function getRelevantParticipantIdsMap(_a) {
|
|
53844
|
+
var _b;
|
|
53815
53845
|
var processParticipantId = _a.processParticipantId, // optional method which is passed each participantId
|
|
53816
53846
|
tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord;
|
|
53817
53847
|
if (typeof tournamentRecord !== 'object' &&
|
|
@@ -53823,7 +53853,7 @@ function getRelevantParticipantIdsMap(_a) {
|
|
|
53823
53853
|
? Object.values(tournamentRecords)
|
|
53824
53854
|
.map(function (tournamentRecord) { return (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || []; })
|
|
53825
53855
|
.flat()
|
|
53826
|
-
: (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 : [];
|
|
53827
53857
|
var relevantParticipantIdsMap = Object.assign.apply(Object, __spreadArray([{}], __read(allParticipants.map(function (_a) {
|
|
53828
53858
|
var _b;
|
|
53829
53859
|
var participantId = _a.participantId, participantType = _a.participantType, individualParticipantIds = _a.individualParticipantIds;
|
|
@@ -53901,21 +53931,21 @@ function participantScheduledMatchUps(_a) {
|
|
|
53901
53931
|
|
|
53902
53932
|
function annotateParticipant(params) {
|
|
53903
53933
|
var e_1, _a, e_2, _b;
|
|
53904
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
53905
|
-
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;
|
|
53906
53936
|
var scheduleConflicts = [];
|
|
53907
53937
|
var scheduleItems = [];
|
|
53908
53938
|
if (withIOC || withISO2)
|
|
53909
53939
|
addNationalityCode({ participant: participant, withIOC: withIOC, withISO2: withISO2 });
|
|
53910
53940
|
if (withScaleValues) {
|
|
53911
|
-
var
|
|
53941
|
+
var _t = getScaleValues({ participant: participant }), ratings = _t.ratings, rankings = _t.rankings;
|
|
53912
53942
|
participant.rankings = rankings;
|
|
53913
53943
|
participant.ratings = ratings;
|
|
53914
53944
|
}
|
|
53915
53945
|
var participantId = participant === null || participant === void 0 ? void 0 : participant.participantId;
|
|
53916
53946
|
if (!participantId || !participantIdMap[participantId])
|
|
53917
53947
|
return {};
|
|
53918
|
-
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;
|
|
53919
53949
|
var denominator = wins + losses;
|
|
53920
53950
|
var numerator = wins;
|
|
53921
53951
|
var statValue = denominator && numerator / denominator;
|
|
@@ -53973,7 +54003,7 @@ function annotateParticipant(params) {
|
|
|
53973
54003
|
_b);
|
|
53974
54004
|
})), false));
|
|
53975
54005
|
var _loop_1 = function (participantEvent) {
|
|
53976
|
-
var e_3,
|
|
54006
|
+
var e_3, _v, e_4, _w, e_5, _x;
|
|
53977
54007
|
var getScaleAccessor = function (scaleName) {
|
|
53978
54008
|
return [SCALE$1, SEEDING$1, participantEvent.eventType, scaleName].join('.');
|
|
53979
54009
|
};
|
|
@@ -54025,15 +54055,15 @@ function annotateParticipant(params) {
|
|
|
54025
54055
|
participantEvent.seedAssignments = seedAssignments;
|
|
54026
54056
|
}
|
|
54027
54057
|
else {
|
|
54028
|
-
var
|
|
54058
|
+
var _y = participantEvent.category || {}, categoryName = _y.categoryName, ageCategoryCode = _y.ageCategoryCode;
|
|
54029
54059
|
var scaleItem = void 0;
|
|
54030
54060
|
try {
|
|
54031
|
-
for (var
|
|
54061
|
+
for (var _z = (e_3 = void 0, __values([
|
|
54032
54062
|
participantEvent.eventId,
|
|
54033
54063
|
ageCategoryCode,
|
|
54034
54064
|
categoryName,
|
|
54035
|
-
])),
|
|
54036
|
-
var scaleName =
|
|
54065
|
+
])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
54066
|
+
var scaleName = _0.value;
|
|
54037
54067
|
var scaleAttributes = {
|
|
54038
54068
|
eventType: participantEvent.eventType,
|
|
54039
54069
|
scaleType: SEEDING$1,
|
|
@@ -54052,7 +54082,7 @@ function annotateParticipant(params) {
|
|
|
54052
54082
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
54053
54083
|
finally {
|
|
54054
54084
|
try {
|
|
54055
|
-
if (
|
|
54085
|
+
if (_0 && !_0.done && (_v = _z.return)) _v.call(_z);
|
|
54056
54086
|
}
|
|
54057
54087
|
finally { if (e_3) throw e_3.error; }
|
|
54058
54088
|
}
|
|
@@ -54069,8 +54099,8 @@ function annotateParticipant(params) {
|
|
|
54069
54099
|
}
|
|
54070
54100
|
if ((_k = participantEvent.drawIds) === null || _k === void 0 ? void 0 : _k.length) {
|
|
54071
54101
|
try {
|
|
54072
|
-
for (var
|
|
54073
|
-
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;
|
|
54074
54104
|
var drawSeedPublishingDisabled = ((_l = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _l === void 0 ? void 0 : _l.length) &&
|
|
54075
54105
|
!((_m = publishedSeeding === null || publishedSeeding === void 0 ? void 0 : publishedSeeding.drawIds) === null || _m === void 0 ? void 0 : _m.includes(flightDrawId));
|
|
54076
54106
|
if (eventSeedingPublished && !drawSeedPublishingDisabled) {
|
|
@@ -54082,15 +54112,15 @@ function annotateParticipant(params) {
|
|
|
54082
54112
|
// preserve filtering of MAIN/QUALIFYING seedValues, if present
|
|
54083
54113
|
if (seedAssignments && participantEvent.seedAssignments) {
|
|
54084
54114
|
try {
|
|
54085
|
-
for (var
|
|
54086
|
-
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;
|
|
54087
54117
|
participantEvent.seedAssignments[key] = seedAssignments[key];
|
|
54088
54118
|
}
|
|
54089
54119
|
}
|
|
54090
54120
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
54091
54121
|
finally {
|
|
54092
54122
|
try {
|
|
54093
|
-
if (
|
|
54123
|
+
if (_4 && !_4.done && (_x = _3.return)) _x.call(_3);
|
|
54094
54124
|
}
|
|
54095
54125
|
finally { if (e_5) throw e_5.error; }
|
|
54096
54126
|
}
|
|
@@ -54104,7 +54134,7 @@ function annotateParticipant(params) {
|
|
|
54104
54134
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
54105
54135
|
finally {
|
|
54106
54136
|
try {
|
|
54107
|
-
if (
|
|
54137
|
+
if (_2 && !_2.done && (_w = _1.return)) _w.call(_1);
|
|
54108
54138
|
}
|
|
54109
54139
|
finally { if (e_4) throw e_4.error; }
|
|
54110
54140
|
}
|
|
@@ -54140,9 +54170,9 @@ function annotateParticipant(params) {
|
|
|
54140
54170
|
}
|
|
54141
54171
|
var allParticipantMatchUps = participantMatchUps.concat(participantPotentialMatchUps);
|
|
54142
54172
|
// scheduledMatchUps are a participant's matchUps separated by date and sorted by scheduledTime
|
|
54143
|
-
var scheduledMatchUps = ((_o = participantScheduledMatchUps({
|
|
54173
|
+
var scheduledMatchUps = (_p = (_o = participantScheduledMatchUps({
|
|
54144
54174
|
matchUps: allParticipantMatchUps,
|
|
54145
|
-
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps)
|
|
54175
|
+
})) === null || _o === void 0 ? void 0 : _o.scheduledMatchUps) !== null && _p !== void 0 ? _p : [];
|
|
54146
54176
|
var scheduledMinutesDifference = (scheduleAnalysis || {}).scheduledMinutesDifference;
|
|
54147
54177
|
var dates = Object.keys(scheduledMatchUps);
|
|
54148
54178
|
dates.forEach(function (date) {
|
|
@@ -54968,7 +54998,7 @@ function getParticipantMembership(_a) {
|
|
|
54968
54998
|
participantFilters: { participantTypes: [TEAM, PAIR, GROUP] },
|
|
54969
54999
|
tournamentRecord: tournamentRecord,
|
|
54970
55000
|
}).participants;
|
|
54971
|
-
var memberOf = (participants
|
|
55001
|
+
var memberOf = (participants !== null && participants !== void 0 ? participants : []).filter(function (participant) {
|
|
54972
55002
|
var _a;
|
|
54973
55003
|
return (_a = participant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a.includes(participantId);
|
|
54974
55004
|
});
|
|
@@ -54985,16 +55015,17 @@ function getParticipantMembership(_a) {
|
|
|
54985
55015
|
|
|
54986
55016
|
function getParticipantSchedules(_a) {
|
|
54987
55017
|
var e_1, _b;
|
|
54988
|
-
var _c
|
|
55018
|
+
var _c, _d, _e;
|
|
55019
|
+
var _f = _a.participantFilters, participantFilters = _f === void 0 ? {} : _f, tournamentRecord = _a.tournamentRecord;
|
|
54989
55020
|
if (!tournamentRecord)
|
|
54990
55021
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
54991
55022
|
if (typeof participantFilters !== 'object')
|
|
54992
55023
|
return { error: INVALID_OBJECT, context: { participantFilters: participantFilters } };
|
|
54993
55024
|
var contextFilters = { eventIds: participantFilters.eventIds };
|
|
54994
|
-
var matchUps = allTournamentMatchUps({
|
|
55025
|
+
var matchUps = (_c = allTournamentMatchUps({
|
|
54995
55026
|
tournamentRecord: tournamentRecord,
|
|
54996
55027
|
contextFilters: contextFilters,
|
|
54997
|
-
}).matchUps
|
|
55028
|
+
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
54998
55029
|
var matchUpsMap = Object.assign.apply(Object, __spreadArray([{}], __read(matchUps.map(function (matchUp) {
|
|
54999
55030
|
var _a;
|
|
55000
55031
|
return (_a = {}, _a[matchUp.matchUpId] = matchUp, _a);
|
|
@@ -55003,33 +55034,31 @@ function getParticipantSchedules(_a) {
|
|
|
55003
55034
|
var schedule = _a.schedule;
|
|
55004
55035
|
return schedule && Object.keys(schedule).length;
|
|
55005
55036
|
});
|
|
55006
|
-
var sourceMatchUpIds = getMatchUpDependencies({
|
|
55037
|
+
var sourceMatchUpIds = (_d = getMatchUpDependencies({
|
|
55007
55038
|
tournamentRecord: tournamentRecord,
|
|
55008
55039
|
matchUps: matchUps,
|
|
55009
|
-
}).sourceMatchUpIds
|
|
55040
|
+
}).sourceMatchUpIds) !== null && _d !== void 0 ? _d : [];
|
|
55010
55041
|
var participantAggregator = {};
|
|
55011
55042
|
var _loop_1 = function (matchUp) {
|
|
55012
|
-
var e_2,
|
|
55043
|
+
var e_2, _g, e_3, _h;
|
|
55013
55044
|
var sides = matchUp.sides;
|
|
55014
55045
|
var relevantSourceMatchUps;
|
|
55015
|
-
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) {
|
|
55016
55047
|
var _a;
|
|
55017
55048
|
if (side.participant) {
|
|
55018
55049
|
return (_a = [side.participant]).concat.apply(_a, __spreadArray([], __read((side.participant.individualParticipants || [])), false));
|
|
55019
55050
|
}
|
|
55020
|
-
else
|
|
55021
|
-
|
|
55022
|
-
|
|
55023
|
-
|
|
55024
|
-
|
|
55025
|
-
|
|
55026
|
-
|
|
55027
|
-
|
|
55028
|
-
});
|
|
55029
|
-
}
|
|
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
|
+
});
|
|
55030
55059
|
}
|
|
55031
55060
|
return undefined;
|
|
55032
|
-
}).filter(Boolean).flat())
|
|
55061
|
+
}).filter(Boolean).flat()) !== null && _e !== void 0 ? _e : [];
|
|
55033
55062
|
try {
|
|
55034
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()) {
|
|
55035
55064
|
var participant = participants_1_1.value;
|
|
@@ -55047,7 +55076,7 @@ function getParticipantSchedules(_a) {
|
|
|
55047
55076
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
55048
55077
|
finally {
|
|
55049
55078
|
try {
|
|
55050
|
-
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);
|
|
55051
55080
|
}
|
|
55052
55081
|
finally { if (e_2) throw e_2.error; }
|
|
55053
55082
|
}
|
|
@@ -55076,7 +55105,7 @@ function getParticipantSchedules(_a) {
|
|
|
55076
55105
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55077
55106
|
finally {
|
|
55078
55107
|
try {
|
|
55079
|
-
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);
|
|
55080
55109
|
}
|
|
55081
55110
|
finally { if (e_3) throw e_3.error; }
|
|
55082
55111
|
}
|
|
@@ -55147,8 +55176,8 @@ var participantRoles = {
|
|
|
55147
55176
|
// add persons to a tournamentRecord and create participants in the process
|
|
55148
55177
|
// include ability to specify a doubles partner by personId
|
|
55149
55178
|
function addPersons(_a) {
|
|
55150
|
-
var _b;
|
|
55151
|
-
var
|
|
55179
|
+
var _b, _c;
|
|
55180
|
+
var _d = _a.participantRole, participantRole = _d === void 0 ? COMPETITOR : _d, tournamentRecord = _a.tournamentRecord, persons = _a.persons;
|
|
55152
55181
|
if (!tournamentRecord)
|
|
55153
55182
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55154
55183
|
if (!Array.isArray(persons))
|
|
@@ -55207,10 +55236,10 @@ function addPersons(_a) {
|
|
|
55207
55236
|
return result;
|
|
55208
55237
|
addedIndividualParticipantsCount = result.addedCount || 0;
|
|
55209
55238
|
var pairParticipants = [];
|
|
55210
|
-
var tournamentParticipants = ((_b = getParticipants$1({
|
|
55239
|
+
var tournamentParticipants = (_c = (_b = getParticipants$1({
|
|
55211
55240
|
participantFilters: { participantTypes: [INDIVIDUAL] },
|
|
55212
55241
|
tournamentRecord: tournamentRecord,
|
|
55213
|
-
})) === null || _b === void 0 ? void 0 : _b.participants)
|
|
55242
|
+
})) === null || _b === void 0 ? void 0 : _b.participants) !== null && _c !== void 0 ? _c : [];
|
|
55214
55243
|
if (participantRole === COMPETITOR) {
|
|
55215
55244
|
persons
|
|
55216
55245
|
.filter(function (_a) {
|
|
@@ -55292,6 +55321,7 @@ function updateTeamEventEntries(_a) {
|
|
|
55292
55321
|
|
|
55293
55322
|
function addIndividualParticipantIds(_a) {
|
|
55294
55323
|
var _b;
|
|
55324
|
+
var _c;
|
|
55295
55325
|
var individualParticipantIds = _a.individualParticipantIds, groupingParticipantId = _a.groupingParticipantId, removeFromOtherTeams = _a.removeFromOtherTeams, tournamentRecord = _a.tournamentRecord;
|
|
55296
55326
|
var stack = 'addIndividualParticipantIds';
|
|
55297
55327
|
if (!tournamentRecord)
|
|
@@ -55301,7 +55331,7 @@ function addIndividualParticipantIds(_a) {
|
|
|
55301
55331
|
});
|
|
55302
55332
|
if (!groupingParticipantId || !individualParticipantIds)
|
|
55303
55333
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
55304
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
55334
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
55305
55335
|
var groupingParticipant = tournamentParticipants.find(function (participant) { return participant.participantId === groupingParticipantId; });
|
|
55306
55336
|
if (!groupingParticipant)
|
|
55307
55337
|
return decorateResult({ result: { error: PARTICIPANT_NOT_FOUND }, stack: stack });
|
|
@@ -55444,13 +55474,13 @@ function modifyIndividualParticipantIds(_a) {
|
|
|
55444
55474
|
|
|
55445
55475
|
function generateTeamsFromParticipantAttribute(_a) {
|
|
55446
55476
|
var e_1, _b;
|
|
55447
|
-
var _c, _d;
|
|
55448
|
-
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
|
|
55449
55479
|
participantAttribute = _a.participantAttribute, tournamentRecord = _a.tournamentRecord, personAttribute = _a.personAttribute, teamNames = _a.teamNames, accessor = _a.accessor, uuids = _a.uuids;
|
|
55450
55480
|
if (!tournamentRecord)
|
|
55451
55481
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55452
55482
|
var teams = {};
|
|
55453
|
-
var individualParticipants = (tournamentRecord.participants
|
|
55483
|
+
var individualParticipants = ((_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : []).filter(function (_a) {
|
|
55454
55484
|
var participantType = _a.participantType, participantRole = _a.participantRole;
|
|
55455
55485
|
return participantType === INDIVIDUAL && participantRole === COMPETITOR;
|
|
55456
55486
|
});
|
|
@@ -55459,25 +55489,25 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55459
55489
|
for (var individualParticipants_1 = __values(individualParticipants), individualParticipants_1_1 = individualParticipants_1.next(); !individualParticipants_1_1.done; individualParticipants_1_1 = individualParticipants_1.next()) {
|
|
55460
55490
|
var individualParticipant = individualParticipants_1_1.value;
|
|
55461
55491
|
var accessorValue = accessor &&
|
|
55462
|
-
((
|
|
55492
|
+
((_d = getAccessorValue({
|
|
55463
55493
|
element: individualParticipant,
|
|
55464
55494
|
accessor: accessor,
|
|
55465
|
-
})) === null ||
|
|
55495
|
+
})) === null || _d === void 0 ? void 0 : _d.value);
|
|
55466
55496
|
var attributeValue = accessorValue ||
|
|
55467
|
-
(personAttribute && ((
|
|
55497
|
+
(personAttribute && ((_e = individualParticipant.person) === null || _e === void 0 ? void 0 : _e[personAttribute])) ||
|
|
55468
55498
|
(participantAttribute && individualParticipant[participantAttribute]);
|
|
55469
55499
|
if (attributeValue) {
|
|
55470
55500
|
if (!Object.keys(teams).includes(attributeValue)) {
|
|
55471
55501
|
teams[attributeValue] = {
|
|
55472
|
-
participantName: (teamNames === null || teamNames === void 0 ? void 0 : teamNames[teamIndex])
|
|
55473
|
-
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(),
|
|
55474
55504
|
individualParticipantIds: [],
|
|
55475
55505
|
participantRole: COMPETITOR,
|
|
55476
55506
|
participantType: TEAM,
|
|
55477
55507
|
};
|
|
55478
55508
|
var extension = {
|
|
55509
|
+
value: personAttribute !== null && personAttribute !== void 0 ? personAttribute : participantAttribute,
|
|
55479
55510
|
name: GROUPING_ATTRIBUTE,
|
|
55480
|
-
value: personAttribute || participantAttribute,
|
|
55481
55511
|
};
|
|
55482
55512
|
addExtension$1({ element: teams[attributeValue], extension: extension });
|
|
55483
55513
|
teamIndex += 1;
|
|
@@ -55494,7 +55524,7 @@ function generateTeamsFromParticipantAttribute(_a) {
|
|
|
55494
55524
|
finally { if (e_1) throw e_1.error; }
|
|
55495
55525
|
}
|
|
55496
55526
|
var groupingAttributes = Object.keys(teams);
|
|
55497
|
-
var overlappingTeamParticipantIds = (tournamentRecord.participants
|
|
55527
|
+
var overlappingTeamParticipantIds = ((_h = tournamentRecord.participants) !== null && _h !== void 0 ? _h : [])
|
|
55498
55528
|
.map(function (participant) {
|
|
55499
55529
|
if (participant.participantType !== TEAM)
|
|
55500
55530
|
return undefined;
|
|
@@ -55606,14 +55636,14 @@ function modifyParticipantsSignInStatus(_a) {
|
|
|
55606
55636
|
|
|
55607
55637
|
function scaledTeamAssignment(_a) {
|
|
55608
55638
|
var _b, e_1, _c, e_2, _d, e_3, _e, e_4, _f, e_5, _g, e_6, _h, e_7, _j;
|
|
55609
|
-
var _k, _l, _m, _o, _p;
|
|
55610
|
-
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
|
|
55611
55641
|
individualParticipantIds = _a.individualParticipantIds, // if scaledParticipants are provided, individualParticipants is ignored
|
|
55612
55642
|
reverseAssignmentOrder = _a.reverseAssignmentOrder, // optional - reverses team order; useful for sequential assignment of participant groupings to ensure balanced distribution
|
|
55613
|
-
|
|
55614
|
-
initialTeamIndex =
|
|
55615
|
-
|
|
55616
|
-
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
|
|
55617
55647
|
teamParticipantIds = _a.teamParticipantIds, // optional, IF teamsCount is provided then teams will be created
|
|
55618
55648
|
tournamentRecord = _a.tournamentRecord, // supplied automatically by tournamentEngine
|
|
55619
55649
|
scaleAttributes = _a.scaleAttributes, // ignored if scaledParticipants are provided; { scaleName, scaleType, sortOrder, eventType }
|
|
@@ -55651,23 +55681,22 @@ function scaledTeamAssignment(_a) {
|
|
|
55651
55681
|
error: MISSING_VALUE,
|
|
55652
55682
|
};
|
|
55653
55683
|
}
|
|
55654
|
-
var participantIdsToAssign = individualParticipantIds
|
|
55655
|
-
|
|
55656
|
-
|
|
55657
|
-
|
|
55658
|
-
});
|
|
55684
|
+
var participantIdsToAssign = individualParticipantIds !== null && individualParticipantIds !== void 0 ? individualParticipantIds : scaledParticipants.map(function (_a) {
|
|
55685
|
+
var participantId = _a.participantId;
|
|
55686
|
+
return participantId;
|
|
55687
|
+
});
|
|
55659
55688
|
if (reverseAssignmentOrder) {
|
|
55660
55689
|
teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.reverse();
|
|
55661
55690
|
initialTeamIndex += 1; // ensures that the targeted team remains the first team to receive an assignment
|
|
55662
55691
|
}
|
|
55663
55692
|
if (initialTeamIndex > ((teamParticipantIds === null || teamParticipantIds === void 0 ? void 0 : teamParticipantIds.length) || 0) - 1)
|
|
55664
55693
|
initialTeamIndex = 0;
|
|
55665
|
-
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 : [];
|
|
55666
55695
|
var relevantTeams = [];
|
|
55667
55696
|
try {
|
|
55668
55697
|
// build up an array of targeted TEAM participants
|
|
55669
|
-
for (var
|
|
55670
|
-
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;
|
|
55671
55700
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55672
55701
|
if (!orderedTeamParticipantIds.includes(participantId))
|
|
55673
55702
|
continue;
|
|
@@ -55679,28 +55708,28 @@ function scaledTeamAssignment(_a) {
|
|
|
55679
55708
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
55680
55709
|
finally {
|
|
55681
55710
|
try {
|
|
55682
|
-
if (
|
|
55711
|
+
if (_1 && !_1.done && (_c = _0.return)) _c.call(_0);
|
|
55683
55712
|
}
|
|
55684
55713
|
finally { if (e_1) throw e_1.error; }
|
|
55685
55714
|
}
|
|
55686
55715
|
if (teamsCount && relevantTeams.length < teamsCount) {
|
|
55687
55716
|
var addCount = teamsCount - ((relevantTeams === null || relevantTeams === void 0 ? void 0 : relevantTeams.length) || 0);
|
|
55688
|
-
var nameBase_1 = teamNameBase
|
|
55717
|
+
var nameBase_1 = teamNameBase !== null && teamNameBase !== void 0 ? teamNameBase : 'Team';
|
|
55689
55718
|
var teamParticipants = generateRange(0, addCount).map(function (i) { return ({
|
|
55690
55719
|
participantName: "".concat(nameBase_1, " ").concat(i + 1),
|
|
55691
55720
|
participantType: TEAM_PARTICIPANT,
|
|
55692
55721
|
participantRole: COMPETITOR,
|
|
55693
55722
|
}); });
|
|
55694
|
-
var
|
|
55723
|
+
var _2 = addParticipants({
|
|
55695
55724
|
participants: teamParticipants,
|
|
55696
55725
|
returnParticipants: true,
|
|
55697
55726
|
tournamentRecord: tournamentRecord,
|
|
55698
|
-
}).participants, participants =
|
|
55727
|
+
}).participants, participants = _2 === void 0 ? [] : _2;
|
|
55699
55728
|
var addedParticipantIds_1 = participants.map(getParticipantId);
|
|
55700
|
-
var addedParticipants = (
|
|
55729
|
+
var addedParticipants = (_p = (_o = tournamentRecord.participants) === null || _o === void 0 ? void 0 : _o.filter(function (_a) {
|
|
55701
55730
|
var participantId = _a.participantId;
|
|
55702
55731
|
return addedParticipantIds_1.includes(participantId);
|
|
55703
|
-
})) !== null &&
|
|
55732
|
+
})) !== null && _p !== void 0 ? _p : [];
|
|
55704
55733
|
relevantTeams.push.apply(relevantTeams, __spreadArray([], __read(addedParticipants), false));
|
|
55705
55734
|
}
|
|
55706
55735
|
if (!relevantTeams.length)
|
|
@@ -55740,19 +55769,19 @@ function scaledTeamAssignment(_a) {
|
|
|
55740
55769
|
}
|
|
55741
55770
|
if (!scaledParticipants.length) {
|
|
55742
55771
|
try {
|
|
55743
|
-
for (var
|
|
55744
|
-
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;
|
|
55745
55774
|
var participantId = participant.participantId, participantType = participant.participantType;
|
|
55746
55775
|
if (!participantIdsToAssign.includes(participantId))
|
|
55747
55776
|
continue;
|
|
55748
55777
|
if (participantType !== INDIVIDUAL)
|
|
55749
55778
|
return { error: INVALID_PARTICIPANT_TYPE, participant: participant };
|
|
55750
|
-
var scaleItem = (
|
|
55779
|
+
var scaleItem = (_r = participantScaleItem({
|
|
55751
55780
|
scaleAttributes: scaleAttributes,
|
|
55752
55781
|
participant: participant,
|
|
55753
|
-
})) === null ||
|
|
55782
|
+
})) === null || _r === void 0 ? void 0 : _r.scaleItem;
|
|
55754
55783
|
var scaleValue = (scaleAttributes === null || scaleAttributes === void 0 ? void 0 : scaleAttributes.accessor)
|
|
55755
|
-
? (
|
|
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]
|
|
55756
55785
|
: scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue;
|
|
55757
55786
|
var scaledParticipant = { participantId: participantId, scaleValue: scaleValue };
|
|
55758
55787
|
scaledParticipants.push(scaledParticipant);
|
|
@@ -55761,7 +55790,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55761
55790
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
55762
55791
|
finally {
|
|
55763
55792
|
try {
|
|
55764
|
-
if (
|
|
55793
|
+
if (_4 && !_4.done && (_e = _3.return)) _e.call(_3);
|
|
55765
55794
|
}
|
|
55766
55795
|
finally { if (e_3) throw e_3.error; }
|
|
55767
55796
|
}
|
|
@@ -55812,11 +55841,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55812
55841
|
try {
|
|
55813
55842
|
// for all events, check if any relevant teams are present
|
|
55814
55843
|
// if a relevant team is present, remove any UNGROUPED participants that are part of that team
|
|
55815
|
-
for (var
|
|
55816
|
-
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;
|
|
55817
55846
|
if (event_1.eventType !== TEAM_EVENT)
|
|
55818
55847
|
continue;
|
|
55819
|
-
var relevantTeamEntries = (event_1.entries
|
|
55848
|
+
var relevantTeamEntries = ((_u = event_1.entries) !== null && _u !== void 0 ? _u : []).filter(function (entry) {
|
|
55820
55849
|
return relevantTeamParticipantIds.includes(entry.participantId);
|
|
55821
55850
|
});
|
|
55822
55851
|
var _loop_1 = function (relevantEntry) {
|
|
@@ -55826,10 +55855,11 @@ function scaledTeamAssignment(_a) {
|
|
|
55826
55855
|
});
|
|
55827
55856
|
var individualParticipantIds_1 = relevantTeam === null || relevantTeam === void 0 ? void 0 : relevantTeam.individualParticipantIds;
|
|
55828
55857
|
// remove any relevant individualParticipant entries from event.entries
|
|
55829
|
-
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); });
|
|
55830
55859
|
// also remove any relevant individualParticipant entries from drawDefinition.entries
|
|
55831
|
-
(event_1.drawDefinitions
|
|
55832
|
-
|
|
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); });
|
|
55833
55863
|
});
|
|
55834
55864
|
// also remove any relevant individualParticipant any flight.drawEntries
|
|
55835
55865
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
@@ -55855,7 +55885,7 @@ function scaledTeamAssignment(_a) {
|
|
|
55855
55885
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
55856
55886
|
finally {
|
|
55857
55887
|
try {
|
|
55858
|
-
if (
|
|
55888
|
+
if (_6 && !_6.done && (_h = _5.return)) _h.call(_5);
|
|
55859
55889
|
}
|
|
55860
55890
|
finally { if (e_6) throw e_6.error; }
|
|
55861
55891
|
}
|
|
@@ -57078,9 +57108,9 @@ function getEventData(params) {
|
|
|
57078
57108
|
|
|
57079
57109
|
function publishEvent(params) {
|
|
57080
57110
|
var _a;
|
|
57081
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
57111
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
57082
57112
|
var policyDefinitions = params.policyDefinitions, drawIds = params.drawIds, structureIds = params.structureIds, stages = params.stages;
|
|
57083
|
-
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;
|
|
57084
57114
|
if (!tournamentRecord)
|
|
57085
57115
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57086
57116
|
if (!event)
|
|
@@ -57090,10 +57120,10 @@ function publishEvent(params) {
|
|
|
57090
57120
|
policyDefinitions = appliedPolicies;
|
|
57091
57121
|
}
|
|
57092
57122
|
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
57093
|
-
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) {
|
|
57094
57124
|
var drawId = _a.drawId;
|
|
57095
57125
|
return drawId;
|
|
57096
|
-
}))
|
|
57126
|
+
})) !== null && _c !== void 0 ? _c : [];
|
|
57097
57127
|
var timeItem = getEventTimeItem({
|
|
57098
57128
|
itemType: itemType,
|
|
57099
57129
|
event: event,
|
|
@@ -57103,17 +57133,17 @@ function publishEvent(params) {
|
|
|
57103
57133
|
drawIds = eventDrawIds;
|
|
57104
57134
|
}
|
|
57105
57135
|
else if (!drawIds && ((drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) || (drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.length))) {
|
|
57106
|
-
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) || [];
|
|
57107
57137
|
}
|
|
57108
|
-
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); });
|
|
57109
57139
|
if (drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.length) {
|
|
57110
57140
|
drawIds = unique(drawIds.concat.apply(drawIds, __spreadArray([], __read(drawIdsToAdd.filter(function (drawId) { return eventDrawIds.includes(drawId); })), false)));
|
|
57111
57141
|
}
|
|
57112
57142
|
if (!structureIds &&
|
|
57113
57143
|
((structureIdsToAdd === null || structureIdsToAdd === void 0 ? void 0 : structureIdsToAdd.length) || (structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length))) {
|
|
57114
|
-
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) || [];
|
|
57115
57145
|
}
|
|
57116
|
-
structureIds = (structureIds
|
|
57146
|
+
structureIds = (structureIds !== null && structureIds !== void 0 ? structureIds : []).filter(function (structureId) {
|
|
57117
57147
|
return !(structureIdsToRemove === null || structureIdsToRemove === void 0 ? void 0 : structureIdsToRemove.length) ||
|
|
57118
57148
|
!structureIdsToRemove.includes(structureId);
|
|
57119
57149
|
});
|
|
@@ -57121,13 +57151,13 @@ function publishEvent(params) {
|
|
|
57121
57151
|
structureIds = unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(structureIdsToAdd), false)));
|
|
57122
57152
|
}
|
|
57123
57153
|
if (!stages && ((stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) || (stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length))) {
|
|
57124
|
-
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) || [];
|
|
57125
57155
|
}
|
|
57126
|
-
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); });
|
|
57127
57157
|
if (stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) {
|
|
57128
57158
|
stages = unique(stages.concat.apply(stages, __spreadArray([], __read(stagesToAdd), false)));
|
|
57129
57159
|
}
|
|
57130
|
-
var existingStatusValue = (
|
|
57160
|
+
var existingStatusValue = (_k = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _k === void 0 ? void 0 : _k[status];
|
|
57131
57161
|
var updatedTimeItem = {
|
|
57132
57162
|
itemValue: (_a = {},
|
|
57133
57163
|
_a[status] = __assign(__assign({}, existingStatusValue), { drawIds: drawIds, structureIds: structureIds, stages: stages }),
|
|
@@ -57143,7 +57173,7 @@ function publishEvent(params) {
|
|
|
57143
57173
|
event: event,
|
|
57144
57174
|
}).eventData;
|
|
57145
57175
|
// filter out drawData for unPublished draws
|
|
57146
|
-
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;
|
|
57147
57177
|
eventData.drawsData = eventData.drawsData.filter(function (_a) {
|
|
57148
57178
|
var _b;
|
|
57149
57179
|
var drawId = _a.drawId;
|
|
@@ -58527,6 +58557,7 @@ function analyzeDraws(_a) {
|
|
|
58527
58557
|
var event = eventsMap[eventId];
|
|
58528
58558
|
var structures = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || [];
|
|
58529
58559
|
var structuresData = structures.map(function (structure) {
|
|
58560
|
+
var _a, _b, _c, _d;
|
|
58530
58561
|
var stage = structure.stage, stageSequence = structure.stageSequence, structureId = structure.structureId;
|
|
58531
58562
|
var orderNumber = stageOrder$1[stage];
|
|
58532
58563
|
var inContextStructureMatchUps = getStructureDrawPositionProfiles({
|
|
@@ -58556,9 +58587,9 @@ function analyzeDraws(_a) {
|
|
|
58556
58587
|
var participantId = _a.participantId;
|
|
58557
58588
|
return participantId;
|
|
58558
58589
|
});
|
|
58559
|
-
positionsAssignedCount += (positionsAssigned === null || positionsAssigned === void 0 ? void 0 : positionsAssigned.length)
|
|
58560
|
-
var unassignedPositionsCount = ((positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length)
|
|
58561
|
-
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;
|
|
58562
58593
|
var activeRounds = roundProfile &&
|
|
58563
58594
|
Object.keys(roundProfile)
|
|
58564
58595
|
.filter(function (roundNumber) { return !roundProfile[roundNumber].inactiveRound; })
|
|
@@ -58570,7 +58601,7 @@ function analyzeDraws(_a) {
|
|
|
58570
58601
|
var inactiveStructure = roundProfile &&
|
|
58571
58602
|
Object.values(roundProfile).every(function (profile) { return profile.inactiveRound; });
|
|
58572
58603
|
return {
|
|
58573
|
-
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,
|
|
58574
58605
|
maxWinningSideFirstRoundPosition: maxWinningSideFirstRoundPosition,
|
|
58575
58606
|
unassignedPositionsCount: unassignedPositionsCount,
|
|
58576
58607
|
inactiveStructure: inactiveStructure,
|
|
@@ -58694,7 +58725,7 @@ function setTournamentCategories(_a) {
|
|
|
58694
58725
|
// bulk update when tournament dates change
|
|
58695
58726
|
function updateCourtAvailability(_a) {
|
|
58696
58727
|
var e_1, _b, e_2, _c;
|
|
58697
|
-
var _d, _e;
|
|
58728
|
+
var _d, _e, _f;
|
|
58698
58729
|
var tournamentRecord = _a.tournamentRecord;
|
|
58699
58730
|
if (!tournamentRecord)
|
|
58700
58731
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -58702,8 +58733,8 @@ function updateCourtAvailability(_a) {
|
|
|
58702
58733
|
var tournamentDates = dateRange(startDate, endDate);
|
|
58703
58734
|
var courts = [];
|
|
58704
58735
|
try {
|
|
58705
|
-
for (var
|
|
58706
|
-
var venue =
|
|
58736
|
+
for (var _g = __values(tournamentRecord.venues || []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
58737
|
+
var venue = _h.value;
|
|
58707
58738
|
if ((_d = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _d === void 0 ? void 0 : _d.length)
|
|
58708
58739
|
courts.push.apply(courts, __spreadArray([], __read(venue.courts), false));
|
|
58709
58740
|
}
|
|
@@ -58711,12 +58742,12 @@ function updateCourtAvailability(_a) {
|
|
|
58711
58742
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58712
58743
|
finally {
|
|
58713
58744
|
try {
|
|
58714
|
-
if (
|
|
58745
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
58715
58746
|
}
|
|
58716
58747
|
finally { if (e_1) throw e_1.error; }
|
|
58717
58748
|
}
|
|
58718
58749
|
var _loop_1 = function (court) {
|
|
58719
|
-
var
|
|
58750
|
+
var _j = ((_e = court.dateAvailability) !== null && _e !== void 0 ? _e : []).reduce(function (extents, availability) {
|
|
58720
58751
|
var startMinutes = timeStringMinutes(extents.startTime);
|
|
58721
58752
|
var endMinutes = timeStringMinutes(extents.endTime);
|
|
58722
58753
|
if (availability.startTime &&
|
|
@@ -58726,13 +58757,13 @@ function updateCourtAvailability(_a) {
|
|
|
58726
58757
|
timeStringMinutes(availability.endTime) > endMinutes)
|
|
58727
58758
|
extents.endTime = availability.endTime;
|
|
58728
58759
|
return extents;
|
|
58729
|
-
}, { startTime: '08:00', endTime: '18:00' }), startTime =
|
|
58760
|
+
}, { startTime: '08:00', endTime: '18:00' }), startTime = _j.startTime, endTime = _j.endTime;
|
|
58730
58761
|
var updatedDateAvailability = tournamentDates.map(function (date) {
|
|
58731
58762
|
var _a;
|
|
58732
58763
|
var existing = (_a = court.dateAvailability) === null || _a === void 0 ? void 0 : _a.find(function (availability) { return availability.date === date; });
|
|
58733
|
-
return existing
|
|
58764
|
+
return existing !== null && existing !== void 0 ? existing : { date: date, startTime: startTime, endTime: endTime };
|
|
58734
58765
|
});
|
|
58735
|
-
var defaultAvailability = (
|
|
58766
|
+
var defaultAvailability = (_f = court.dateAvailability) === null || _f === void 0 ? void 0 : _f.find(function (availability) { return !availability.date; });
|
|
58736
58767
|
if (defaultAvailability)
|
|
58737
58768
|
updatedDateAvailability.unshift(defaultAvailability);
|
|
58738
58769
|
court.dateAvailability = updatedDateAvailability;
|
|
@@ -58982,8 +59013,8 @@ function getMatchUpDailyLimitsUpdate(_a) {
|
|
|
58982
59013
|
}
|
|
58983
59014
|
|
|
58984
59015
|
function clearMatchUpSchedule(_a) {
|
|
58985
|
-
var _b, _c;
|
|
58986
|
-
var
|
|
59016
|
+
var _b, _c, _d;
|
|
59017
|
+
var _e = _a.scheduleAttributes, scheduleAttributes = _e === void 0 ? [
|
|
58987
59018
|
ALLOCATE_COURTS,
|
|
58988
59019
|
ASSIGN_COURT,
|
|
58989
59020
|
ASSIGN_VENUE,
|
|
@@ -58993,7 +59024,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
58993
59024
|
END_TIME,
|
|
58994
59025
|
RESUME_TIME,
|
|
58995
59026
|
STOP_TIME,
|
|
58996
|
-
] :
|
|
59027
|
+
] : _e, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId;
|
|
58997
59028
|
var stack = 'clearMatchUpSchedule';
|
|
58998
59029
|
var matchUp = drawDefinition
|
|
58999
59030
|
? (_b = allDrawMatchUps$1({
|
|
@@ -59008,7 +59039,7 @@ function clearMatchUpSchedule(_a) {
|
|
|
59008
59039
|
}).matchUps) === null || _c === void 0 ? void 0 : _c[0];
|
|
59009
59040
|
if (!matchUp)
|
|
59010
59041
|
return { error: MATCHUP_NOT_FOUND };
|
|
59011
|
-
var newTimeItems = (matchUp.timeItems
|
|
59042
|
+
var newTimeItems = ((_d = matchUp.timeItems) !== null && _d !== void 0 ? _d : []).filter(function (timeItem) {
|
|
59012
59043
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) && !scheduleAttributes.includes(timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType);
|
|
59013
59044
|
});
|
|
59014
59045
|
matchUp.timeItems = newTimeItems;
|
|
@@ -60066,8 +60097,8 @@ function assignMatchUpSideParticipant(_a) {
|
|
|
60066
60097
|
};
|
|
60067
60098
|
if (matchUp) {
|
|
60068
60099
|
matchUp.sides = [1, 2].map(function (currentSideNumber) {
|
|
60069
|
-
var _a;
|
|
60070
|
-
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 };
|
|
60071
60102
|
return sideNumber === currentSideNumber
|
|
60072
60103
|
? __assign(__assign({}, existingSide), { participantId: participantId }) : existingSide;
|
|
60073
60104
|
});
|
|
@@ -60510,7 +60541,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60510
60541
|
if (matchUpType === DOUBLES$1 &&
|
|
60511
60542
|
participantToRemove.participantType === INDIVIDUAL) {
|
|
60512
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); });
|
|
60513
|
-
var pairParticipantId = (tieMatchUpSide
|
|
60544
|
+
var pairParticipantId = (tieMatchUpSide !== null && tieMatchUpSide !== void 0 ? tieMatchUpSide : {}).participantId;
|
|
60514
60545
|
var pairParticipant = pairParticipantId &&
|
|
60515
60546
|
((_s = (_r = getParticipants$1({
|
|
60516
60547
|
participantFilters: { participantIds: [pairParticipantId] },
|
|
@@ -60548,26 +60579,24 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60548
60579
|
console.log('cleanup', { result: result });
|
|
60549
60580
|
}
|
|
60550
60581
|
}
|
|
60551
|
-
else {
|
|
60552
|
-
|
|
60553
|
-
|
|
60554
|
-
|
|
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,
|
|
60555
60596
|
tournamentRecord: tournamentRecord,
|
|
60556
|
-
})
|
|
60557
|
-
if (
|
|
60558
|
-
|
|
60559
|
-
participantRole: COMPETITOR,
|
|
60560
|
-
individualParticipantIds: individualParticipantIds,
|
|
60561
|
-
participantType: PAIR,
|
|
60562
|
-
};
|
|
60563
|
-
var result = addParticipant$1({
|
|
60564
|
-
participant: newPairParticipant,
|
|
60565
|
-
pairOverride: true,
|
|
60566
|
-
tournamentRecord: tournamentRecord,
|
|
60567
|
-
});
|
|
60568
|
-
if (result.error)
|
|
60569
|
-
return decorateResult({ result: result, stack: stack });
|
|
60570
|
-
}
|
|
60597
|
+
});
|
|
60598
|
+
if (result.error)
|
|
60599
|
+
return decorateResult({ result: result, stack: stack });
|
|
60571
60600
|
}
|
|
60572
60601
|
}
|
|
60573
60602
|
}
|
|
@@ -60635,9 +60664,9 @@ function getPositionAssignments(_a) {
|
|
|
60635
60664
|
structure: structure,
|
|
60636
60665
|
}), error = _d.error, assignments = _d.positionAssignments;
|
|
60637
60666
|
return {
|
|
60638
|
-
|
|
60639
|
-
positionAssignments: assignments || [],
|
|
60667
|
+
positionAssignments: assignments !== null && assignments !== void 0 ? assignments : [],
|
|
60640
60668
|
structureId: structure === null || structure === void 0 ? void 0 : structure.structureId,
|
|
60669
|
+
error: error,
|
|
60641
60670
|
};
|
|
60642
60671
|
}
|
|
60643
60672
|
|
|
@@ -60961,14 +60990,15 @@ function assignDrawPosition(_a) {
|
|
|
60961
60990
|
}
|
|
60962
60991
|
|
|
60963
60992
|
function addEventEntryPairs(_a) {
|
|
60964
|
-
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;
|
|
60965
60995
|
if (!tournamentRecord)
|
|
60966
60996
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
60967
60997
|
if (!event)
|
|
60968
60998
|
return { error: MISSING_EVENT };
|
|
60969
60999
|
if (event.eventType !== DOUBLES$1)
|
|
60970
61000
|
return { error: INVALID_EVENT_TYPE };
|
|
60971
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
61001
|
+
var tournamentParticipants = (_b = tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
|
|
60972
61002
|
var individualParticipantIds = tournamentParticipants
|
|
60973
61003
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
60974
61004
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -60985,12 +61015,15 @@ function addEventEntryPairs(_a) {
|
|
|
60985
61015
|
.filter(function (participant) { return participant.participantType === PAIR; })
|
|
60986
61016
|
.map(function (participant) { return participant.individualParticipantIds; });
|
|
60987
61017
|
// create provisional participant objects
|
|
60988
|
-
var provisionalParticipants = participantIdPairs.map(function (individualParticipantIds) {
|
|
60989
|
-
|
|
60990
|
-
|
|
60991
|
-
|
|
60992
|
-
|
|
60993
|
-
|
|
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
|
+
});
|
|
60994
61027
|
// filter out existing participants unless allowDuplicateParticipantIdPairs is true
|
|
60995
61028
|
var newParticipants = allowDuplicateParticipantIdPairs
|
|
60996
61029
|
? provisionalParticipants
|
|
@@ -61135,7 +61168,7 @@ function assignSeedPositions(params) {
|
|
|
61135
61168
|
/**
|
|
61136
61169
|
* mergeObject and seedLimit ensure that new assignments do not go beyond already established number of seeds
|
|
61137
61170
|
*/
|
|
61138
|
-
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments
|
|
61171
|
+
var mergeObject = Object.assign.apply(Object, __spreadArray([{}], __read((seedAssignments !== null && seedAssignments !== void 0 ? seedAssignments : [])
|
|
61139
61172
|
.filter(function (assignment) { return assignment.seedNumber; })
|
|
61140
61173
|
.map(function (assignment) {
|
|
61141
61174
|
var _a;
|
|
@@ -61404,7 +61437,7 @@ var tieFormatDefaults = function (params) {
|
|
|
61404
61437
|
|
|
61405
61438
|
function addEvent(_a) {
|
|
61406
61439
|
var e_1, _b;
|
|
61407
|
-
var _c, _d, _e, _f;
|
|
61440
|
+
var _c, _d, _e, _f, _g;
|
|
61408
61441
|
var suppressNotifications = _a.suppressNotifications, tournamentRecord = _a.tournamentRecord, internalUse = _a.internalUse, event = _a.event;
|
|
61409
61442
|
if (!tournamentRecord)
|
|
61410
61443
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -61427,13 +61460,7 @@ function addEvent(_a) {
|
|
|
61427
61460
|
context: context,
|
|
61428
61461
|
};
|
|
61429
61462
|
}
|
|
61430
|
-
var eventRecord =
|
|
61431
|
-
drawDefinitions: [],
|
|
61432
|
-
eventType: TypeEnum.Singles,
|
|
61433
|
-
entries: [],
|
|
61434
|
-
startDate: startDate,
|
|
61435
|
-
endDate: endDate,
|
|
61436
|
-
}, event);
|
|
61463
|
+
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
61437
61464
|
if (event.eventType === TypeEnum.Team) {
|
|
61438
61465
|
if (event.tieFormat) {
|
|
61439
61466
|
var result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
@@ -61464,7 +61491,7 @@ function addEvent(_a) {
|
|
|
61464
61491
|
if (!suppressNotifications) {
|
|
61465
61492
|
var topics = getTopics().topics;
|
|
61466
61493
|
if (topics.includes(ADD_MATCHUPS)) {
|
|
61467
|
-
var matchUps = allEventMatchUps({ event: event }).matchUps
|
|
61494
|
+
var matchUps = (_g = allEventMatchUps({ event: event }).matchUps) !== null && _g !== void 0 ? _g : [];
|
|
61468
61495
|
addMatchUpsNotice({
|
|
61469
61496
|
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
61470
61497
|
eventId: event.eventId,
|
|
@@ -61472,15 +61499,15 @@ function addEvent(_a) {
|
|
|
61472
61499
|
});
|
|
61473
61500
|
}
|
|
61474
61501
|
try {
|
|
61475
|
-
for (var
|
|
61476
|
-
var drawDefinition =
|
|
61502
|
+
for (var _h = __values(event.drawDefinitions || []), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
61503
|
+
var drawDefinition = _j.value;
|
|
61477
61504
|
addDrawNotice({ drawDefinition: drawDefinition });
|
|
61478
61505
|
}
|
|
61479
61506
|
}
|
|
61480
61507
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61481
61508
|
finally {
|
|
61482
61509
|
try {
|
|
61483
|
-
if (
|
|
61510
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
61484
61511
|
}
|
|
61485
61512
|
finally { if (e_1) throw e_1.error; }
|
|
61486
61513
|
}
|
|
@@ -62171,11 +62198,9 @@ function setMatchUpFormat(_a) {
|
|
|
62171
62198
|
finally { if (e_2) throw e_2.error; }
|
|
62172
62199
|
}
|
|
62173
62200
|
}
|
|
62174
|
-
else {
|
|
62175
|
-
|
|
62176
|
-
|
|
62177
|
-
modificationsCount += 1;
|
|
62178
|
-
}
|
|
62201
|
+
else if (event_1.matchUpFormat !== matchUpFormat) {
|
|
62202
|
+
event_1.matchUpFormat = matchUpFormat;
|
|
62203
|
+
modificationsCount += 1;
|
|
62179
62204
|
}
|
|
62180
62205
|
}
|
|
62181
62206
|
}
|
|
@@ -62400,10 +62425,11 @@ function getParticipantScaleItem(_a) {
|
|
|
62400
62425
|
}
|
|
62401
62426
|
|
|
62402
62427
|
function getScaledEntries(_a) {
|
|
62403
|
-
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;
|
|
62404
62430
|
if (!tournamentRecord)
|
|
62405
62431
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
62406
|
-
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 : [];
|
|
62407
62433
|
var stageEntries = entries.filter(function (entry) {
|
|
62408
62434
|
return (!stage || !entry.entryStage || entry.entryStage === stage) &&
|
|
62409
62435
|
(!stageSequence ||
|
|
@@ -62441,15 +62467,6 @@ function getScaledEntries(_a) {
|
|
|
62441
62467
|
}
|
|
62442
62468
|
}
|
|
62443
62469
|
|
|
62444
|
-
/**
|
|
62445
|
-
*
|
|
62446
|
-
* @param {object} tournamentRecord - passed automatically if tournamentEngine.setState()
|
|
62447
|
-
* @param {string} eventId - resolves to event
|
|
62448
|
-
* @param {string} drawId - OPTIONAL - resolves drawDefinition - scopes participants to clear to drawDefinition.entries or flightProfile.flight.drawEntries
|
|
62449
|
-
* @param {string} scaleName - OPTIONAL - defaults to event.categoryName || event.ageCategoryCode
|
|
62450
|
-
* @param {string} stage - OPTIONAL - filter event or draw entries by stage
|
|
62451
|
-
* @returns {boolean} { success: true } or { error }
|
|
62452
|
-
*/
|
|
62453
62470
|
function removeSeeding(_a) {
|
|
62454
62471
|
var _b, _c;
|
|
62455
62472
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, entryStatuses = _a.entryStatuses, scaleName = _a.scaleName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
@@ -62741,16 +62758,16 @@ var flightConstants = {
|
|
|
62741
62758
|
};
|
|
62742
62759
|
|
|
62743
62760
|
function generateFlightProfile(params) {
|
|
62744
|
-
var _a;
|
|
62745
|
-
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;
|
|
62746
62763
|
if (!event)
|
|
62747
62764
|
return { error: MISSING_EVENT };
|
|
62748
|
-
var eventEntries = event.entries
|
|
62765
|
+
var eventEntries = (_a = event.entries) !== null && _a !== void 0 ? _a : [];
|
|
62749
62766
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
62750
62767
|
if (flightProfile && attachFlightProfile$1 && !deleteExisting) {
|
|
62751
62768
|
return { error: EXISTING_PROFILE };
|
|
62752
62769
|
}
|
|
62753
|
-
var scaledEntries = (
|
|
62770
|
+
var scaledEntries = (_b = params.scaledEntries) !== null && _b !== void 0 ? _b : getScaledEntries({
|
|
62754
62771
|
tournamentRecord: tournamentRecord,
|
|
62755
62772
|
scaleAttributes: scaleAttributes,
|
|
62756
62773
|
scaleSortMethod: scaleSortMethod,
|
|
@@ -62799,10 +62816,11 @@ function generateFlightProfile(params) {
|
|
|
62799
62816
|
});
|
|
62800
62817
|
}
|
|
62801
62818
|
var flights = generateRange(0, flightsCount).map(function (index) {
|
|
62819
|
+
var _a;
|
|
62802
62820
|
var flightNumber = index + 1;
|
|
62803
62821
|
return {
|
|
62804
62822
|
flightNumber: flightNumber,
|
|
62805
|
-
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(),
|
|
62806
62824
|
drawEntries: getDrawEntries(splitEntries[index]),
|
|
62807
62825
|
drawName: ((drawNames === null || drawNames === void 0 ? void 0 : drawNames.length) && drawNames[index]) ||
|
|
62808
62826
|
"".concat(drawNameRoot, " ").concat(flightNumber),
|
|
@@ -63088,8 +63106,8 @@ function resetDrawDefinition(_a) {
|
|
|
63088
63106
|
}
|
|
63089
63107
|
|
|
63090
63108
|
function pruneDrawDefinition(_a) {
|
|
63091
|
-
var _b;
|
|
63092
|
-
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
|
|
63093
63111
|
tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, drawId = _a.drawId;
|
|
63094
63112
|
if (!tournamentRecord)
|
|
63095
63113
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -63100,16 +63118,16 @@ function pruneDrawDefinition(_a) {
|
|
|
63100
63118
|
if (drawsAnalysis.canBePruned.includes(drawId)) {
|
|
63101
63119
|
var isMatchPlay = drawsAnalysis.matchPlay.includes(drawId);
|
|
63102
63120
|
var drawAnalysis = drawsAnalysis.drawAnalysis[drawId];
|
|
63103
|
-
var
|
|
63121
|
+
var _e = __read(getDrawStructures({
|
|
63104
63122
|
stageSequence: 1,
|
|
63105
63123
|
drawDefinition: drawDefinition,
|
|
63106
63124
|
stage: MAIN,
|
|
63107
|
-
}).structures, 1), mainStructure_1 =
|
|
63125
|
+
}).structures, 1), mainStructure_1 = _e[0];
|
|
63108
63126
|
var structureData_1 = drawAnalysis.structuresData.find(function (_a) {
|
|
63109
63127
|
var structureId = _a.structureId;
|
|
63110
63128
|
return mainStructure_1.structureId === structureId;
|
|
63111
63129
|
});
|
|
63112
|
-
var matchUps = mainStructure_1.matchUps
|
|
63130
|
+
var matchUps = (_b = mainStructure_1.matchUps) !== null && _b !== void 0 ? _b : [];
|
|
63113
63131
|
relevantMatchUps = matchUps
|
|
63114
63132
|
.sort(function (a, b) { return a.roundPosition - b.roundPosition; })
|
|
63115
63133
|
.filter(function (_a) {
|
|
@@ -63136,7 +63154,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63136
63154
|
var matchUpIdsToDelete = relevantMatchUpIds_1.filter(function (matchUpId) { return !matchPlayMatchUpIds_1.includes(matchUpId); });
|
|
63137
63155
|
deletedMatchUpIds.push.apply(deletedMatchUpIds, __spreadArray([], __read(matchUpIdsToDelete), false));
|
|
63138
63156
|
var existingDrawPositionPairings = matchPlayMatchUps
|
|
63139
|
-
.flatMap(function (matchUp) { return matchUp.drawPositions
|
|
63157
|
+
.flatMap(function (matchUp) { var _a; return (_a = matchUp.drawPositions) !== null && _a !== void 0 ? _a : []; })
|
|
63140
63158
|
.filter(Boolean);
|
|
63141
63159
|
var existingDrawPositions_1 = existingDrawPositionPairings.flat();
|
|
63142
63160
|
var drawPositionsMap_1 = Object.assign.apply(Object, __spreadArray([{}], __read(existingDrawPositions_1.map(function (drawPosition, i) {
|
|
@@ -63154,7 +63172,7 @@ function pruneDrawDefinition(_a) {
|
|
|
63154
63172
|
}
|
|
63155
63173
|
});
|
|
63156
63174
|
if (matchPlayDrawPositions) {
|
|
63157
|
-
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) {
|
|
63158
63176
|
return existingDrawPositions_1.includes(assignment.drawPosition);
|
|
63159
63177
|
}).map(function (assignment) {
|
|
63160
63178
|
assignment.drawPosition = drawPositionsMap_1[assignment.drawPosition];
|
|
@@ -63184,12 +63202,13 @@ function setOrderOfFinish(params) {
|
|
|
63184
63202
|
|
|
63185
63203
|
function modifyEventEntries(_a) {
|
|
63186
63204
|
var _b;
|
|
63187
|
-
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;
|
|
63188
63207
|
if (!tournamentRecord)
|
|
63189
63208
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63190
63209
|
if (!event)
|
|
63191
63210
|
return { error: MISSING_EVENT };
|
|
63192
|
-
var tournamentParticipants = tournamentRecord.participants
|
|
63211
|
+
var tournamentParticipants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
|
|
63193
63212
|
var individualParticipantIds = tournamentParticipants
|
|
63194
63213
|
.filter(function (participant) { return participant.participantType === INDIVIDUAL; })
|
|
63195
63214
|
.map(function (participant) { return participant.participantId; });
|
|
@@ -63244,7 +63263,7 @@ function modifyEventEntries(_a) {
|
|
|
63244
63263
|
entryStage: entryStage,
|
|
63245
63264
|
}); });
|
|
63246
63265
|
// remove all entries matching the stage which has been modified
|
|
63247
|
-
event.entries = (event.entries
|
|
63266
|
+
event.entries = ((_d = event.entries) !== null && _d !== void 0 ? _d : []).filter(function (entry) { return entry.entryStage === entryStage; });
|
|
63248
63267
|
event.entries = (_b = event.entries).concat.apply(_b, __spreadArray(__spreadArray([], __read(pairParticipantEntries), false), __read(unpairedParticipantEntries), false));
|
|
63249
63268
|
return __assign({}, SUCCESS);
|
|
63250
63269
|
}
|
|
@@ -63257,8 +63276,8 @@ function drawMatic(params) {
|
|
|
63257
63276
|
}
|
|
63258
63277
|
|
|
63259
63278
|
function addFlight(_a) {
|
|
63260
|
-
var _b, _c, _d;
|
|
63261
|
-
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 }]
|
|
63262
63281
|
drawName = _a.drawName, drawId = _a.drawId, event = _a.event, stage = _a.stage;
|
|
63263
63282
|
var stack = 'addFlight';
|
|
63264
63283
|
if (!event)
|
|
@@ -63267,18 +63286,18 @@ function addFlight(_a) {
|
|
|
63267
63286
|
return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
|
|
63268
63287
|
if (drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.length) {
|
|
63269
63288
|
// check that all drawEntries are in event.entries
|
|
63270
|
-
var enteredParticipantIds = (event.entries
|
|
63289
|
+
var enteredParticipantIds = ((_b = event.entries) !== null && _b !== void 0 ? _b : []).map(extractAttributes('participantId'));
|
|
63271
63290
|
var flightParticipantIds = drawEntries.map(extractAttributes('participantId'));
|
|
63272
63291
|
if (intersection(flightParticipantIds, enteredParticipantIds).length !==
|
|
63273
63292
|
flightParticipantIds.length) {
|
|
63274
63293
|
return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
|
|
63275
63294
|
}
|
|
63276
63295
|
}
|
|
63277
|
-
var flightProfile = (
|
|
63278
|
-
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) {
|
|
63279
63298
|
var flightNumber = _a.flightNumber;
|
|
63280
63299
|
return !isNaN(flightNumber) && ensureInt(flightNumber);
|
|
63281
|
-
})) === null ||
|
|
63300
|
+
})) === null || _e === void 0 ? void 0 : _e.filter(Boolean)) || [];
|
|
63282
63301
|
var flightNumber = Math.max.apply(Math, __spreadArray([0], __read(flightNumbers), false)) + 1;
|
|
63283
63302
|
var flightDrawId = drawId || UUID();
|
|
63284
63303
|
var flight = {
|
|
@@ -64489,7 +64508,8 @@ function isValidForQualifying(_a) {
|
|
|
64489
64508
|
var targetFeedProfiles = result.links.target
|
|
64490
64509
|
.flatMap(function (t) { return t.target.feedProfile; })
|
|
64491
64510
|
.filter(Boolean);
|
|
64492
|
-
var valid =
|
|
64511
|
+
var valid = !intersection([BOTTOM_UP, TOP_DOWN, RANDOM], targetFeedProfiles)
|
|
64512
|
+
.length;
|
|
64493
64513
|
return __assign(__assign({}, SUCCESS), { valid: valid });
|
|
64494
64514
|
}
|
|
64495
64515
|
|
|
@@ -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,
|