tods-competition-factory 1.8.18 → 1.8.19
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 +92 -20
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +3 -3
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +238 -166
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +533 -493
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +463 -398
- 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 +1 -1
|
@@ -2905,7 +2905,7 @@ var matchUpFormatCode = {
|
|
|
2905
2905
|
};
|
|
2906
2906
|
|
|
2907
2907
|
function factoryVersion() {
|
|
2908
|
-
return '1.8.
|
|
2908
|
+
return '1.8.19';
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -3164,10 +3164,50 @@ function getCategoryAgeDetails(params) {
|
|
|
3164
3164
|
return result;
|
|
3165
3165
|
}
|
|
3166
3166
|
|
|
3167
|
+
function decorateResult(_a) {
|
|
3168
|
+
var context = _a.context, result = _a.result, stack = _a.stack, info = _a.info;
|
|
3169
|
+
if (result && !Array.isArray(result === null || result === void 0 ? void 0 : result.stack))
|
|
3170
|
+
result.stack = [];
|
|
3171
|
+
if (result && Array.isArray(result === null || result === void 0 ? void 0 : result.stack) && typeof stack === 'string') {
|
|
3172
|
+
result.stack.push(stack);
|
|
3173
|
+
}
|
|
3174
|
+
if (result && info) {
|
|
3175
|
+
result.info = info;
|
|
3176
|
+
}
|
|
3177
|
+
if (result && typeof context === 'object' && Object.keys(context).length) {
|
|
3178
|
+
Object.assign(result, definedAttributes(context));
|
|
3179
|
+
}
|
|
3180
|
+
if (result && !(result === null || result === void 0 ? void 0 : result.error) && !(result === null || result === void 0 ? void 0 : result.success)) {
|
|
3181
|
+
Object.assign(result, __assign({}, SUCCESS));
|
|
3182
|
+
}
|
|
3183
|
+
return result !== null && result !== void 0 ? result : { success: true };
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
function validateCategory(_a) {
|
|
3187
|
+
var category = _a.category;
|
|
3188
|
+
if (!isObject(category))
|
|
3189
|
+
return { error: INVALID_VALUES };
|
|
3190
|
+
var categoryDetails = getCategoryAgeDetails({ category: category });
|
|
3191
|
+
if (categoryDetails.error)
|
|
3192
|
+
return { error: categoryDetails };
|
|
3193
|
+
var ratingMax = category.ratingMax, ratingMin = category.ratingMin;
|
|
3194
|
+
if (ratingMax && !isNumeric(ratingMax))
|
|
3195
|
+
return decorateResult({
|
|
3196
|
+
result: { error: INVALID_VALUES },
|
|
3197
|
+
context: { ratingMax: ratingMax },
|
|
3198
|
+
});
|
|
3199
|
+
if (ratingMin && !isNumeric(ratingMin))
|
|
3200
|
+
return decorateResult({
|
|
3201
|
+
result: { error: INVALID_VALUES },
|
|
3202
|
+
context: { ratingMin: ratingMin },
|
|
3203
|
+
});
|
|
3204
|
+
return __assign({}, categoryDetails);
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3167
3207
|
function categoryCanContain(_a) {
|
|
3168
3208
|
var childCategory = _a.childCategory, withDetails = _a.withDetails, category = _a.category;
|
|
3169
|
-
var categoryDetails =
|
|
3170
|
-
var childCategoryDetails =
|
|
3209
|
+
var categoryDetails = validateCategory({ category: category });
|
|
3210
|
+
var childCategoryDetails = validateCategory({
|
|
3171
3211
|
category: childCategory,
|
|
3172
3212
|
});
|
|
3173
3213
|
var invalidAgeMin = childCategoryDetails.ageMin &&
|
|
@@ -3188,17 +3228,40 @@ function categoryCanContain(_a) {
|
|
|
3188
3228
|
categoryDetails.ageMinDate &&
|
|
3189
3229
|
new Date(childCategoryDetails.ageMaxDate) <
|
|
3190
3230
|
new Date(categoryDetails.ageMinDate);
|
|
3191
|
-
var
|
|
3192
|
-
|
|
3231
|
+
var ratingComparison = category.ratingType &&
|
|
3232
|
+
childCategory.ratingType &&
|
|
3233
|
+
category.ratingType === childCategory.ratingType;
|
|
3234
|
+
var invalidRatingRange = ratingComparison &&
|
|
3235
|
+
((category.ratingMin &&
|
|
3236
|
+
childCategory.ratingMin &&
|
|
3237
|
+
childCategory.ratingMin < category.ratingMin) ||
|
|
3238
|
+
(category.ratingMax &&
|
|
3239
|
+
childCategory.ratingMax &&
|
|
3240
|
+
childCategory.ratingMax > category.ratingMax) ||
|
|
3241
|
+
(category.ratingMin &&
|
|
3242
|
+
childCategory.ratingMax &&
|
|
3243
|
+
childCategory.ratingMax < category.ratingMin) ||
|
|
3244
|
+
(category.ratingMax &&
|
|
3245
|
+
childCategory.ratingMin &&
|
|
3246
|
+
childCategory.ratingMin > category.ratingMax));
|
|
3247
|
+
var invalidBallType = category.ballType &&
|
|
3248
|
+
childCategory.ballType &&
|
|
3249
|
+
category.ballType !== childCategory.ballType;
|
|
3250
|
+
var valid = !invalidRatingRange &&
|
|
3193
3251
|
!invalidAgeMinDate &&
|
|
3194
|
-
!invalidAgeMaxDate
|
|
3252
|
+
!invalidAgeMaxDate &&
|
|
3253
|
+
!invalidBallType &&
|
|
3254
|
+
!invalidAgeMax &&
|
|
3255
|
+
!invalidAgeMin;
|
|
3195
3256
|
var ignoreFalse = true;
|
|
3196
3257
|
var result = definedAttributes({
|
|
3197
|
-
|
|
3198
|
-
invalidAgeMax: invalidAgeMax,
|
|
3199
|
-
invalidAgeMin: invalidAgeMin,
|
|
3258
|
+
invalidRatingRange: invalidRatingRange,
|
|
3200
3259
|
invalidAgeMinDate: invalidAgeMinDate,
|
|
3201
3260
|
invalidAgeMaxDate: invalidAgeMaxDate,
|
|
3261
|
+
invalidBallType: invalidBallType,
|
|
3262
|
+
invalidAgeMax: invalidAgeMax,
|
|
3263
|
+
invalidAgeMin: invalidAgeMin,
|
|
3264
|
+
valid: valid,
|
|
3202
3265
|
}, ignoreFalse);
|
|
3203
3266
|
if (withDetails) {
|
|
3204
3267
|
Object.assign(result, { categoryDetails: categoryDetails, childCategoryDetails: childCategoryDetails });
|
|
@@ -3210,25 +3273,6 @@ function mustBeAnArray(value) {
|
|
|
3210
3273
|
return "".concat(value, " must be an array");
|
|
3211
3274
|
}
|
|
3212
3275
|
|
|
3213
|
-
function decorateResult(_a) {
|
|
3214
|
-
var context = _a.context, result = _a.result, stack = _a.stack, info = _a.info;
|
|
3215
|
-
if (result && !Array.isArray(result === null || result === void 0 ? void 0 : result.stack))
|
|
3216
|
-
result.stack = [];
|
|
3217
|
-
if (result && Array.isArray(result === null || result === void 0 ? void 0 : result.stack) && typeof stack === 'string') {
|
|
3218
|
-
result.stack.push(stack);
|
|
3219
|
-
}
|
|
3220
|
-
if (result && info) {
|
|
3221
|
-
result.info = info;
|
|
3222
|
-
}
|
|
3223
|
-
if (result && typeof context === 'object' && Object.keys(context).length) {
|
|
3224
|
-
Object.assign(result, definedAttributes(context));
|
|
3225
|
-
}
|
|
3226
|
-
if (result && !(result === null || result === void 0 ? void 0 : result.error) && !(result === null || result === void 0 ? void 0 : result.success)) {
|
|
3227
|
-
Object.assign(result, __assign({}, SUCCESS));
|
|
3228
|
-
}
|
|
3229
|
-
return result !== null && result !== void 0 ? result : { success: true };
|
|
3230
|
-
}
|
|
3231
|
-
|
|
3232
3276
|
var DrawTypeEnum;
|
|
3233
3277
|
(function (DrawTypeEnum) {
|
|
3234
3278
|
DrawTypeEnum["AdHoc"] = "AD_HOC";
|
|
@@ -5359,142 +5403,6 @@ function tallyParticipantResults(_a) {
|
|
|
5359
5403
|
return result;
|
|
5360
5404
|
}
|
|
5361
5405
|
|
|
5362
|
-
function evaluateCollectionResult(_a) {
|
|
5363
|
-
var collectionDefinition = _a.collectionDefinition, groupValueNumbers = _a.groupValueNumbers, groupValueGroups = _a.groupValueGroups, sideTieValues = _a.sideTieValues, tieMatchUps = _a.tieMatchUps;
|
|
5364
|
-
var collectionMatchUps = tieMatchUps.filter(function (matchUp) { return matchUp.collectionId === collectionDefinition.collectionId; });
|
|
5365
|
-
// keep track of the values derived from matchUps
|
|
5366
|
-
var sideMatchUpValues = [0, 0];
|
|
5367
|
-
// will be equivalent to sideMatchUpValues unless there is a collectionValue,
|
|
5368
|
-
// in which case the sideMatchUpValues are used in comparision with winCriteria
|
|
5369
|
-
var sideCollectionValues = [0, 0];
|
|
5370
|
-
var allCollectionMatchUpsCompleted = collectionMatchUps.every(function (matchUp) {
|
|
5371
|
-
return completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
5372
|
-
});
|
|
5373
|
-
var collectionValueProfiles = collectionDefinition.collectionValueProfiles, collectionGroupNumber = collectionDefinition.collectionGroupNumber, collectionValue = collectionDefinition.collectionValue, matchUpValue = collectionDefinition.matchUpValue, winCriteria = collectionDefinition.winCriteria, scoreValue = collectionDefinition.scoreValue, setValue = collectionDefinition.setValue;
|
|
5374
|
-
var belongsToValueGroup = collectionGroupNumber && groupValueNumbers.includes(collectionGroupNumber);
|
|
5375
|
-
var sideWins = [0, 0];
|
|
5376
|
-
collectionMatchUps.forEach(function (matchUp) {
|
|
5377
|
-
if (matchUp.winningSide)
|
|
5378
|
-
sideWins[matchUp.winningSide - 1] += 1;
|
|
5379
|
-
});
|
|
5380
|
-
if (isConvertableInteger(matchUpValue)) {
|
|
5381
|
-
// if tiebreak set count as set value and game value
|
|
5382
|
-
collectionMatchUps.forEach(function (matchUp) {
|
|
5383
|
-
if (matchUp.winningSide) {
|
|
5384
|
-
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
|
|
5385
|
-
}
|
|
5386
|
-
});
|
|
5387
|
-
}
|
|
5388
|
-
else if (isConvertableInteger(setValue)) {
|
|
5389
|
-
collectionMatchUps.forEach(function (matchUp) {
|
|
5390
|
-
var _a, _b;
|
|
5391
|
-
(_b = (_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.sets) === null || _b === void 0 ? void 0 : _b.forEach(function (set) {
|
|
5392
|
-
if (set.winningSide)
|
|
5393
|
-
sideMatchUpValues[set.winningSide - 1] += setValue;
|
|
5394
|
-
});
|
|
5395
|
-
});
|
|
5396
|
-
}
|
|
5397
|
-
else if (isConvertableInteger(scoreValue)) {
|
|
5398
|
-
collectionMatchUps.forEach(function (matchUp) {
|
|
5399
|
-
var _a, _b;
|
|
5400
|
-
(_b = (_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.sets) === null || _b === void 0 ? void 0 : _b.forEach(function (set) {
|
|
5401
|
-
var _a = set.side1TiebreakScore, side1TiebreakScore = _a === void 0 ? 0 : _a, _b = set.side2TiebreakScore, side2TiebreakScore = _b === void 0 ? 0 : _b, _c = set.side1Score, side1Score = _c === void 0 ? 0 : _c, _d = set.side2Score, side2Score = _d === void 0 ? 0 : _d;
|
|
5402
|
-
if (matchUp.matchUpStatus === COMPLETED$1 ||
|
|
5403
|
-
matchUp.winningSide ||
|
|
5404
|
-
set.winningSide) {
|
|
5405
|
-
if (side1Score || side2Score) {
|
|
5406
|
-
sideMatchUpValues[0] += side1Score;
|
|
5407
|
-
sideMatchUpValues[1] += side2Score;
|
|
5408
|
-
}
|
|
5409
|
-
else if ((side1TiebreakScore || side2TiebreakScore) &&
|
|
5410
|
-
set.winningSide) {
|
|
5411
|
-
sideMatchUpValues[set.winningSide - 1] += 1;
|
|
5412
|
-
}
|
|
5413
|
-
}
|
|
5414
|
-
});
|
|
5415
|
-
});
|
|
5416
|
-
}
|
|
5417
|
-
else if (Array.isArray(collectionValueProfiles)) {
|
|
5418
|
-
// this must come last because it will be true for []
|
|
5419
|
-
collectionMatchUps.forEach(function (matchUp) {
|
|
5420
|
-
if (matchUp.winningSide) {
|
|
5421
|
-
var collectionPosition = matchUp.collectionPosition;
|
|
5422
|
-
var matchUpValue_1 = getCollectionPositionValue({
|
|
5423
|
-
collectionDefinition: collectionDefinition,
|
|
5424
|
-
collectionPosition: collectionPosition,
|
|
5425
|
-
});
|
|
5426
|
-
if (isConvertableInteger(matchUpValue_1)) {
|
|
5427
|
-
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue_1;
|
|
5428
|
-
}
|
|
5429
|
-
}
|
|
5430
|
-
});
|
|
5431
|
-
}
|
|
5432
|
-
// processed separately so that setValue, scoreValue and collecitonValueProfile can be used in conjunction with collectionValue
|
|
5433
|
-
if (isConvertableInteger(collectionValue)) {
|
|
5434
|
-
var collectionWinningSide = void 0;
|
|
5435
|
-
if (winCriteria === null || winCriteria === void 0 ? void 0 : winCriteria.aggregateValue) {
|
|
5436
|
-
if (allCollectionMatchUpsCompleted) {
|
|
5437
|
-
if (isConvertableInteger(matchUpValue || setValue || scoreValue) &&
|
|
5438
|
-
sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
5439
|
-
collectionWinningSide =
|
|
5440
|
-
sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
|
|
5441
|
-
}
|
|
5442
|
-
else if (sideWins[0] !== sideWins[1]) {
|
|
5443
|
-
collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
|
|
5444
|
-
}
|
|
5445
|
-
}
|
|
5446
|
-
}
|
|
5447
|
-
else if (winCriteria === null || winCriteria === void 0 ? void 0 : winCriteria.valueGoal) {
|
|
5448
|
-
collectionWinningSide = sideMatchUpValues.reduce(function (winningSide, side, i) {
|
|
5449
|
-
return side >= winCriteria.valueGoal ? i + 1 : winningSide;
|
|
5450
|
-
}, 0);
|
|
5451
|
-
}
|
|
5452
|
-
else {
|
|
5453
|
-
var winGoal_1 = Math.floor(collectionDefinition.matchUpCount / 2) + 1;
|
|
5454
|
-
collectionWinningSide = sideWins.reduce(function (winningSide, side, i) {
|
|
5455
|
-
return side >= winGoal_1 ? i + 1 : winningSide;
|
|
5456
|
-
}, 0);
|
|
5457
|
-
}
|
|
5458
|
-
if (collectionWinningSide) {
|
|
5459
|
-
if (belongsToValueGroup) {
|
|
5460
|
-
groupValueGroups[collectionGroupNumber].values[collectionWinningSide - 1] += collectionValue;
|
|
5461
|
-
}
|
|
5462
|
-
else {
|
|
5463
|
-
sideCollectionValues[collectionWinningSide - 1] += collectionValue;
|
|
5464
|
-
}
|
|
5465
|
-
}
|
|
5466
|
-
}
|
|
5467
|
-
else {
|
|
5468
|
-
if (belongsToValueGroup) {
|
|
5469
|
-
groupValueGroups[collectionGroupNumber].values[0] +=
|
|
5470
|
-
sideMatchUpValues[0] || 0;
|
|
5471
|
-
groupValueGroups[collectionGroupNumber].values[1] +=
|
|
5472
|
-
sideMatchUpValues[1] || 0;
|
|
5473
|
-
}
|
|
5474
|
-
else {
|
|
5475
|
-
sideCollectionValues = sideMatchUpValues;
|
|
5476
|
-
}
|
|
5477
|
-
}
|
|
5478
|
-
if (!belongsToValueGroup) {
|
|
5479
|
-
sideCollectionValues.forEach(function (sideCollectionValue, i) { return (sideTieValues[i] += sideCollectionValue || 0); });
|
|
5480
|
-
}
|
|
5481
|
-
else {
|
|
5482
|
-
groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
|
|
5483
|
-
groupValueGroups[collectionGroupNumber].sideWins[1] += sideWins[1] || 0;
|
|
5484
|
-
groupValueGroups[collectionGroupNumber].allGroupMatchUpsCompleted =
|
|
5485
|
-
groupValueGroups[collectionGroupNumber].allGroupMatchUpsCompleted &&
|
|
5486
|
-
allCollectionMatchUpsCompleted;
|
|
5487
|
-
groupValueGroups[collectionGroupNumber].matchUpsCount +=
|
|
5488
|
-
collectionMatchUps.length;
|
|
5489
|
-
}
|
|
5490
|
-
}
|
|
5491
|
-
function getCollectionPositionValue(_a) {
|
|
5492
|
-
var collectionDefinition = _a.collectionDefinition, collectionPosition = _a.collectionPosition;
|
|
5493
|
-
var collectionValueProfiles = collectionDefinition.collectionValueProfiles || [];
|
|
5494
|
-
var profile = collectionValueProfiles === null || collectionValueProfiles === void 0 ? void 0 : collectionValueProfiles.find(function (profile) { return profile.collectionPosition === collectionPosition; });
|
|
5495
|
-
return profile === null || profile === void 0 ? void 0 : profile.matchUpValue;
|
|
5496
|
-
}
|
|
5497
|
-
|
|
5498
5406
|
var APPLIED_POLICIES = 'appliedPolicies';
|
|
5499
5407
|
var AUDIT_POSITION_ACTIONS = 'positionActions';
|
|
5500
5408
|
var CONTEXT = 'context';
|
|
@@ -10007,11 +9915,13 @@ function getAllStructureMatchUps(_a) {
|
|
|
10007
9915
|
/*
|
|
10008
9916
|
public version of findMatchUp
|
|
10009
9917
|
*/
|
|
10010
|
-
function
|
|
9918
|
+
function publicFindDrawMatchUp(params) {
|
|
10011
9919
|
Object.assign(params, { inContext: true });
|
|
10012
|
-
return {
|
|
9920
|
+
return {
|
|
9921
|
+
matchUp: makeDeepCopy(findDrawMatchUp(params).matchUp, false, true),
|
|
9922
|
+
};
|
|
10013
9923
|
}
|
|
10014
|
-
function
|
|
9924
|
+
function findDrawMatchUp(_a) {
|
|
10015
9925
|
var e_1, _b;
|
|
10016
9926
|
var tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, matchUpsMap = _a.matchUpsMap, matchUpId = _a.matchUpId, inContext = _a.inContext, context = _a.context, event = _a.event;
|
|
10017
9927
|
if (!drawDefinition)
|
|
@@ -10053,6 +9963,142 @@ function findMatchUp$1(_a) {
|
|
|
10053
9963
|
return { error: MATCHUP_NOT_FOUND };
|
|
10054
9964
|
}
|
|
10055
9965
|
|
|
9966
|
+
function evaluateCollectionResult(_a) {
|
|
9967
|
+
var collectionDefinition = _a.collectionDefinition, groupValueNumbers = _a.groupValueNumbers, groupValueGroups = _a.groupValueGroups, sideTieValues = _a.sideTieValues, tieMatchUps = _a.tieMatchUps;
|
|
9968
|
+
var collectionMatchUps = tieMatchUps.filter(function (matchUp) { return matchUp.collectionId === collectionDefinition.collectionId; });
|
|
9969
|
+
// keep track of the values derived from matchUps
|
|
9970
|
+
var sideMatchUpValues = [0, 0];
|
|
9971
|
+
// will be equivalent to sideMatchUpValues unless there is a collectionValue,
|
|
9972
|
+
// in which case the sideMatchUpValues are used in comparision with winCriteria
|
|
9973
|
+
var sideCollectionValues = [0, 0];
|
|
9974
|
+
var allCollectionMatchUpsCompleted = collectionMatchUps.every(function (matchUp) {
|
|
9975
|
+
return completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
9976
|
+
});
|
|
9977
|
+
var collectionValueProfiles = collectionDefinition.collectionValueProfiles, collectionGroupNumber = collectionDefinition.collectionGroupNumber, collectionValue = collectionDefinition.collectionValue, matchUpValue = collectionDefinition.matchUpValue, winCriteria = collectionDefinition.winCriteria, scoreValue = collectionDefinition.scoreValue, setValue = collectionDefinition.setValue;
|
|
9978
|
+
var belongsToValueGroup = collectionGroupNumber && groupValueNumbers.includes(collectionGroupNumber);
|
|
9979
|
+
var sideWins = [0, 0];
|
|
9980
|
+
collectionMatchUps.forEach(function (matchUp) {
|
|
9981
|
+
if (matchUp.winningSide)
|
|
9982
|
+
sideWins[matchUp.winningSide - 1] += 1;
|
|
9983
|
+
});
|
|
9984
|
+
if (isConvertableInteger(matchUpValue)) {
|
|
9985
|
+
// if tiebreak set count as set value and game value
|
|
9986
|
+
collectionMatchUps.forEach(function (matchUp) {
|
|
9987
|
+
if (matchUp.winningSide) {
|
|
9988
|
+
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
|
|
9989
|
+
}
|
|
9990
|
+
});
|
|
9991
|
+
}
|
|
9992
|
+
else if (isConvertableInteger(setValue)) {
|
|
9993
|
+
collectionMatchUps.forEach(function (matchUp) {
|
|
9994
|
+
var _a, _b;
|
|
9995
|
+
(_b = (_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.sets) === null || _b === void 0 ? void 0 : _b.forEach(function (set) {
|
|
9996
|
+
if (set.winningSide)
|
|
9997
|
+
sideMatchUpValues[set.winningSide - 1] += setValue;
|
|
9998
|
+
});
|
|
9999
|
+
});
|
|
10000
|
+
}
|
|
10001
|
+
else if (isConvertableInteger(scoreValue)) {
|
|
10002
|
+
collectionMatchUps.forEach(function (matchUp) {
|
|
10003
|
+
var _a, _b;
|
|
10004
|
+
(_b = (_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.sets) === null || _b === void 0 ? void 0 : _b.forEach(function (set) {
|
|
10005
|
+
var _a = set.side1TiebreakScore, side1TiebreakScore = _a === void 0 ? 0 : _a, _b = set.side2TiebreakScore, side2TiebreakScore = _b === void 0 ? 0 : _b, _c = set.side1Score, side1Score = _c === void 0 ? 0 : _c, _d = set.side2Score, side2Score = _d === void 0 ? 0 : _d;
|
|
10006
|
+
if (matchUp.matchUpStatus === COMPLETED$1 ||
|
|
10007
|
+
matchUp.winningSide ||
|
|
10008
|
+
set.winningSide) {
|
|
10009
|
+
if (side1Score || side2Score) {
|
|
10010
|
+
sideMatchUpValues[0] += side1Score;
|
|
10011
|
+
sideMatchUpValues[1] += side2Score;
|
|
10012
|
+
}
|
|
10013
|
+
else if ((side1TiebreakScore || side2TiebreakScore) &&
|
|
10014
|
+
set.winningSide) {
|
|
10015
|
+
sideMatchUpValues[set.winningSide - 1] += 1;
|
|
10016
|
+
}
|
|
10017
|
+
}
|
|
10018
|
+
});
|
|
10019
|
+
});
|
|
10020
|
+
}
|
|
10021
|
+
else if (Array.isArray(collectionValueProfiles)) {
|
|
10022
|
+
// this must come last because it will be true for []
|
|
10023
|
+
collectionMatchUps.forEach(function (matchUp) {
|
|
10024
|
+
if (matchUp.winningSide) {
|
|
10025
|
+
var collectionPosition = matchUp.collectionPosition;
|
|
10026
|
+
var matchUpValue_1 = getCollectionPositionValue({
|
|
10027
|
+
collectionDefinition: collectionDefinition,
|
|
10028
|
+
collectionPosition: collectionPosition,
|
|
10029
|
+
});
|
|
10030
|
+
if (isConvertableInteger(matchUpValue_1)) {
|
|
10031
|
+
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue_1;
|
|
10032
|
+
}
|
|
10033
|
+
}
|
|
10034
|
+
});
|
|
10035
|
+
}
|
|
10036
|
+
// processed separately so that setValue, scoreValue and collecitonValueProfile can be used in conjunction with collectionValue
|
|
10037
|
+
if (isConvertableInteger(collectionValue)) {
|
|
10038
|
+
var collectionWinningSide = void 0;
|
|
10039
|
+
if (winCriteria === null || winCriteria === void 0 ? void 0 : winCriteria.aggregateValue) {
|
|
10040
|
+
if (allCollectionMatchUpsCompleted) {
|
|
10041
|
+
if (isConvertableInteger(matchUpValue || setValue || scoreValue) &&
|
|
10042
|
+
sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
10043
|
+
collectionWinningSide =
|
|
10044
|
+
sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
|
|
10045
|
+
}
|
|
10046
|
+
else if (sideWins[0] !== sideWins[1]) {
|
|
10047
|
+
collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
|
|
10048
|
+
}
|
|
10049
|
+
}
|
|
10050
|
+
}
|
|
10051
|
+
else if (winCriteria === null || winCriteria === void 0 ? void 0 : winCriteria.valueGoal) {
|
|
10052
|
+
collectionWinningSide = sideMatchUpValues.reduce(function (winningSide, side, i) {
|
|
10053
|
+
return side >= winCriteria.valueGoal ? i + 1 : winningSide;
|
|
10054
|
+
}, 0);
|
|
10055
|
+
}
|
|
10056
|
+
else {
|
|
10057
|
+
var winGoal_1 = Math.floor(collectionDefinition.matchUpCount / 2) + 1;
|
|
10058
|
+
collectionWinningSide = sideWins.reduce(function (winningSide, side, i) {
|
|
10059
|
+
return side >= winGoal_1 ? i + 1 : winningSide;
|
|
10060
|
+
}, 0);
|
|
10061
|
+
}
|
|
10062
|
+
if (collectionWinningSide) {
|
|
10063
|
+
if (belongsToValueGroup) {
|
|
10064
|
+
groupValueGroups[collectionGroupNumber].values[collectionWinningSide - 1] += collectionValue;
|
|
10065
|
+
}
|
|
10066
|
+
else {
|
|
10067
|
+
sideCollectionValues[collectionWinningSide - 1] += collectionValue;
|
|
10068
|
+
}
|
|
10069
|
+
}
|
|
10070
|
+
}
|
|
10071
|
+
else {
|
|
10072
|
+
if (belongsToValueGroup) {
|
|
10073
|
+
groupValueGroups[collectionGroupNumber].values[0] +=
|
|
10074
|
+
sideMatchUpValues[0] || 0;
|
|
10075
|
+
groupValueGroups[collectionGroupNumber].values[1] +=
|
|
10076
|
+
sideMatchUpValues[1] || 0;
|
|
10077
|
+
}
|
|
10078
|
+
else {
|
|
10079
|
+
sideCollectionValues = sideMatchUpValues;
|
|
10080
|
+
}
|
|
10081
|
+
}
|
|
10082
|
+
if (!belongsToValueGroup) {
|
|
10083
|
+
sideCollectionValues.forEach(function (sideCollectionValue, i) { return (sideTieValues[i] += sideCollectionValue || 0); });
|
|
10084
|
+
}
|
|
10085
|
+
else {
|
|
10086
|
+
groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
|
|
10087
|
+
groupValueGroups[collectionGroupNumber].sideWins[1] += sideWins[1] || 0;
|
|
10088
|
+
groupValueGroups[collectionGroupNumber].allGroupMatchUpsCompleted =
|
|
10089
|
+
groupValueGroups[collectionGroupNumber].allGroupMatchUpsCompleted &&
|
|
10090
|
+
allCollectionMatchUpsCompleted;
|
|
10091
|
+
groupValueGroups[collectionGroupNumber].matchUpsCount +=
|
|
10092
|
+
collectionMatchUps.length;
|
|
10093
|
+
}
|
|
10094
|
+
}
|
|
10095
|
+
function getCollectionPositionValue(_a) {
|
|
10096
|
+
var collectionDefinition = _a.collectionDefinition, collectionPosition = _a.collectionPosition;
|
|
10097
|
+
var collectionValueProfiles = collectionDefinition.collectionValueProfiles || [];
|
|
10098
|
+
var profile = collectionValueProfiles === null || collectionValueProfiles === void 0 ? void 0 : collectionValueProfiles.find(function (profile) { return profile.collectionPosition === collectionPosition; });
|
|
10099
|
+
return profile === null || profile === void 0 ? void 0 : profile.matchUpValue;
|
|
10100
|
+
}
|
|
10101
|
+
|
|
10056
10102
|
function getGroupValueGroups(_a) {
|
|
10057
10103
|
var _b = _a.collectionGroups, collectionGroups = _b === void 0 ? [] : _b;
|
|
10058
10104
|
// set up to handle groupValue
|
|
@@ -10190,7 +10236,7 @@ function generateTieMatchUpScore(params) {
|
|
|
10190
10236
|
? matchUp
|
|
10191
10237
|
: ((_d = matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps) === null || _d === void 0 ? void 0 : _d[matchUpId]) ||
|
|
10192
10238
|
(drawDefinition &&
|
|
10193
|
-
((_e =
|
|
10239
|
+
((_e = findDrawMatchUp({
|
|
10194
10240
|
inContext: true,
|
|
10195
10241
|
drawDefinition: drawDefinition,
|
|
10196
10242
|
matchUpId: matchUpId,
|
|
@@ -10219,83 +10265,6 @@ function generateTieMatchUpScore(params) {
|
|
|
10219
10265
|
};
|
|
10220
10266
|
}
|
|
10221
10267
|
|
|
10222
|
-
function copyTieFormat(tieFormat) {
|
|
10223
|
-
if (!tieFormat)
|
|
10224
|
-
return undefined;
|
|
10225
|
-
return makeDeepCopy(tieFormat, false, true);
|
|
10226
|
-
}
|
|
10227
|
-
|
|
10228
|
-
function scoreHasValue(params) {
|
|
10229
|
-
var _a, _b;
|
|
10230
|
-
var matchUp = params === null || params === void 0 ? void 0 : params.matchUp;
|
|
10231
|
-
var score = (params === null || params === void 0 ? void 0 : params.score) || (matchUp === null || matchUp === void 0 ? void 0 : matchUp.score);
|
|
10232
|
-
var firstSet = (_a = score === null || score === void 0 ? void 0 : score.sets) === null || _a === void 0 ? void 0 : _a[0];
|
|
10233
|
-
var _c = firstSet || {}, side1Score = _c.side1Score, side2Score = _c.side2Score, side1TiebreakScore = _c.side1TiebreakScore, side2TiebreakScore = _c.side2TiebreakScore, side1PointScore = _c.side1PointScore, side2PointScore = _c.side2PointScore;
|
|
10234
|
-
var firstSetScore = side1Score ||
|
|
10235
|
-
side2Score ||
|
|
10236
|
-
side1TiebreakScore ||
|
|
10237
|
-
side2TiebreakScore ||
|
|
10238
|
-
side1PointScore ||
|
|
10239
|
-
side2PointScore;
|
|
10240
|
-
var hasValue = ((_b = score === null || score === void 0 ? void 0 : score.sets) === null || _b === void 0 ? void 0 : _b.length) > 1 || firstSetScore;
|
|
10241
|
-
return !!hasValue;
|
|
10242
|
-
}
|
|
10243
|
-
|
|
10244
|
-
function isDirectingMatchUpStatus(_a) {
|
|
10245
|
-
var matchUpStatus = _a.matchUpStatus;
|
|
10246
|
-
return directingMatchUpStatuses.includes(matchUpStatus);
|
|
10247
|
-
}
|
|
10248
|
-
function isActiveMatchUpStatus(_a) {
|
|
10249
|
-
var matchUpStatus = _a.matchUpStatus;
|
|
10250
|
-
return activeMatchUpStatuses.includes(matchUpStatus);
|
|
10251
|
-
}
|
|
10252
|
-
function isNonDirectingMatchUpStatus(_a) {
|
|
10253
|
-
var matchUpStatus = _a.matchUpStatus;
|
|
10254
|
-
return nonDirectingMatchUpStatuses.includes(matchUpStatus);
|
|
10255
|
-
}
|
|
10256
|
-
|
|
10257
|
-
function isActiveMatchUp(_a) {
|
|
10258
|
-
var _b;
|
|
10259
|
-
var matchUpStatus = _a.matchUpStatus, winningSide = _a.winningSide, tieMatchUps = _a.tieMatchUps, sides = _a.sides, score = _a.score;
|
|
10260
|
-
var participantAssigned = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
10261
|
-
var participantId = _a.participantId;
|
|
10262
|
-
return participantId;
|
|
10263
|
-
});
|
|
10264
|
-
var activeTieMatchUps = (_b = tieMatchUps === null || tieMatchUps === void 0 ? void 0 : tieMatchUps.filter(isActiveMatchUp)) === null || _b === void 0 ? void 0 : _b.length;
|
|
10265
|
-
var scoreExists = scoreHasValue({ score: score });
|
|
10266
|
-
return (scoreExists ||
|
|
10267
|
-
activeTieMatchUps ||
|
|
10268
|
-
(winningSide && participantAssigned) || // if winningSide and no participant assigned => "produced" WALKOVER
|
|
10269
|
-
// must exclude IN_PROGRESS as this is automatically set by updateTieMatchUpScore
|
|
10270
|
-
// must exclude WALKOVER and DEFAULTED as "produced" scenarios do not imply a winningSide
|
|
10271
|
-
(matchUpStatus &&
|
|
10272
|
-
isActiveMatchUpStatus({ matchUpStatus: matchUpStatus }) &&
|
|
10273
|
-
![DEFAULTED, WALKOVER$2, IN_PROGRESS$1].includes(matchUpStatus)));
|
|
10274
|
-
}
|
|
10275
|
-
|
|
10276
|
-
function addNotes(params) {
|
|
10277
|
-
var _a;
|
|
10278
|
-
if (typeof params !== 'object')
|
|
10279
|
-
return { error: MISSING_VALUE };
|
|
10280
|
-
if (typeof params.element !== 'object')
|
|
10281
|
-
return { error: INVALID_VALUES };
|
|
10282
|
-
if (!params.notes)
|
|
10283
|
-
return { error: MISSING_VALUE };
|
|
10284
|
-
if (typeof params.notes !== 'string' && !((_a = params.notes) === null || _a === void 0 ? void 0 : _a.testing))
|
|
10285
|
-
return { error: INVALID_VALUES };
|
|
10286
|
-
Object.assign(params.element, { notes: params.notes });
|
|
10287
|
-
return __assign({}, SUCCESS);
|
|
10288
|
-
}
|
|
10289
|
-
function removeNotes(params) {
|
|
10290
|
-
if (typeof params !== 'object')
|
|
10291
|
-
return { error: MISSING_VALUE };
|
|
10292
|
-
if (typeof params.element !== 'object')
|
|
10293
|
-
return { error: INVALID_VALUES };
|
|
10294
|
-
if (params.element.notes)
|
|
10295
|
-
delete params.element.notes;
|
|
10296
|
-
return __assign({}, SUCCESS);
|
|
10297
|
-
}
|
|
10298
|
-
|
|
10299
10268
|
function drawUpdatedAt(drawDefinition, structureIds) {
|
|
10300
10269
|
var _a;
|
|
10301
10270
|
if (!drawDefinition)
|
|
@@ -10382,8 +10351,8 @@ function updateInContextMatchUp(_a) {
|
|
|
10382
10351
|
return { error: MISSING_MATCHUP };
|
|
10383
10352
|
}
|
|
10384
10353
|
addNotice({
|
|
10385
|
-
topic: UPDATE_INCONTEXT_MATCHUP,
|
|
10386
10354
|
payload: { inContextMatchUp: inContextMatchUp, tournamentId: tournamentId },
|
|
10355
|
+
topic: UPDATE_INCONTEXT_MATCHUP,
|
|
10387
10356
|
key: inContextMatchUp.matchUpId,
|
|
10388
10357
|
});
|
|
10389
10358
|
return __assign({}, SUCCESS);
|
|
@@ -10477,6 +10446,117 @@ function modifyPositionAssignmentsNotice(_a) {
|
|
|
10477
10446
|
return __assign({}, SUCCESS);
|
|
10478
10447
|
}
|
|
10479
10448
|
|
|
10449
|
+
function ensureSideLineUps(_a) {
|
|
10450
|
+
var _b, _c, _d;
|
|
10451
|
+
var inContextDualMatchUp = _a.inContextDualMatchUp, drawDefinition = _a.drawDefinition, tournamentId = _a.tournamentId, dualMatchUp = _a.dualMatchUp, eventId = _a.eventId;
|
|
10452
|
+
if (dualMatchUp && !((_b = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
10453
|
+
if (!inContextDualMatchUp) {
|
|
10454
|
+
inContextDualMatchUp = (_c = findDrawMatchUp({
|
|
10455
|
+
matchUpId: dualMatchUp.matchUpId,
|
|
10456
|
+
inContext: true,
|
|
10457
|
+
drawDefinition: drawDefinition,
|
|
10458
|
+
})) === null || _c === void 0 ? void 0 : _c.matchUp;
|
|
10459
|
+
}
|
|
10460
|
+
var extension = findExtension$2({
|
|
10461
|
+
element: drawDefinition,
|
|
10462
|
+
name: LINEUPS,
|
|
10463
|
+
}).extension;
|
|
10464
|
+
var lineUps_1 = makeDeepCopy((extension === null || extension === void 0 ? void 0 : extension.value) || {}, false, true);
|
|
10465
|
+
var extractSideDetail_1 = function (_a) {
|
|
10466
|
+
var displaySideNumber = _a.displaySideNumber, drawPosition = _a.drawPosition, sideNumber = _a.sideNumber;
|
|
10467
|
+
return ({ drawPosition: drawPosition, sideNumber: sideNumber, displaySideNumber: displaySideNumber });
|
|
10468
|
+
};
|
|
10469
|
+
dualMatchUp.sides = (_d = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _d === void 0 ? void 0 : _d.map(function (side) {
|
|
10470
|
+
var participantId = side.participantId;
|
|
10471
|
+
return __assign(__assign({}, extractSideDetail_1(side)), { lineUp: (participantId && lineUps_1[participantId]) || [] });
|
|
10472
|
+
});
|
|
10473
|
+
modifyMatchUpNotice({
|
|
10474
|
+
context: 'ensureSidLineUps',
|
|
10475
|
+
matchUp: dualMatchUp,
|
|
10476
|
+
drawDefinition: drawDefinition,
|
|
10477
|
+
tournamentId: tournamentId,
|
|
10478
|
+
eventId: eventId,
|
|
10479
|
+
});
|
|
10480
|
+
}
|
|
10481
|
+
}
|
|
10482
|
+
|
|
10483
|
+
function copyTieFormat(tieFormat) {
|
|
10484
|
+
if (!tieFormat)
|
|
10485
|
+
return undefined;
|
|
10486
|
+
return makeDeepCopy(tieFormat, false, true);
|
|
10487
|
+
}
|
|
10488
|
+
|
|
10489
|
+
function scoreHasValue(params) {
|
|
10490
|
+
var _a, _b;
|
|
10491
|
+
var matchUp = params === null || params === void 0 ? void 0 : params.matchUp;
|
|
10492
|
+
var score = (params === null || params === void 0 ? void 0 : params.score) || (matchUp === null || matchUp === void 0 ? void 0 : matchUp.score);
|
|
10493
|
+
var firstSet = (_a = score === null || score === void 0 ? void 0 : score.sets) === null || _a === void 0 ? void 0 : _a[0];
|
|
10494
|
+
var _c = firstSet || {}, side1Score = _c.side1Score, side2Score = _c.side2Score, side1TiebreakScore = _c.side1TiebreakScore, side2TiebreakScore = _c.side2TiebreakScore, side1PointScore = _c.side1PointScore, side2PointScore = _c.side2PointScore;
|
|
10495
|
+
var firstSetScore = side1Score ||
|
|
10496
|
+
side2Score ||
|
|
10497
|
+
side1TiebreakScore ||
|
|
10498
|
+
side2TiebreakScore ||
|
|
10499
|
+
side1PointScore ||
|
|
10500
|
+
side2PointScore;
|
|
10501
|
+
var hasValue = ((_b = score === null || score === void 0 ? void 0 : score.sets) === null || _b === void 0 ? void 0 : _b.length) > 1 || firstSetScore;
|
|
10502
|
+
return !!hasValue;
|
|
10503
|
+
}
|
|
10504
|
+
|
|
10505
|
+
function isDirectingMatchUpStatus(_a) {
|
|
10506
|
+
var matchUpStatus = _a.matchUpStatus;
|
|
10507
|
+
return directingMatchUpStatuses.includes(matchUpStatus);
|
|
10508
|
+
}
|
|
10509
|
+
function isActiveMatchUpStatus(_a) {
|
|
10510
|
+
var matchUpStatus = _a.matchUpStatus;
|
|
10511
|
+
return activeMatchUpStatuses.includes(matchUpStatus);
|
|
10512
|
+
}
|
|
10513
|
+
function isNonDirectingMatchUpStatus(_a) {
|
|
10514
|
+
var matchUpStatus = _a.matchUpStatus;
|
|
10515
|
+
return nonDirectingMatchUpStatuses.includes(matchUpStatus);
|
|
10516
|
+
}
|
|
10517
|
+
|
|
10518
|
+
function isActiveMatchUp(_a) {
|
|
10519
|
+
var _b;
|
|
10520
|
+
var matchUpStatus = _a.matchUpStatus, winningSide = _a.winningSide, tieMatchUps = _a.tieMatchUps, sides = _a.sides, score = _a.score;
|
|
10521
|
+
var participantAssigned = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
10522
|
+
var participantId = _a.participantId;
|
|
10523
|
+
return participantId;
|
|
10524
|
+
});
|
|
10525
|
+
var activeTieMatchUps = (_b = tieMatchUps === null || tieMatchUps === void 0 ? void 0 : tieMatchUps.filter(isActiveMatchUp)) === null || _b === void 0 ? void 0 : _b.length;
|
|
10526
|
+
var scoreExists = scoreHasValue({ score: score });
|
|
10527
|
+
return (scoreExists ||
|
|
10528
|
+
activeTieMatchUps ||
|
|
10529
|
+
(winningSide && participantAssigned) || // if winningSide and no participant assigned => "produced" WALKOVER
|
|
10530
|
+
// must exclude IN_PROGRESS as this is automatically set by updateTieMatchUpScore
|
|
10531
|
+
// must exclude WALKOVER and DEFAULTED as "produced" scenarios do not imply a winningSide
|
|
10532
|
+
(matchUpStatus &&
|
|
10533
|
+
isActiveMatchUpStatus({ matchUpStatus: matchUpStatus }) &&
|
|
10534
|
+
![DEFAULTED, WALKOVER$2, IN_PROGRESS$1].includes(matchUpStatus)));
|
|
10535
|
+
}
|
|
10536
|
+
|
|
10537
|
+
function addNotes(params) {
|
|
10538
|
+
var _a;
|
|
10539
|
+
if (typeof params !== 'object')
|
|
10540
|
+
return { error: MISSING_VALUE };
|
|
10541
|
+
if (typeof params.element !== 'object')
|
|
10542
|
+
return { error: INVALID_VALUES };
|
|
10543
|
+
if (!params.notes)
|
|
10544
|
+
return { error: MISSING_VALUE };
|
|
10545
|
+
if (typeof params.notes !== 'string' && !((_a = params.notes) === null || _a === void 0 ? void 0 : _a.testing))
|
|
10546
|
+
return { error: INVALID_VALUES };
|
|
10547
|
+
Object.assign(params.element, { notes: params.notes });
|
|
10548
|
+
return __assign({}, SUCCESS);
|
|
10549
|
+
}
|
|
10550
|
+
function removeNotes(params) {
|
|
10551
|
+
if (typeof params !== 'object')
|
|
10552
|
+
return { error: MISSING_VALUE };
|
|
10553
|
+
if (typeof params.element !== 'object')
|
|
10554
|
+
return { error: INVALID_VALUES };
|
|
10555
|
+
if (params.element.notes)
|
|
10556
|
+
delete params.element.notes;
|
|
10557
|
+
return __assign({}, SUCCESS);
|
|
10558
|
+
}
|
|
10559
|
+
|
|
10480
10560
|
var hasParticipantId = function (o) { return o === null || o === void 0 ? void 0 : o.participantId; };
|
|
10481
10561
|
|
|
10482
10562
|
function createSubOrderMap(_a) {
|
|
@@ -11433,7 +11513,7 @@ function modifyMatchUpScore(_a) {
|
|
|
11433
11513
|
if (isDualMatchUp && drawDefinition) {
|
|
11434
11514
|
if (matchUpId && matchUp.matchUpId !== matchUpId) {
|
|
11435
11515
|
// the modification is to be applied to a tieMatchUp
|
|
11436
|
-
var findResult =
|
|
11516
|
+
var findResult = findDrawMatchUp({
|
|
11437
11517
|
drawDefinition: drawDefinition,
|
|
11438
11518
|
matchUpId: matchUpId,
|
|
11439
11519
|
event: event,
|
|
@@ -11467,7 +11547,7 @@ function modifyMatchUpScore(_a) {
|
|
|
11467
11547
|
if (removeWinningSide)
|
|
11468
11548
|
matchUp.winningSide = undefined;
|
|
11469
11549
|
if (!structure && drawDefinition) {
|
|
11470
|
-
(structure =
|
|
11550
|
+
(structure = findDrawMatchUp({
|
|
11471
11551
|
drawDefinition: drawDefinition,
|
|
11472
11552
|
matchUpId: matchUpId,
|
|
11473
11553
|
event: event,
|
|
@@ -11606,7 +11686,7 @@ function modifyMatchUpScore(_a) {
|
|
|
11606
11686
|
function updateTieMatchUpScore$1(_a) {
|
|
11607
11687
|
var _b, _c;
|
|
11608
11688
|
var tournamentRecord = _a.tournamentRecord, exitWhenNoValues = _a.exitWhenNoValues, drawDefinition = _a.drawDefinition, matchUpStatus = _a.matchUpStatus, removeScore = _a.removeScore, matchUpsMap = _a.matchUpsMap, matchUpId = _a.matchUpId, event = _a.event;
|
|
11609
|
-
var result =
|
|
11689
|
+
var result = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId });
|
|
11610
11690
|
if (result.error)
|
|
11611
11691
|
return result;
|
|
11612
11692
|
if (!result.matchUp)
|
|
@@ -11614,6 +11694,12 @@ function updateTieMatchUpScore$1(_a) {
|
|
|
11614
11694
|
var matchUp = result.matchUp, structure = result.structure;
|
|
11615
11695
|
if (!matchUp.tieMatchUps)
|
|
11616
11696
|
return { error: INVALID_MATCHUP };
|
|
11697
|
+
ensureSideLineUps({
|
|
11698
|
+
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
11699
|
+
eventId: event === null || event === void 0 ? void 0 : event.eventId,
|
|
11700
|
+
dualMatchUp: matchUp,
|
|
11701
|
+
drawDefinition: drawDefinition,
|
|
11702
|
+
});
|
|
11617
11703
|
var extension = findExtension({
|
|
11618
11704
|
name: DISABLE_AUTO_CALC,
|
|
11619
11705
|
element: matchUp,
|
|
@@ -21744,7 +21830,7 @@ function addEventTimeItem(params) {
|
|
|
21744
21830
|
|
|
21745
21831
|
function addMatchUpTimeItem(_a) {
|
|
21746
21832
|
var removePriorValues = _a.removePriorValues, tournamentRecord = _a.tournamentRecord, duplicateValues = _a.duplicateValues, drawDefinition = _a.drawDefinition, disableNotice = _a.disableNotice, matchUpId = _a.matchUpId, timeItem = _a.timeItem, event = _a.event;
|
|
21747
|
-
var matchUp =
|
|
21833
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
21748
21834
|
if (!matchUp)
|
|
21749
21835
|
return { error: MATCHUP_NOT_FOUND };
|
|
21750
21836
|
var result = addTimeItem({
|
|
@@ -21766,7 +21852,7 @@ function addMatchUpTimeItem(_a) {
|
|
|
21766
21852
|
}
|
|
21767
21853
|
function resetMatchUpTimeItems(_a) {
|
|
21768
21854
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, event = _a.event;
|
|
21769
|
-
var matchUp =
|
|
21855
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
21770
21856
|
if (!matchUp)
|
|
21771
21857
|
return { error: MATCHUP_NOT_FOUND };
|
|
21772
21858
|
matchUp.timeItems = [];
|
|
@@ -21788,7 +21874,7 @@ function allocateTeamMatchUpCourts$1(_a) {
|
|
|
21788
21874
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
21789
21875
|
if (!matchUpId)
|
|
21790
21876
|
return { error: MISSING_MATCHUP_ID };
|
|
21791
|
-
var result =
|
|
21877
|
+
var result = findDrawMatchUp({
|
|
21792
21878
|
drawDefinition: drawDefinition,
|
|
21793
21879
|
matchUpId: matchUpId,
|
|
21794
21880
|
});
|
|
@@ -21931,7 +22017,7 @@ function addMatchUpScheduledTime$2(params) {
|
|
|
21931
22017
|
if (!validTimeValue(scheduledTime))
|
|
21932
22018
|
return decorateResult({ result: { error: INVALID_TIME }, stack: stack });
|
|
21933
22019
|
if (!matchUp) {
|
|
21934
|
-
var result =
|
|
22020
|
+
var result = findDrawMatchUp({ drawDefinition: drawDefinition, matchUpId: matchUpId });
|
|
21935
22021
|
if (result.error)
|
|
21936
22022
|
return decorateResult({ result: result, stack: stack });
|
|
21937
22023
|
matchUp = result.matchUp;
|
|
@@ -21982,7 +22068,7 @@ function addMatchUpTimeModifiers(_a) {
|
|
|
21982
22068
|
stack: stack,
|
|
21983
22069
|
});
|
|
21984
22070
|
if (!matchUp) {
|
|
21985
|
-
var result =
|
|
22071
|
+
var result = findDrawMatchUp({ drawDefinition: drawDefinition, matchUpId: matchUpId });
|
|
21986
22072
|
if (result.error)
|
|
21987
22073
|
return decorateResult({ result: result, stack: stack });
|
|
21988
22074
|
matchUp = result.matchUp;
|
|
@@ -22047,7 +22133,7 @@ function addMatchUpScheduleItems$2(_a) {
|
|
|
22047
22133
|
var stack = 'drawEngine.addMatchUpScheduleItems';
|
|
22048
22134
|
var matchUp, warning;
|
|
22049
22135
|
if (!drawMatchUps) {
|
|
22050
|
-
var result =
|
|
22136
|
+
var result = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId });
|
|
22051
22137
|
if (result.error)
|
|
22052
22138
|
return result;
|
|
22053
22139
|
matchUp = result.matchUp;
|
|
@@ -22313,7 +22399,7 @@ function addMatchUpStartTime$2(_a) {
|
|
|
22313
22399
|
return { error: MISSING_MATCHUP_ID };
|
|
22314
22400
|
if (!validTimeValue(startTime))
|
|
22315
22401
|
return { error: INVALID_TIME };
|
|
22316
|
-
var matchUp =
|
|
22402
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
22317
22403
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
22318
22404
|
var timeItems = (_b = matchUp === null || matchUp === void 0 ? void 0 : matchUp.timeItems) !== null && _b !== void 0 ? _b : [];
|
|
22319
22405
|
var earliestRelevantTimeValue = timeItems
|
|
@@ -22354,7 +22440,7 @@ function addMatchUpEndTime$2(_a) {
|
|
|
22354
22440
|
return { error: MISSING_MATCHUP_ID };
|
|
22355
22441
|
if (!validTimeValue(endTime))
|
|
22356
22442
|
return { error: INVALID_TIME };
|
|
22357
|
-
var matchUp =
|
|
22443
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
22358
22444
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
22359
22445
|
var timeItems = (_b = matchUp === null || matchUp === void 0 ? void 0 : matchUp.timeItems) !== null && _b !== void 0 ? _b : [];
|
|
22360
22446
|
var latestRelevantTimeValue = timeItems
|
|
@@ -22397,7 +22483,7 @@ function addMatchUpStopTime$2(_a) {
|
|
|
22397
22483
|
return { error: MISSING_MATCHUP_ID };
|
|
22398
22484
|
if (!validTimeValue(stopTime))
|
|
22399
22485
|
return { error: INVALID_TIME };
|
|
22400
|
-
var matchUp =
|
|
22486
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
22401
22487
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
22402
22488
|
var timeItems = (_b = matchUp === null || matchUp === void 0 ? void 0 : matchUp.timeItems) !== null && _b !== void 0 ? _b : [];
|
|
22403
22489
|
// can't add a STOP_TIME if the matchUp is not STARTED or RESUMED, or has START_TIME
|
|
@@ -22458,7 +22544,7 @@ function addMatchUpResumeTime$2(_a) {
|
|
|
22458
22544
|
return { error: MISSING_MATCHUP_ID };
|
|
22459
22545
|
if (!validTimeValue(resumeTime))
|
|
22460
22546
|
return { error: INVALID_TIME };
|
|
22461
|
-
var matchUp =
|
|
22547
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
22462
22548
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
22463
22549
|
var timeItems = (_b = matchUp === null || matchUp === void 0 ? void 0 : matchUp.timeItems) !== null && _b !== void 0 ? _b : [];
|
|
22464
22550
|
// can't add a RESUME_TIME if the matchUp is not STOPPED, or if it has ENDED
|
|
@@ -24293,8 +24379,8 @@ function updateSideLineUp(_a) {
|
|
|
24293
24379
|
element: drawDefinition,
|
|
24294
24380
|
name: LINEUPS,
|
|
24295
24381
|
}).extension;
|
|
24296
|
-
var
|
|
24297
|
-
var lineUp =
|
|
24382
|
+
var lineUps = (existingExtension === null || existingExtension === void 0 ? void 0 : existingExtension.value) || {};
|
|
24383
|
+
var lineUp = makeDeepCopy(lineUps[teamParticipantId], false, true);
|
|
24298
24384
|
if (sideExists) {
|
|
24299
24385
|
(_e = matchUp === null || matchUp === void 0 ? void 0 : matchUp.sides) === null || _e === void 0 ? void 0 : _e.forEach(function (side) {
|
|
24300
24386
|
if (side.sideNumber === drawPositionSideNumber) {
|
|
@@ -24309,13 +24395,12 @@ function updateSideLineUp(_a) {
|
|
|
24309
24395
|
return __assign(__assign({}, existingSide), { sideNumber: sideNumber });
|
|
24310
24396
|
});
|
|
24311
24397
|
var targetSide = matchUp.sides.find(function (side) { return side.sideNumber === drawPositionSideNumber; });
|
|
24312
|
-
if (targetSide)
|
|
24398
|
+
if (targetSide)
|
|
24313
24399
|
targetSide.lineUp = lineUp;
|
|
24314
|
-
}
|
|
24315
24400
|
}
|
|
24316
24401
|
modifyMatchUpNotice({
|
|
24317
24402
|
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
24318
|
-
context: '
|
|
24403
|
+
context: 'updateSidLineUp',
|
|
24319
24404
|
eventId: event === null || event === void 0 ? void 0 : event.eventId,
|
|
24320
24405
|
drawDefinition: drawDefinition,
|
|
24321
24406
|
matchUp: matchUp,
|
|
@@ -25290,13 +25375,15 @@ function removeLineUpSubstitutions(_a) {
|
|
|
25290
25375
|
if (!Array.isArray(lineUp))
|
|
25291
25376
|
return;
|
|
25292
25377
|
var participantAssignments = {};
|
|
25293
|
-
var permutations = unique(lineUp
|
|
25378
|
+
var permutations = unique(lineUp
|
|
25379
|
+
.flatMap(function (_a) {
|
|
25294
25380
|
var collectionAssignments = _a.collectionAssignments;
|
|
25295
|
-
return collectionAssignments.map(function (_a) {
|
|
25381
|
+
return collectionAssignments === null || collectionAssignments === void 0 ? void 0 : collectionAssignments.map(function (_a) {
|
|
25296
25382
|
var collectionId = _a.collectionId, collectionPosition = _a.collectionPosition;
|
|
25297
25383
|
return [collectionId, collectionPosition].join('|');
|
|
25298
25384
|
});
|
|
25299
|
-
})
|
|
25385
|
+
})
|
|
25386
|
+
.filter(Boolean));
|
|
25300
25387
|
permutations.forEach(function (permutation) {
|
|
25301
25388
|
var _a = __read(permutation.split('|'), 2), collectionId = _a[0], position = _a[1];
|
|
25302
25389
|
var collectionPosition = parseInt(position);
|
|
@@ -27925,7 +28012,7 @@ function setMatchUpStatus$2(params) {
|
|
|
27925
28012
|
matchUp: matchUp,
|
|
27926
28013
|
});
|
|
27927
28014
|
if (matchUpTieId) {
|
|
27928
|
-
var dualMatchUp =
|
|
28015
|
+
var dualMatchUp = findDrawMatchUp({
|
|
27929
28016
|
matchUpId: matchUpTieId,
|
|
27930
28017
|
inContext: true,
|
|
27931
28018
|
drawDefinition: drawDefinition,
|
|
@@ -28089,7 +28176,7 @@ function setMatchUpFormat$1(params) {
|
|
|
28089
28176
|
return { error: UNRECOGNIZED_MATCHUP_FORMAT };
|
|
28090
28177
|
var stack = 'setMatchUpFormat';
|
|
28091
28178
|
if (matchUpId) {
|
|
28092
|
-
var result =
|
|
28179
|
+
var result = findDrawMatchUp({
|
|
28093
28180
|
drawDefinition: drawDefinition,
|
|
28094
28181
|
matchUpId: matchUpId,
|
|
28095
28182
|
event: event,
|
|
@@ -30722,7 +30809,7 @@ function getTieFormat$1(_a) {
|
|
|
30722
30809
|
else if (matchUpId) {
|
|
30723
30810
|
// if matchUpId is present, structure and drawDefinition are always required
|
|
30724
30811
|
if (drawDefinition && (!matchUp || !structure)) {
|
|
30725
|
-
var result =
|
|
30812
|
+
var result = findDrawMatchUp({
|
|
30726
30813
|
drawDefinition: drawDefinition,
|
|
30727
30814
|
matchUpId: matchUpId,
|
|
30728
30815
|
});
|
|
@@ -31460,7 +31547,7 @@ function orderCollectionDefinitions$1(_a) {
|
|
|
31460
31547
|
}
|
|
31461
31548
|
else if (matchUpId) {
|
|
31462
31549
|
var result = drawDefinition &&
|
|
31463
|
-
|
|
31550
|
+
findDrawMatchUp({
|
|
31464
31551
|
drawDefinition: drawDefinition,
|
|
31465
31552
|
matchUpId: matchUpId,
|
|
31466
31553
|
});
|
|
@@ -31765,7 +31852,7 @@ function removeCollectionDefinition$1(_a) {
|
|
|
31765
31852
|
});
|
|
31766
31853
|
if (result_1.error)
|
|
31767
31854
|
return result_1;
|
|
31768
|
-
result_1 =
|
|
31855
|
+
result_1 = findDrawMatchUp({
|
|
31769
31856
|
drawDefinition: drawDefinition,
|
|
31770
31857
|
matchUpId: matchUpId,
|
|
31771
31858
|
});
|
|
@@ -32705,7 +32792,7 @@ function findMatchUp(_a) {
|
|
|
32705
32792
|
contextProfile: contextProfile,
|
|
32706
32793
|
inContext: inContext,
|
|
32707
32794
|
}).participants, tournamentParticipants = _g === void 0 ? [] : _g;
|
|
32708
|
-
var _h =
|
|
32795
|
+
var _h = findDrawMatchUp({
|
|
32709
32796
|
context: inContext ? additionalContext : undefined,
|
|
32710
32797
|
tournamentParticipants: tournamentParticipants,
|
|
32711
32798
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
@@ -36813,7 +36900,7 @@ function checkInParticipant$1(_a) {
|
|
|
36813
36900
|
tournamentParticipants !== null && tournamentParticipants !== void 0 ? tournamentParticipants : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
36814
36901
|
if (tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.length) {
|
|
36815
36902
|
if (!matchUp && drawDefinition) {
|
|
36816
|
-
var result_1 =
|
|
36903
|
+
var result_1 = findDrawMatchUp({
|
|
36817
36904
|
tournamentParticipants: tournamentParticipants,
|
|
36818
36905
|
inContext: true,
|
|
36819
36906
|
drawDefinition: drawDefinition,
|
|
@@ -36856,7 +36943,7 @@ function checkOutParticipant$1(_a) {
|
|
|
36856
36943
|
tournamentParticipants =
|
|
36857
36944
|
tournamentParticipants !== null && tournamentParticipants !== void 0 ? tournamentParticipants : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
36858
36945
|
if (!matchUp) {
|
|
36859
|
-
var result =
|
|
36946
|
+
var result = findDrawMatchUp({
|
|
36860
36947
|
tournamentParticipants: tournamentParticipants,
|
|
36861
36948
|
inContext: true,
|
|
36862
36949
|
drawDefinition: drawDefinition,
|
|
@@ -36975,7 +37062,7 @@ function removeMatchUpCourtAssignment$1(params) {
|
|
|
36975
37062
|
}), drawDefinition = _c.drawDefinition, event = _c.event;
|
|
36976
37063
|
if (!drawDefinition)
|
|
36977
37064
|
return { error: MISSING_DRAW_DEFINITION };
|
|
36978
|
-
var result =
|
|
37065
|
+
var result = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId });
|
|
36979
37066
|
if (result.error)
|
|
36980
37067
|
return result;
|
|
36981
37068
|
if (((_a = result === null || result === void 0 ? void 0 : result.matchUp) === null || _a === void 0 ? void 0 : _a.matchUpType) === TEAM_MATCHUP) {
|
|
@@ -39186,7 +39273,7 @@ function matchUpActions$2(_a) {
|
|
|
39186
39273
|
});
|
|
39187
39274
|
var otherFlightEntries = (_b = specifiedPolicyDefinitions === null || specifiedPolicyDefinitions === void 0 ? void 0 : specifiedPolicyDefinitions[POLICY_TYPE_POSITION_ACTIONS]) === null || _b === void 0 ? void 0 : _b.otherFlightEntries;
|
|
39188
39275
|
var drawId = drawDefinition.drawId;
|
|
39189
|
-
var _12 =
|
|
39276
|
+
var _12 = findDrawMatchUp({
|
|
39190
39277
|
drawDefinition: drawDefinition,
|
|
39191
39278
|
matchUpId: matchUpId,
|
|
39192
39279
|
event: event,
|
|
@@ -40076,7 +40163,7 @@ function removeCourtAssignment(_a) {
|
|
|
40076
40163
|
(drawDefinition = findEvent({ tournamentRecord: tournamentRecord, drawId: drawId }).drawDefinition);
|
|
40077
40164
|
}
|
|
40078
40165
|
if (drawDefinition) {
|
|
40079
|
-
(matchUp =
|
|
40166
|
+
(matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, matchUpId: matchUpId }).matchUp);
|
|
40080
40167
|
}
|
|
40081
40168
|
else {
|
|
40082
40169
|
if (!tournamentRecord)
|
|
@@ -50099,13 +50186,13 @@ function resetMatchUpLineUps$1(_a) {
|
|
|
50099
50186
|
var _d = _a.inheritance, inheritance = _d === void 0 ? true : _d, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, event = _a.event;
|
|
50100
50187
|
if (!drawDefinition)
|
|
50101
50188
|
return { error: MISSING_DRAW_DEFINITION };
|
|
50102
|
-
var matchUp = (_b =
|
|
50189
|
+
var matchUp = (_b = findDrawMatchUp({
|
|
50103
50190
|
drawDefinition: drawDefinition,
|
|
50104
50191
|
matchUpId: matchUpId,
|
|
50105
50192
|
})) === null || _b === void 0 ? void 0 : _b.matchUp;
|
|
50106
50193
|
if (!(matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieMatchUps))
|
|
50107
50194
|
return { error: INVALID_MATCHUP };
|
|
50108
|
-
var inContextMatchUp = (_c =
|
|
50195
|
+
var inContextMatchUp = (_c = findDrawMatchUp({
|
|
50109
50196
|
inContext: true,
|
|
50110
50197
|
drawDefinition: drawDefinition,
|
|
50111
50198
|
matchUpId: matchUpId,
|
|
@@ -50215,7 +50302,7 @@ function removeDelegatedOutcome$1(_a) {
|
|
|
50215
50302
|
return { error: MISSING_DRAW_DEFINITION };
|
|
50216
50303
|
if (!matchUpId)
|
|
50217
50304
|
return { error: MISSING_MATCHUP_ID };
|
|
50218
|
-
var matchUp =
|
|
50305
|
+
var matchUp = findDrawMatchUp({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId }).matchUp;
|
|
50219
50306
|
if (!matchUp)
|
|
50220
50307
|
return { error: MATCHUP_NOT_FOUND };
|
|
50221
50308
|
return removeExtension$1({
|
|
@@ -50785,7 +50872,7 @@ function setDelegatedOutcome$1(_a) {
|
|
|
50785
50872
|
if (!matchUp && !matchUpId)
|
|
50786
50873
|
return { error: MISSING_MATCHUP };
|
|
50787
50874
|
if (!matchUp) {
|
|
50788
|
-
var result =
|
|
50875
|
+
var result = findDrawMatchUp({
|
|
50789
50876
|
drawDefinition: drawDefinition,
|
|
50790
50877
|
matchUpId: matchUpId,
|
|
50791
50878
|
});
|
|
@@ -50838,7 +50925,7 @@ function disableTieAutoCalc$1(_a) {
|
|
|
50838
50925
|
var drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, event = _a.event;
|
|
50839
50926
|
if (!drawDefinition)
|
|
50840
50927
|
return { error: MISSING_DRAW_DEFINITION };
|
|
50841
|
-
var matchUp =
|
|
50928
|
+
var matchUp = findDrawMatchUp({
|
|
50842
50929
|
drawDefinition: drawDefinition,
|
|
50843
50930
|
matchUpId: matchUpId,
|
|
50844
50931
|
event: event,
|
|
@@ -50853,7 +50940,7 @@ function enableTieAutoCalc$1(_a) {
|
|
|
50853
50940
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, event = _a.event;
|
|
50854
50941
|
if (!drawDefinition)
|
|
50855
50942
|
return { error: MISSING_DRAW_DEFINITION };
|
|
50856
|
-
var matchUp =
|
|
50943
|
+
var matchUp = findDrawMatchUp({
|
|
50857
50944
|
drawDefinition: drawDefinition,
|
|
50858
50945
|
matchUpId: matchUpId,
|
|
50859
50946
|
event: event,
|
|
@@ -51034,7 +51121,7 @@ var matchUpGovernor = {
|
|
|
51034
51121
|
removeDelegatedOutcome: removeDelegatedOutcome$1,
|
|
51035
51122
|
drawMatic: drawMatic$1,
|
|
51036
51123
|
addMatchUpOfficial: addMatchUpOfficial$2,
|
|
51037
|
-
findMatchUp:
|
|
51124
|
+
findMatchUp: publicFindDrawMatchUp,
|
|
51038
51125
|
getRoundMatchUps: getRoundMatchUps$1,
|
|
51039
51126
|
validDrawPositions: validDrawPositions,
|
|
51040
51127
|
validateScore: validateScore,
|
|
@@ -57112,14 +57199,14 @@ function getTieMatchUpContext(_a) {
|
|
|
57112
57199
|
return { error: EVENT_NOT_FOUND };
|
|
57113
57200
|
var matchUpsMap = getMatchUpsMap({ drawDefinition: drawDefinition });
|
|
57114
57201
|
// tieMatchUp is matchUpType: SINGLES or DOUBLES
|
|
57115
|
-
var tieMatchUp =
|
|
57202
|
+
var tieMatchUp = findDrawMatchUp({
|
|
57116
57203
|
matchUpId: tieMatchUpId,
|
|
57117
57204
|
drawDefinition: drawDefinition,
|
|
57118
57205
|
matchUpsMap: matchUpsMap,
|
|
57119
57206
|
}).matchUp;
|
|
57120
57207
|
if (!tieMatchUp)
|
|
57121
57208
|
return { error: MATCHUP_NOT_FOUND };
|
|
57122
|
-
var _c =
|
|
57209
|
+
var _c = findDrawMatchUp({
|
|
57123
57210
|
tournamentParticipants: tournamentRecord.participants,
|
|
57124
57211
|
matchUpId: tieMatchUpId,
|
|
57125
57212
|
inContext: true,
|
|
@@ -57142,12 +57229,12 @@ function getTieMatchUpContext(_a) {
|
|
|
57142
57229
|
participantIds: participantIds,
|
|
57143
57230
|
},
|
|
57144
57231
|
}).participants;
|
|
57145
|
-
var dualMatchUp =
|
|
57232
|
+
var dualMatchUp = findDrawMatchUp({
|
|
57146
57233
|
matchUpId: matchUpTieId,
|
|
57147
57234
|
drawDefinition: drawDefinition,
|
|
57148
57235
|
matchUpsMap: matchUpsMap,
|
|
57149
57236
|
}).matchUp;
|
|
57150
|
-
var inContextDualMatchUp =
|
|
57237
|
+
var inContextDualMatchUp = findDrawMatchUp({
|
|
57151
57238
|
matchUpId: matchUpTieId,
|
|
57152
57239
|
inContext: true,
|
|
57153
57240
|
drawDefinition: drawDefinition,
|
|
@@ -57164,7 +57251,7 @@ function getTieMatchUpContext(_a) {
|
|
|
57164
57251
|
|
|
57165
57252
|
function assignTieMatchUpParticipantId(params) {
|
|
57166
57253
|
var e_1, _a;
|
|
57167
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
57254
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
57168
57255
|
var matchUpContext = getTieMatchUpContext(params);
|
|
57169
57256
|
if (matchUpContext.error)
|
|
57170
57257
|
return matchUpContext;
|
|
@@ -57189,8 +57276,9 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57189
57276
|
}
|
|
57190
57277
|
teamParticipantId =
|
|
57191
57278
|
teamParticipantId ||
|
|
57192
|
-
(params.sideNumber
|
|
57193
|
-
(
|
|
57279
|
+
(params.sideNumber
|
|
57280
|
+
? (_d = (_c = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _c === void 0 ? void 0 : _c.find(function (side) { return side.sideNumber === params.sideNumber; })) === null || _d === void 0 ? void 0 : _d.participantId
|
|
57281
|
+
: undefined);
|
|
57194
57282
|
var participantToAssign = (_f = (_e = getParticipants$1({
|
|
57195
57283
|
participantFilters: { participantIds: [participantId] },
|
|
57196
57284
|
tournamentRecord: tournamentRecord,
|
|
@@ -57243,29 +57331,19 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57243
57331
|
var collectionDefinition = (_l = tieFormat.collectionDefinitions) === null || _l === void 0 ? void 0 : _l.find(function (collectionDefinition) { return collectionDefinition.collectionId === collectionId; });
|
|
57244
57332
|
if (!collectionDefinition)
|
|
57245
57333
|
return { error: MISSING_COLLECTION_DEFINITION };
|
|
57246
|
-
|
|
57247
|
-
|
|
57248
|
-
|
|
57249
|
-
|
|
57250
|
-
|
|
57251
|
-
|
|
57252
|
-
|
|
57253
|
-
|
|
57254
|
-
|
|
57255
|
-
|
|
57256
|
-
if (dualMatchUp) {
|
|
57257
|
-
dualMatchUp.sides = (_o = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _o === void 0 ? void 0 : _o.map(function (side) {
|
|
57258
|
-
var participantId = side.participantId;
|
|
57259
|
-
return __assign(__assign({}, extractSideDetail_1(side)), { lineUp: (participantId && lineUps_1[participantId]) || [] });
|
|
57260
|
-
});
|
|
57261
|
-
}
|
|
57262
|
-
}
|
|
57263
|
-
var dualMatchUpSide = (_p = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _p === void 0 ? void 0 : _p.find(function (side) { return side.sideNumber === sideNumber; });
|
|
57264
|
-
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 === sideNumber; });
|
|
57265
|
-
var lineUp = (_r = dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.lineUp) !== null && _r !== void 0 ? _r : (_s = getTeamLineUp({
|
|
57334
|
+
ensureSideLineUps({
|
|
57335
|
+
tournamentId: tournamentRecord.tournamentId,
|
|
57336
|
+
eventId: event.eventId,
|
|
57337
|
+
inContextDualMatchUp: inContextDualMatchUp,
|
|
57338
|
+
drawDefinition: drawDefinition,
|
|
57339
|
+
dualMatchUp: dualMatchUp,
|
|
57340
|
+
});
|
|
57341
|
+
var dualMatchUpSide = (_m = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _m === void 0 ? void 0 : _m.find(function (side) { return side.sideNumber === sideNumber; });
|
|
57342
|
+
var tieMatchUpSide = (_o = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _o === void 0 ? void 0 : _o.find(function (side) { return side.sideNumber === sideNumber; });
|
|
57343
|
+
var lineUp = (_p = dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.lineUp) !== null && _p !== void 0 ? _p : (_q = getTeamLineUp({
|
|
57266
57344
|
participantId: teamParticipantId,
|
|
57267
57345
|
drawDefinition: drawDefinition,
|
|
57268
|
-
})) === null ||
|
|
57346
|
+
})) === null || _q === void 0 ? void 0 : _q.lineUp;
|
|
57269
57347
|
var targetAssignments = lineUp === null || lineUp === void 0 ? void 0 : lineUp.filter(function (participantAssignment) {
|
|
57270
57348
|
var _a;
|
|
57271
57349
|
return (_a = participantAssignment.collectionAssignments) === null || _a === void 0 ? void 0 : _a.find(function (assignment) {
|
|
@@ -57292,7 +57370,7 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57292
57370
|
if (removeResult.error)
|
|
57293
57371
|
return decorateResult({ result: removeResult, stack: stack });
|
|
57294
57372
|
var modifiedLineUp = removeResult.modifiedLineUp;
|
|
57295
|
-
var
|
|
57373
|
+
var deletedParticipantId;
|
|
57296
57374
|
if (matchUpType === DOUBLES$1) {
|
|
57297
57375
|
if (participantType !== PAIR) {
|
|
57298
57376
|
var result = updateLineUp({
|
|
@@ -57311,7 +57389,7 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57311
57389
|
});
|
|
57312
57390
|
if (result.error)
|
|
57313
57391
|
return result;
|
|
57314
|
-
|
|
57392
|
+
deletedParticipantId = result.deletedParticipantId;
|
|
57315
57393
|
if (dualMatchUpSide)
|
|
57316
57394
|
dualMatchUpSide.lineUp = modifiedLineUp;
|
|
57317
57395
|
if (dualMatchUp) {
|
|
@@ -57369,9 +57447,9 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57369
57447
|
context: stack,
|
|
57370
57448
|
drawDefinition: drawDefinition,
|
|
57371
57449
|
});
|
|
57372
|
-
if (
|
|
57450
|
+
if (deletedParticipantId) {
|
|
57373
57451
|
var error = deleteParticipants({
|
|
57374
|
-
participantIds: [
|
|
57452
|
+
participantIds: [deletedParticipantId],
|
|
57375
57453
|
tournamentRecord: tournamentRecord,
|
|
57376
57454
|
}).error;
|
|
57377
57455
|
if (error)
|
|
@@ -57380,7 +57458,7 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57380
57458
|
return __assign(__assign({}, SUCCESS), { modifiedLineUp: modifiedLineUp });
|
|
57381
57459
|
function addParticipantId2Pair(_a) {
|
|
57382
57460
|
var side = _a.side;
|
|
57383
|
-
var
|
|
57461
|
+
var deletedParticipantId;
|
|
57384
57462
|
if (!side.participant) {
|
|
57385
57463
|
var newPairParticipant = {
|
|
57386
57464
|
individualParticipantIds: [participantId],
|
|
@@ -57421,11 +57499,11 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
57421
57499
|
else {
|
|
57422
57500
|
// check if there is a pairParticipant that includes both individualParticipantIds
|
|
57423
57501
|
// if there is, use that and delete the PAIR participant with only one [individualParticipantId]
|
|
57424
|
-
|
|
57502
|
+
deletedParticipantId = participant === null || participant === void 0 ? void 0 : participant.participantId;
|
|
57425
57503
|
}
|
|
57426
57504
|
}
|
|
57427
57505
|
}
|
|
57428
|
-
return __assign(__assign({}, SUCCESS), {
|
|
57506
|
+
return __assign(__assign({}, SUCCESS), { deletedParticipantId: deletedParticipantId });
|
|
57429
57507
|
}
|
|
57430
57508
|
}
|
|
57431
57509
|
function updateLineUp(_a) {
|
|
@@ -58028,14 +58106,15 @@ function completeDrawMatchUps(params) {
|
|
|
58028
58106
|
});
|
|
58029
58107
|
if (teamParticipant) {
|
|
58030
58108
|
var individualParticipantId = (_a = teamParticipant.individualParticipantIds) === null || _a === void 0 ? void 0 : _a[i];
|
|
58031
|
-
|
|
58032
|
-
|
|
58033
|
-
|
|
58034
|
-
|
|
58035
|
-
|
|
58036
|
-
|
|
58037
|
-
|
|
58038
|
-
|
|
58109
|
+
individualParticipantId &&
|
|
58110
|
+
assignTieMatchUpParticipantId({
|
|
58111
|
+
teamParticipantId: teamParticipant.participantId,
|
|
58112
|
+
participantId: individualParticipantId,
|
|
58113
|
+
tournamentRecord: tournamentRecord,
|
|
58114
|
+
drawDefinition: drawDefinition,
|
|
58115
|
+
tieMatchUpId: tieMatchUpId,
|
|
58116
|
+
event: event,
|
|
58117
|
+
});
|
|
58039
58118
|
}
|
|
58040
58119
|
});
|
|
58041
58120
|
});
|
|
@@ -59936,8 +60015,10 @@ function assignMatchUpSideParticipant(_a) {
|
|
|
59936
60015
|
if (noSideNumberProvided)
|
|
59937
60016
|
sideNumber = 1;
|
|
59938
60017
|
if (![1, 2].includes(sideNumber))
|
|
59939
|
-
return {
|
|
59940
|
-
|
|
60018
|
+
return decorateResult({
|
|
60019
|
+
result: { error: INVALID_VALUES, context: { sideNumber: sideNumber } },
|
|
60020
|
+
});
|
|
60021
|
+
var _e = findDrawMatchUp({
|
|
59941
60022
|
drawDefinition: drawDefinition,
|
|
59942
60023
|
matchUpId: matchUpId,
|
|
59943
60024
|
event: event,
|
|
@@ -60011,7 +60092,7 @@ function removeMatchUpSideParticipant(_a) {
|
|
|
60011
60092
|
// TODO: move to drawEngine and passthrough
|
|
60012
60093
|
if (![1, 2].includes(sideNumber))
|
|
60013
60094
|
return { error: INVALID_VALUES, sideNumber: sideNumber };
|
|
60014
|
-
var _d =
|
|
60095
|
+
var _d = findDrawMatchUp({
|
|
60015
60096
|
drawDefinition: drawDefinition,
|
|
60016
60097
|
matchUpId: matchUpId,
|
|
60017
60098
|
event: event,
|
|
@@ -60041,7 +60122,7 @@ function removeMatchUpSideParticipant(_a) {
|
|
|
60041
60122
|
|
|
60042
60123
|
function replaceTieMatchUpParticipantId(params) {
|
|
60043
60124
|
var e_1, _a;
|
|
60044
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r
|
|
60125
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
60045
60126
|
var matchUpContext = getTieMatchUpContext(params);
|
|
60046
60127
|
if (matchUpContext.error)
|
|
60047
60128
|
return matchUpContext;
|
|
@@ -60091,24 +60172,14 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60091
60172
|
return { error: INVALID_PARTICIPANT, info: 'Gender mismatch' };
|
|
60092
60173
|
}
|
|
60093
60174
|
var substitutionProcessCodes = (_g = matchUpActionsPolicy === null || matchUpActionsPolicy === void 0 ? void 0 : matchUpActionsPolicy.processCodes) === null || _g === void 0 ? void 0 : _g.substitution;
|
|
60094
|
-
|
|
60095
|
-
|
|
60096
|
-
|
|
60097
|
-
|
|
60098
|
-
|
|
60099
|
-
|
|
60100
|
-
|
|
60101
|
-
|
|
60102
|
-
return ({ drawPosition: drawPosition, sideNumber: sideNumber, displaySideNumber: displaySideNumber });
|
|
60103
|
-
};
|
|
60104
|
-
if (dualMatchUp) {
|
|
60105
|
-
dualMatchUp.sides = (_j = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _j === void 0 ? void 0 : _j.map(function (side) {
|
|
60106
|
-
var participantId = side.participantId;
|
|
60107
|
-
return __assign(__assign({}, extractSideDetail_1(side)), { lineUp: (participantId && lineUps[participantId]) || [] });
|
|
60108
|
-
});
|
|
60109
|
-
}
|
|
60110
|
-
}
|
|
60111
|
-
var dualMatchUpSide = (_k = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _k === void 0 ? void 0 : _k.find(function (_a) {
|
|
60175
|
+
ensureSideLineUps({
|
|
60176
|
+
tournamentId: tournamentRecord.tournamentId,
|
|
60177
|
+
eventId: event.eventId,
|
|
60178
|
+
inContextDualMatchUp: inContextDualMatchUp,
|
|
60179
|
+
drawDefinition: drawDefinition,
|
|
60180
|
+
dualMatchUp: dualMatchUp,
|
|
60181
|
+
});
|
|
60182
|
+
var dualMatchUpSide = (_h = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _h === void 0 ? void 0 : _h.find(function (_a) {
|
|
60112
60183
|
var sideNumber = _a.sideNumber;
|
|
60113
60184
|
return sideNumber === side.sideNumber;
|
|
60114
60185
|
});
|
|
@@ -60122,7 +60193,7 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60122
60193
|
stack: stack,
|
|
60123
60194
|
});
|
|
60124
60195
|
}
|
|
60125
|
-
var allTieIndividualParticipantIds = (
|
|
60196
|
+
var allTieIndividualParticipantIds = (_j = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _j === void 0 ? void 0 : _j.flatMap(function (side) {
|
|
60126
60197
|
var _a, _b;
|
|
60127
60198
|
return ((_a = side.participant) === null || _a === void 0 ? void 0 : _a.individualParticipantIds) ||
|
|
60128
60199
|
((_b = side.participant) === null || _b === void 0 ? void 0 : _b.participantId) ||
|
|
@@ -60131,10 +60202,10 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60131
60202
|
if (allTieIndividualParticipantIds === null || allTieIndividualParticipantIds === void 0 ? void 0 : allTieIndividualParticipantIds.includes(newParticipantId)) {
|
|
60132
60203
|
return decorateResult({ result: { error: EXISTING_PARTICIPANT }, stack: stack });
|
|
60133
60204
|
}
|
|
60134
|
-
var teamParticipantId = (
|
|
60205
|
+
var teamParticipantId = (_l = (_k = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _k === void 0 ? void 0 : _k.find(function (_a) {
|
|
60135
60206
|
var sideNumber = _a.sideNumber;
|
|
60136
60207
|
return sideNumber === side.sideNumber;
|
|
60137
|
-
})) === null ||
|
|
60208
|
+
})) === null || _l === void 0 ? void 0 : _l.participantId;
|
|
60138
60209
|
var teamLineUp = dualMatchUpSide.lineUp;
|
|
60139
60210
|
var newParticipantIdInLineUp = teamLineUp === null || teamLineUp === void 0 ? void 0 : teamLineUp.find(function (_a) {
|
|
60140
60211
|
var participantId = _a.participantId;
|
|
@@ -60245,14 +60316,14 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60245
60316
|
});
|
|
60246
60317
|
if (result_1.error)
|
|
60247
60318
|
return decorateResult({ result: result_1, stack: stack });
|
|
60248
|
-
participantAdded = (
|
|
60319
|
+
participantAdded = (_m = result_1.participant) === null || _m === void 0 ? void 0 : _m.participantId;
|
|
60249
60320
|
}
|
|
60250
60321
|
// now attempt to cleanup/delete previous pairParticipant
|
|
60251
60322
|
result = getPairedParticipant({
|
|
60252
60323
|
participantIds: existingIndividualParticipantIds,
|
|
60253
60324
|
tournamentRecord: tournamentRecord_1,
|
|
60254
60325
|
});
|
|
60255
|
-
var existingPairParticipantId = (
|
|
60326
|
+
var existingPairParticipantId = (_o = result.participant) === null || _o === void 0 ? void 0 : _o.participantId;
|
|
60256
60327
|
if (existingPairParticipantId) {
|
|
60257
60328
|
var result_2 = deleteParticipants({
|
|
60258
60329
|
participantIds: [existingPairParticipantId],
|
|
@@ -60262,7 +60333,7 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60262
60333
|
participantRemoved = existingPairParticipantId;
|
|
60263
60334
|
}
|
|
60264
60335
|
}
|
|
60265
|
-
if (substitution || ((
|
|
60336
|
+
if (substitution || ((_p = side.substitutions) === null || _p === void 0 ? void 0 : _p.length) === 1) {
|
|
60266
60337
|
if (substitution) {
|
|
60267
60338
|
var processCodes = (tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) || [];
|
|
60268
60339
|
if (substitutionProcessCodes)
|
|
@@ -60273,18 +60344,18 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60273
60344
|
else {
|
|
60274
60345
|
try {
|
|
60275
60346
|
// if there was only one substitution, remove processCode(s)
|
|
60276
|
-
for (var
|
|
60277
|
-
var substitutionProcessCode =
|
|
60278
|
-
var codeIndex = (
|
|
60347
|
+
for (var _s = __values(substitutionProcessCodes || []), _t = _s.next(); !_t.done; _t = _s.next()) {
|
|
60348
|
+
var substitutionProcessCode = _t.value;
|
|
60349
|
+
var codeIndex = (_q = tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) === null || _q === void 0 ? void 0 : _q.lastIndexOf(substitutionProcessCode);
|
|
60279
60350
|
// remove only one instance of substitutionProcessCode
|
|
60280
60351
|
codeIndex !== undefined &&
|
|
60281
|
-
((
|
|
60352
|
+
((_r = tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) === null || _r === void 0 ? void 0 : _r.splice(codeIndex, 1));
|
|
60282
60353
|
}
|
|
60283
60354
|
}
|
|
60284
60355
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
60285
60356
|
finally {
|
|
60286
60357
|
try {
|
|
60287
|
-
if (
|
|
60358
|
+
if (_t && !_t.done && (_a = _s.return)) _a.call(_s);
|
|
60288
60359
|
}
|
|
60289
60360
|
finally { if (e_1) throw e_1.error; }
|
|
60290
60361
|
}
|
|
@@ -60311,7 +60382,7 @@ function replaceTieMatchUpParticipantId(params) {
|
|
|
60311
60382
|
|
|
60312
60383
|
function removeTieMatchUpParticipantId(params) {
|
|
60313
60384
|
var e_1, _a;
|
|
60314
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
60385
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
60315
60386
|
var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, participantId = params.participantId, event = params.event;
|
|
60316
60387
|
var stack = 'removeTieMatchUpParticiapantId';
|
|
60317
60388
|
if (!participantId)
|
|
@@ -60360,27 +60431,19 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60360
60431
|
var participantIds = participantToRemove.participantType === INDIVIDUAL
|
|
60361
60432
|
? [participantId]
|
|
60362
60433
|
: participantToRemove.individualParticipantIds;
|
|
60363
|
-
|
|
60364
|
-
|
|
60365
|
-
|
|
60366
|
-
|
|
60367
|
-
|
|
60368
|
-
|
|
60369
|
-
|
|
60370
|
-
|
|
60371
|
-
return ({ drawPosition: drawPosition, sideNumber: sideNumber, displaySideNumber: displaySideNumber });
|
|
60372
|
-
};
|
|
60373
|
-
dualMatchUp.sides = (_k = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _k === void 0 ? void 0 : _k.map(function (side) {
|
|
60374
|
-
var participantId = side.participantId;
|
|
60375
|
-
return __assign(__assign({}, extractSideDetail_1(side)), { lineUp: (participantId && lineUps_1[participantId]) || [] });
|
|
60376
|
-
});
|
|
60377
|
-
}
|
|
60378
|
-
var dualMatchUpSide = (_l = dualMatchUp.sides) === null || _l === void 0 ? void 0 : _l.find(function (_a) {
|
|
60434
|
+
ensureSideLineUps({
|
|
60435
|
+
tournamentId: tournamentRecord.tournamentId,
|
|
60436
|
+
eventId: event.eventId,
|
|
60437
|
+
inContextDualMatchUp: inContextDualMatchUp,
|
|
60438
|
+
drawDefinition: drawDefinition,
|
|
60439
|
+
dualMatchUp: dualMatchUp,
|
|
60440
|
+
});
|
|
60441
|
+
var dualMatchUpSide = (_j = dualMatchUp.sides) === null || _j === void 0 ? void 0 : _j.find(function (_a) {
|
|
60379
60442
|
var sideNumber = _a.sideNumber;
|
|
60380
60443
|
return sideNumber === side.sideNumber;
|
|
60381
60444
|
});
|
|
60382
60445
|
if (!dualMatchUpSide &&
|
|
60383
|
-
(((
|
|
60446
|
+
(((_k = dualMatchUp.sides) === null || _k === void 0 ? void 0 : _k.filter(function (_a) {
|
|
60384
60447
|
var lineUp = _a.lineUp;
|
|
60385
60448
|
return !lineUp;
|
|
60386
60449
|
}).length) || 0) < 2) {
|
|
@@ -60392,7 +60455,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60392
60455
|
teamParticipantId: teamParticipantId,
|
|
60393
60456
|
});
|
|
60394
60457
|
});
|
|
60395
|
-
dualMatchUpSide = (
|
|
60458
|
+
dualMatchUpSide = (_l = dualMatchUp.sides) === null || _l === void 0 ? void 0 : _l.find(function (side) {
|
|
60396
60459
|
var _a;
|
|
60397
60460
|
return ((_a = drawPositionMap_1 === null || drawPositionMap_1 === void 0 ? void 0 : drawPositionMap_1.find(function (_a) {
|
|
60398
60461
|
var drawPosition = _a.drawPosition;
|
|
@@ -60401,17 +60464,18 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60401
60464
|
});
|
|
60402
60465
|
}
|
|
60403
60466
|
if (!dualMatchUpSide) {
|
|
60404
|
-
|
|
60405
|
-
|
|
60467
|
+
return decorateResult({
|
|
60468
|
+
result: { error: PARTICIPANT_NOT_FOUND, context: { participantId: participantId } },
|
|
60469
|
+
});
|
|
60406
60470
|
}
|
|
60407
|
-
var
|
|
60471
|
+
var _x = removeCollectionAssignments({
|
|
60408
60472
|
collectionPosition: collectionPosition,
|
|
60409
60473
|
teamParticipantId: teamParticipantId,
|
|
60410
60474
|
dualMatchUpSide: dualMatchUpSide,
|
|
60411
60475
|
participantIds: participantIds,
|
|
60412
60476
|
drawDefinition: drawDefinition,
|
|
60413
60477
|
collectionId: collectionId,
|
|
60414
|
-
}), modifiedLineUp =
|
|
60478
|
+
}), modifiedLineUp = _x.modifiedLineUp, previousParticipantIds = _x.previousParticipantIds;
|
|
60415
60479
|
dualMatchUpSide.lineUp = modifiedLineUp;
|
|
60416
60480
|
teamParticipantId &&
|
|
60417
60481
|
tieFormat &&
|
|
@@ -60425,16 +60489,16 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60425
60489
|
// ...then the PAIR participant may need to be modified
|
|
60426
60490
|
if (matchUpType === DOUBLES$1 &&
|
|
60427
60491
|
participantToRemove.participantType === INDIVIDUAL) {
|
|
60428
|
-
var tieMatchUpSide = (
|
|
60492
|
+
var tieMatchUpSide = (_m = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _m === void 0 ? void 0 : _m.find(function (side) { return side.sideNumber === (dualMatchUpSide === null || dualMatchUpSide === void 0 ? void 0 : dualMatchUpSide.sideNumber); });
|
|
60429
60493
|
var pairParticipantId = (tieMatchUpSide || {}).participantId;
|
|
60430
60494
|
var pairParticipant = pairParticipantId &&
|
|
60431
|
-
((
|
|
60495
|
+
((_p = (_o = getParticipants$1({
|
|
60432
60496
|
participantFilters: { participantIds: [pairParticipantId] },
|
|
60433
60497
|
tournamentRecord: tournamentRecord,
|
|
60434
60498
|
withDraws: true,
|
|
60435
|
-
})) === null ||
|
|
60499
|
+
})) === null || _o === void 0 ? void 0 : _o.participants) === null || _p === void 0 ? void 0 : _p[0]);
|
|
60436
60500
|
if (pairParticipant) {
|
|
60437
|
-
var individualParticipantIds = (
|
|
60501
|
+
var individualParticipantIds = (_r = (_q = pairParticipant === null || pairParticipant === void 0 ? void 0 : pairParticipant.individualParticipantIds) === null || _q === void 0 ? void 0 : _q.filter(function (currentId) { return currentId !== participantId; })) !== null && _r !== void 0 ? _r : [];
|
|
60438
60502
|
if (previousParticipantIds)
|
|
60439
60503
|
individualParticipantIds.push.apply(individualParticipantIds, __spreadArray([], __read(previousParticipantIds), false));
|
|
60440
60504
|
if (individualParticipantIds.length > 2) {
|
|
@@ -60444,7 +60508,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60444
60508
|
});
|
|
60445
60509
|
}
|
|
60446
60510
|
// don't modify pair participant that is part of other events/draws
|
|
60447
|
-
if (!((
|
|
60511
|
+
if (!((_s = pairParticipant.draws) === null || _s === void 0 ? void 0 : _s.length)) {
|
|
60448
60512
|
if (individualParticipantIds.length) {
|
|
60449
60513
|
pairParticipant.individualParticipantIds = individualParticipantIds;
|
|
60450
60514
|
var result = modifyParticipant({
|
|
@@ -60495,13 +60559,13 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60495
60559
|
}
|
|
60496
60560
|
}
|
|
60497
60561
|
// if there was only one subsitution on target side and there are no substiutions on other side
|
|
60498
|
-
if (((
|
|
60499
|
-
var otherSide = (
|
|
60500
|
-
if (!((
|
|
60562
|
+
if (((_t = side.substitutions) === null || _t === void 0 ? void 0 : _t.length) === 1) {
|
|
60563
|
+
var otherSide = (_u = inContextTieMatchUp === null || inContextTieMatchUp === void 0 ? void 0 : inContextTieMatchUp.sides) === null || _u === void 0 ? void 0 : _u.find(function (s) { return s.sideNumber !== side.sideNumber; });
|
|
60564
|
+
if (!((_v = otherSide === null || otherSide === void 0 ? void 0 : otherSide.substitutions) === null || _v === void 0 ? void 0 : _v.length) && ((_w = tieMatchUp === null || tieMatchUp === void 0 ? void 0 : tieMatchUp.processCodes) === null || _w === void 0 ? void 0 : _w.length)) {
|
|
60501
60565
|
try {
|
|
60502
60566
|
// remove processCode(s)
|
|
60503
|
-
for (var
|
|
60504
|
-
var substitutionProcessCode =
|
|
60567
|
+
for (var _y = __values(substitutionProcessCodes || []), _z = _y.next(); !_z.done; _z = _y.next()) {
|
|
60568
|
+
var substitutionProcessCode = _z.value;
|
|
60505
60569
|
var codeIndex = tieMatchUp.processCodes.lastIndexOf(substitutionProcessCode);
|
|
60506
60570
|
// remove only one instance of substitutionProcessCode
|
|
60507
60571
|
tieMatchUp.processCodes.splice(codeIndex, 1);
|
|
@@ -60510,7 +60574,7 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
60510
60574
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
60511
60575
|
finally {
|
|
60512
60576
|
try {
|
|
60513
|
-
if (
|
|
60577
|
+
if (_z && !_z.done && (_a = _y.return)) _a.call(_y);
|
|
60514
60578
|
}
|
|
60515
60579
|
finally { if (e_1) throw e_1.error; }
|
|
60516
60580
|
}
|
|
@@ -62744,7 +62808,7 @@ function substituteParticipant$1(_a) {
|
|
|
62744
62808
|
return { error: MISSING_MATCHUP_ID };
|
|
62745
62809
|
if (!existingParticipantId || !substituteParticipantId)
|
|
62746
62810
|
return decorateResult({ result: { error: MISSING_PARTICIPANT_ID }, stack: stack });
|
|
62747
|
-
var matchUp =
|
|
62811
|
+
var matchUp = findDrawMatchUp({
|
|
62748
62812
|
drawDefinition: drawDefinition,
|
|
62749
62813
|
matchUpId: matchUpId,
|
|
62750
62814
|
event: event,
|
|
@@ -63384,7 +63448,7 @@ function applyLineUps(_a) {
|
|
|
63384
63448
|
return { error: INVALID_VALUES, lineUps: lineUps };
|
|
63385
63449
|
var stack = 'applyLineUps';
|
|
63386
63450
|
var tournamentParticipants = tournamentRecord.participants || [];
|
|
63387
|
-
var result =
|
|
63451
|
+
var result = findDrawMatchUp({
|
|
63388
63452
|
tournamentParticipants: tournamentParticipants,
|
|
63389
63453
|
inContext: true,
|
|
63390
63454
|
drawDefinition: drawDefinition,
|
|
@@ -63549,7 +63613,7 @@ function applyLineUps(_a) {
|
|
|
63549
63613
|
}
|
|
63550
63614
|
if (!Object.keys(sideAssignments).length)
|
|
63551
63615
|
return { error: VALUE_UNCHANGED };
|
|
63552
|
-
result =
|
|
63616
|
+
result = findDrawMatchUp({ drawDefinition: drawDefinition, matchUpId: matchUpId });
|
|
63553
63617
|
if (result.error)
|
|
63554
63618
|
return result;
|
|
63555
63619
|
if (!result.matchUp)
|
|
@@ -70675,6 +70739,7 @@ var utilities = {
|
|
|
70675
70739
|
unique: unique,
|
|
70676
70740
|
UUID: UUID,
|
|
70677
70741
|
UUIDS: UUIDS,
|
|
70742
|
+
validateCategory: validateCategory,
|
|
70678
70743
|
validateTieFormat: validateTieFormat,
|
|
70679
70744
|
visualizeScheduledMatchUps: visualizeScheduledMatchUps,
|
|
70680
70745
|
};
|