tods-competition-factory 1.8.45 → 1.9.0
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 +159 -82
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +5 -2
- package/dist/forge/query.mjs +330 -158
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +3847 -3797
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +632 -328
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +865 -489
- 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 +4 -4
|
@@ -2351,7 +2351,33 @@ function isString(obj) {
|
|
|
2351
2351
|
return typeof obj === 'string';
|
|
2352
2352
|
}
|
|
2353
2353
|
function isObject(obj) {
|
|
2354
|
-
return typeof obj === 'object';
|
|
2354
|
+
return obj !== null && typeof obj === 'object';
|
|
2355
|
+
}
|
|
2356
|
+
function objShallowEqual(o1, o2) {
|
|
2357
|
+
var e_1, _a;
|
|
2358
|
+
if (!isObject(o1) || !isObject(o2))
|
|
2359
|
+
return false;
|
|
2360
|
+
var keys1 = Object.keys(o1);
|
|
2361
|
+
var keys2 = Object.keys(o2);
|
|
2362
|
+
if (keys1.length !== keys2.length) {
|
|
2363
|
+
return false;
|
|
2364
|
+
}
|
|
2365
|
+
try {
|
|
2366
|
+
for (var keys1_1 = __values(keys1), keys1_1_1 = keys1_1.next(); !keys1_1_1.done; keys1_1_1 = keys1_1.next()) {
|
|
2367
|
+
var key = keys1_1_1.value;
|
|
2368
|
+
if (o1[key] !== o2[key]) {
|
|
2369
|
+
return false;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2374
|
+
finally {
|
|
2375
|
+
try {
|
|
2376
|
+
if (keys1_1_1 && !keys1_1_1.done && (_a = keys1_1.return)) _a.call(keys1_1);
|
|
2377
|
+
}
|
|
2378
|
+
finally { if (e_1) throw e_1.error; }
|
|
2379
|
+
}
|
|
2380
|
+
return true;
|
|
2355
2381
|
}
|
|
2356
2382
|
function createMap(objectArray, attribute) {
|
|
2357
2383
|
if (!Array.isArray(objectArray))
|
|
@@ -2929,7 +2955,7 @@ var matchUpFormatCode = {
|
|
|
2929
2955
|
};
|
|
2930
2956
|
|
|
2931
2957
|
function factoryVersion() {
|
|
2932
|
-
return '1.
|
|
2958
|
+
return '1.9.0';
|
|
2933
2959
|
}
|
|
2934
2960
|
|
|
2935
2961
|
function getObjectTieFormat(obj) {
|
|
@@ -3010,34 +3036,6 @@ function decorateResult(_a) {
|
|
|
3010
3036
|
return result !== null && result !== void 0 ? result : { success: true };
|
|
3011
3037
|
}
|
|
3012
3038
|
|
|
3013
|
-
var ANY = 'ANY';
|
|
3014
|
-
var MALE = 'MALE';
|
|
3015
|
-
var MIXED = 'MIXED';
|
|
3016
|
-
var OTHER$3 = 'OTHER';
|
|
3017
|
-
var FEMALE = 'FEMALE';
|
|
3018
|
-
var genderConstants = {
|
|
3019
|
-
ANY: ANY,
|
|
3020
|
-
MALE: MALE,
|
|
3021
|
-
FEMALE: FEMALE,
|
|
3022
|
-
MIXED: MIXED,
|
|
3023
|
-
OTHER: OTHER$3,
|
|
3024
|
-
};
|
|
3025
|
-
|
|
3026
|
-
var SINGLES_MATCHUP = 'SINGLES';
|
|
3027
|
-
var SINGLES$1 = 'SINGLES';
|
|
3028
|
-
var DOUBLES_MATCHUP = 'DOUBLES';
|
|
3029
|
-
var DOUBLES$1 = 'DOUBLES';
|
|
3030
|
-
var TEAM_MATCHUP = 'TEAM';
|
|
3031
|
-
var TEAM$2 = 'TEAM';
|
|
3032
|
-
var matchUpTypes = {
|
|
3033
|
-
SINGLES_MATCHUP: SINGLES_MATCHUP,
|
|
3034
|
-
SINGLES: SINGLES$1,
|
|
3035
|
-
DOUBLES_MATCHUP: DOUBLES_MATCHUP,
|
|
3036
|
-
DOUBLES: DOUBLES$1,
|
|
3037
|
-
TEAM_MATCHUP: TEAM_MATCHUP,
|
|
3038
|
-
TEAM: TEAM$2,
|
|
3039
|
-
};
|
|
3040
|
-
|
|
3041
3039
|
var DrawTypeEnum;
|
|
3042
3040
|
(function (DrawTypeEnum) {
|
|
3043
3041
|
DrawTypeEnum["AdHoc"] = "AD_HOC";
|
|
@@ -3598,10 +3596,22 @@ var SexEnum;
|
|
|
3598
3596
|
SexEnum["Other"] = "OTHER";
|
|
3599
3597
|
})(SexEnum || (SexEnum = {}));
|
|
3600
3598
|
|
|
3599
|
+
var ANY = 'ANY';
|
|
3600
|
+
var MALE = 'MALE';
|
|
3601
|
+
var MIXED = 'MIXED';
|
|
3602
|
+
var OTHER$3 = 'OTHER';
|
|
3603
|
+
var FEMALE = 'FEMALE';
|
|
3604
|
+
var genderConstants = {
|
|
3605
|
+
ANY: ANY,
|
|
3606
|
+
MALE: MALE,
|
|
3607
|
+
FEMALE: FEMALE,
|
|
3608
|
+
MIXED: MIXED,
|
|
3609
|
+
OTHER: OTHER$3,
|
|
3610
|
+
};
|
|
3611
|
+
|
|
3601
3612
|
var mixedGenderError = 'MIXED events can not contain mixed singles or { gender: ANY } collections';
|
|
3602
3613
|
var anyMixedError = 'events with { gender: ANY } can not contain MIXED singles collections';
|
|
3603
3614
|
function tieFormatGenderValidityCheck(params) {
|
|
3604
|
-
var _a, _b;
|
|
3605
3615
|
var stack = 'tieFormatGenderValidityCheck';
|
|
3606
3616
|
var referenceGender = params.referenceGender, matchUpType = params.matchUpType, gender = params.gender;
|
|
3607
3617
|
if (referenceGender &&
|
|
@@ -3613,11 +3623,8 @@ function tieFormatGenderValidityCheck(params) {
|
|
|
3613
3623
|
context: { gender: gender },
|
|
3614
3624
|
stack: stack,
|
|
3615
3625
|
});
|
|
3616
|
-
var eventType = (_a = params.eventType) !== null && _a !== void 0 ? _a : (_b = params.referenceEvent) === null || _b === void 0 ? void 0 : _b.eventType;
|
|
3617
3626
|
if (referenceGender === MIXED &&
|
|
3618
|
-
(
|
|
3619
|
-
gender === ANY ||
|
|
3620
|
-
(gender === MIXED && matchUpType !== TypeEnum.Doubles))) {
|
|
3627
|
+
(gender === ANY || (gender === MIXED && matchUpType !== TypeEnum.Doubles))) {
|
|
3621
3628
|
return decorateResult({
|
|
3622
3629
|
result: { error: INVALID_GENDER, valid: false },
|
|
3623
3630
|
info: mixedGenderError,
|
|
@@ -3963,7 +3970,6 @@ function validateTieFormat(params) {
|
|
|
3963
3970
|
var _a = validateCollectionDefinition({
|
|
3964
3971
|
referenceCategory: params.category,
|
|
3965
3972
|
referenceGender: params.gender,
|
|
3966
|
-
eventType: params.eventType,
|
|
3967
3973
|
collectionDefinition: collectionDefinition,
|
|
3968
3974
|
checkCollectionIds: checkCollectionIds,
|
|
3969
3975
|
checkCategory: checkCategory,
|
|
@@ -4013,7 +4019,7 @@ function validateTieFormat(params) {
|
|
|
4013
4019
|
return result;
|
|
4014
4020
|
}
|
|
4015
4021
|
function validateCollectionDefinition(_a) {
|
|
4016
|
-
var _b = _a.checkCategory, checkCategory = _b === void 0 ? true : _b, collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds, _c = _a.checkGender, checkGender = _c === void 0 ? true : _c, referenceCategory = _a.referenceCategory, referenceGender = _a.referenceGender,
|
|
4022
|
+
var _b = _a.checkCategory, checkCategory = _b === void 0 ? true : _b, collectionDefinition = _a.collectionDefinition, checkCollectionIds = _a.checkCollectionIds, _c = _a.checkGender, checkGender = _c === void 0 ? true : _c, referenceCategory = _a.referenceCategory, referenceGender = _a.referenceGender, event = _a.event;
|
|
4017
4023
|
referenceGender = referenceGender !== null && referenceGender !== void 0 ? referenceGender : event === null || event === void 0 ? void 0 : event.gender;
|
|
4018
4024
|
var stack = 'validateCollectionDefinition';
|
|
4019
4025
|
var errors = [];
|
|
@@ -4061,7 +4067,6 @@ function validateCollectionDefinition(_a) {
|
|
|
4061
4067
|
}
|
|
4062
4068
|
if (checkGender) {
|
|
4063
4069
|
var result = tieFormatGenderValidityCheck({
|
|
4064
|
-
eventType: eventType !== null && eventType !== void 0 ? eventType : event === null || event === void 0 ? void 0 : event.eventType,
|
|
4065
4070
|
referenceGender: referenceGender,
|
|
4066
4071
|
matchUpType: matchUpType,
|
|
4067
4072
|
gender: gender,
|
|
@@ -4096,10 +4101,9 @@ function validateCollectionDefinition(_a) {
|
|
|
4096
4101
|
// add collectionIds if missing
|
|
4097
4102
|
function checkTieFormat(_a) {
|
|
4098
4103
|
var e_1, _b;
|
|
4099
|
-
var tieFormat = _a.tieFormat
|
|
4104
|
+
var tieFormat = _a.tieFormat;
|
|
4100
4105
|
var result = validateTieFormat({
|
|
4101
4106
|
checkCollectionIds: false,
|
|
4102
|
-
eventType: eventType,
|
|
4103
4107
|
tieFormat: tieFormat,
|
|
4104
4108
|
});
|
|
4105
4109
|
if (result.error)
|
|
@@ -4556,6 +4560,21 @@ function calculatePercentages(_a) {
|
|
|
4556
4560
|
});
|
|
4557
4561
|
}
|
|
4558
4562
|
|
|
4563
|
+
var SINGLES_MATCHUP = 'SINGLES';
|
|
4564
|
+
var SINGLES$1 = 'SINGLES';
|
|
4565
|
+
var DOUBLES_MATCHUP = 'DOUBLES';
|
|
4566
|
+
var DOUBLES$1 = 'DOUBLES';
|
|
4567
|
+
var TEAM_MATCHUP = 'TEAM';
|
|
4568
|
+
var TEAM$2 = 'TEAM';
|
|
4569
|
+
var matchUpTypes = {
|
|
4570
|
+
SINGLES_MATCHUP: SINGLES_MATCHUP,
|
|
4571
|
+
SINGLES: SINGLES$1,
|
|
4572
|
+
DOUBLES_MATCHUP: DOUBLES_MATCHUP,
|
|
4573
|
+
DOUBLES: DOUBLES$1,
|
|
4574
|
+
TEAM_MATCHUP: TEAM_MATCHUP,
|
|
4575
|
+
TEAM: TEAM$2,
|
|
4576
|
+
};
|
|
4577
|
+
|
|
4559
4578
|
function getParticipantResults(_a) {
|
|
4560
4579
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
4561
4580
|
var _e, _f, _g, _h, _j, _k;
|
|
@@ -5495,6 +5514,7 @@ function tallyParticipantResults(_a) {
|
|
|
5495
5514
|
return result;
|
|
5496
5515
|
}
|
|
5497
5516
|
|
|
5517
|
+
var ACTIVE_SUSPENSION = 'activeSuspension';
|
|
5498
5518
|
var APPLIED_POLICIES = 'appliedPolicies';
|
|
5499
5519
|
var AUDIT_POSITION_ACTIONS = 'positionActions';
|
|
5500
5520
|
var CONTEXT = 'context';
|
|
@@ -5506,6 +5526,7 @@ var DRAW_DELETIONS = 'drawDeletions';
|
|
|
5506
5526
|
var DRAW_PROFILE = 'drawProfile';
|
|
5507
5527
|
var ENTRY_PROFILE = 'entryProfile';
|
|
5508
5528
|
var EVENT_PROFILE = 'eventProfile';
|
|
5529
|
+
var EVENT_WITHDRAWAL_REQUESTS = 'eventWithdrawalRequests';
|
|
5509
5530
|
var FACTORY$1 = 'factory';
|
|
5510
5531
|
var FLIGHT_PROFILE = 'flightProfile';
|
|
5511
5532
|
var GROUPING_ATTRIBUTE = 'groupingAttribute';
|
|
@@ -5524,6 +5545,7 @@ var SUB_ORDER = 'subOrder';
|
|
|
5524
5545
|
var TALLY = 'tally';
|
|
5525
5546
|
var TIE_FORMAT_MODIFICATIONS = 'tieFormatModification';
|
|
5526
5547
|
var extensionConstants = {
|
|
5548
|
+
ACTIVE_SUSPENSION: ACTIVE_SUSPENSION,
|
|
5527
5549
|
APPLIED_POLICIES: APPLIED_POLICIES,
|
|
5528
5550
|
AUDIT_POSITION_ACTIONS: AUDIT_POSITION_ACTIONS,
|
|
5529
5551
|
CONTEXT: CONTEXT, // used to capture, e.g. context in which a venue was added
|
|
@@ -5535,6 +5557,7 @@ var extensionConstants = {
|
|
|
5535
5557
|
DRAW_PROFILE: DRAW_PROFILE,
|
|
5536
5558
|
ENTRY_PROFILE: ENTRY_PROFILE, // used for drawGeneration; not relevant for anonymized tournaments
|
|
5537
5559
|
EVENT_PROFILE: EVENT_PROFILE,
|
|
5560
|
+
EVENT_WITHDRAWAL_REQUESTS: EVENT_WITHDRAWAL_REQUESTS,
|
|
5538
5561
|
FLIGHT_PROFILE: FLIGHT_PROFILE,
|
|
5539
5562
|
GROUPING_ATTRIBUTE: GROUPING_ATTRIBUTE, // for generating teams; not relevant for anonymized tournaments
|
|
5540
5563
|
LINEUPS: LINEUPS,
|
|
@@ -7301,8 +7324,8 @@ var eventConstants = {
|
|
|
7301
7324
|
|
|
7302
7325
|
function getMatchUpScheduleDetails(_a) {
|
|
7303
7326
|
var _b, _c, _d, _e, _f, e_1, _g;
|
|
7304
|
-
var _h, _j, _k, _l, _m, _o, _p;
|
|
7305
|
-
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, scheduleTiming = _a.scheduleTiming, matchUpFormat = _a.matchUpFormat, matchUpType = _a.matchUpType, matchUp = _a.matchUp, event = _a.event;
|
|
7327
|
+
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
7328
|
+
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, usePublishState = _a.usePublishState, scheduleTiming = _a.scheduleTiming, matchUpFormat = _a.matchUpFormat, publishStatus = _a.publishStatus, matchUpType = _a.matchUpType, matchUp = _a.matchUp, event = _a.event;
|
|
7306
7329
|
if (!matchUp)
|
|
7307
7330
|
return { error: MISSING_MATCHUP };
|
|
7308
7331
|
// matchUpType is required to derive averageMatchUpMinutes and recoveryMinutes.
|
|
@@ -7330,11 +7353,11 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7330
7353
|
(drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType) ||
|
|
7331
7354
|
((event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$1 && (event === null || event === void 0 ? void 0 : event.eventType));
|
|
7332
7355
|
}
|
|
7333
|
-
var
|
|
7356
|
+
var _v = matchUpDuration({ matchUp: matchUp }), milliseconds = _v.milliseconds, time = _v.time;
|
|
7334
7357
|
var startTime = matchUpStartTime({ matchUp: matchUp }).startTime;
|
|
7335
7358
|
var endTime = matchUpEndTime({ matchUp: matchUp }).endTime;
|
|
7336
7359
|
var schedule;
|
|
7337
|
-
var
|
|
7360
|
+
var _w = scheduleVisibilityFilters !== null && scheduleVisibilityFilters !== void 0 ? scheduleVisibilityFilters : {}, visibilityThreshold = _w.visibilityThreshold, eventIds = _w.eventIds, drawIds = _w.drawIds;
|
|
7338
7361
|
if ((!eventIds || eventIds.includes(matchUp.eventId)) &&
|
|
7339
7362
|
(!drawIds || drawIds.includes(matchUp.drawId))) {
|
|
7340
7363
|
var scheduleSource = { matchUp: matchUp, visibilityThreshold: visibilityThreshold };
|
|
@@ -7391,8 +7414,8 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7391
7414
|
allocatedCourt.courtName = courtInfo_1 === null || courtInfo_1 === void 0 ? void 0 : courtInfo_1.courtName;
|
|
7392
7415
|
};
|
|
7393
7416
|
try {
|
|
7394
|
-
for (var
|
|
7395
|
-
var allocatedCourt =
|
|
7417
|
+
for (var _x = __values(allocatedCourts || []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
7418
|
+
var allocatedCourt = _y.value;
|
|
7396
7419
|
var state_1 = _loop_1(allocatedCourt);
|
|
7397
7420
|
if (state_1 === "break")
|
|
7398
7421
|
break;
|
|
@@ -7401,7 +7424,7 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7401
7424
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7402
7425
|
finally {
|
|
7403
7426
|
try {
|
|
7404
|
-
if (
|
|
7427
|
+
if (_y && !_y.done && (_g = _x.return)) _g.call(_x);
|
|
7405
7428
|
}
|
|
7406
7429
|
finally { if (e_1) throw e_1.error; }
|
|
7407
7430
|
}
|
|
@@ -7430,16 +7453,36 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7430
7453
|
}
|
|
7431
7454
|
else {
|
|
7432
7455
|
schedule = definedAttributes({
|
|
7433
|
-
|
|
7456
|
+
milliseconds: milliseconds,
|
|
7434
7457
|
startTime: startTime,
|
|
7435
7458
|
endTime: endTime,
|
|
7436
|
-
|
|
7459
|
+
time: time,
|
|
7437
7460
|
});
|
|
7438
7461
|
}
|
|
7439
|
-
var hasCompletedStatus = matchUp.matchUpStatus &&
|
|
7440
|
-
completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
7441
7462
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
7442
7463
|
var scheduledTime = scheduledMatchUpTime({ matchUp: matchUp }).scheduledTime;
|
|
7464
|
+
if (usePublishState && ((_q = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.displaySettings) === null || _q === void 0 ? void 0 : _q.draws)) {
|
|
7465
|
+
var drawSettings = publishStatus.displaySettings.draws;
|
|
7466
|
+
var scheduleDetails = (_s = ((_r = drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings[matchUp.drawId]) !== null && _r !== void 0 ? _r : drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings.default)) === null || _s === void 0 ? void 0 : _s.scheduleDetails;
|
|
7467
|
+
if (scheduleDetails) {
|
|
7468
|
+
var scheduleAttributes = (_u = ((_t = scheduleDetails.find(function (details) { var _a; return scheduledDate && ((_a = details.dates) === null || _a === void 0 ? void 0 : _a.includes(scheduledDate)); })) !== null && _t !== void 0 ? _t : scheduleDetails.find(function (details) { var _a; return !((_a = details.dates) === null || _a === void 0 ? void 0 : _a.length); }))) === null || _u === void 0 ? void 0 : _u.attributes;
|
|
7469
|
+
if (scheduleAttributes) {
|
|
7470
|
+
// set all attributes to true
|
|
7471
|
+
var template = Object.assign.apply(Object, __spreadArray(__spreadArray([{}], __read(Object.keys(schedule).map(function (key) {
|
|
7472
|
+
var _a;
|
|
7473
|
+
return (_a = {}, _a[key] = true, _a);
|
|
7474
|
+
})), false), [
|
|
7475
|
+
// overwrite with publishStatus attributes
|
|
7476
|
+
scheduleAttributes], false));
|
|
7477
|
+
schedule = attributeFilter({
|
|
7478
|
+
source: schedule,
|
|
7479
|
+
template: template,
|
|
7480
|
+
});
|
|
7481
|
+
}
|
|
7482
|
+
}
|
|
7483
|
+
}
|
|
7484
|
+
var hasCompletedStatus = matchUp.matchUpStatus &&
|
|
7485
|
+
completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
7443
7486
|
var endDate = (hasCompletedStatus &&
|
|
7444
7487
|
(extractDate(endTime) ||
|
|
7445
7488
|
extractDate(scheduledDate) ||
|
|
@@ -9546,7 +9589,7 @@ function getSeeding(_a) {
|
|
|
9546
9589
|
|
|
9547
9590
|
function getAllStructureMatchUps(_a) {
|
|
9548
9591
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
9549
|
-
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, provisionalPositioning = _a.provisionalPositioning, tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, seedAssignments = _a.seedAssignments, contextFilters = _a.contextFilters, contextContent = _a.contextContent, matchUpFilters = _a.matchUpFilters, participantMap = _a.participantMap, scheduleTiming = _a.scheduleTiming, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, _j = _a.context, context = _j === void 0 ? {} : _j, exitProfiles = _a.exitProfiles, matchUpsMap = _a.matchUpsMap, structure = _a.structure, inContext = _a.inContext, event = _a.event;
|
|
9592
|
+
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, provisionalPositioning = _a.provisionalPositioning, tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, seedAssignments = _a.seedAssignments, usePublishState = _a.usePublishState, contextFilters = _a.contextFilters, contextContent = _a.contextContent, matchUpFilters = _a.matchUpFilters, participantMap = _a.participantMap, scheduleTiming = _a.scheduleTiming, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, publishStatus = _a.publishStatus, _j = _a.context, context = _j === void 0 ? {} : _j, exitProfiles = _a.exitProfiles, matchUpsMap = _a.matchUpsMap, structure = _a.structure, inContext = _a.inContext, event = _a.event;
|
|
9550
9593
|
var collectionPositionMatchUps = {}, roundMatchUps = {};
|
|
9551
9594
|
tournamentParticipants =
|
|
9552
9595
|
tournamentParticipants !== null && tournamentParticipants !== void 0 ? tournamentParticipants : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
@@ -9673,6 +9716,8 @@ function getAllStructureMatchUps(_a) {
|
|
|
9673
9716
|
roundNamingProfile: roundNamingProfile,
|
|
9674
9717
|
initialRoundOfPlay: initialRoundOfPlay,
|
|
9675
9718
|
appliedPolicies: appliedPolicies,
|
|
9719
|
+
usePublishState: usePublishState,
|
|
9720
|
+
publishStatus: publishStatus,
|
|
9676
9721
|
isRoundRobin: isRoundRobin,
|
|
9677
9722
|
roundProfile: roundProfile,
|
|
9678
9723
|
matchUp: matchUp,
|
|
@@ -9728,7 +9773,7 @@ function getAllStructureMatchUps(_a) {
|
|
|
9728
9773
|
};
|
|
9729
9774
|
function addMatchUpContext(_a) {
|
|
9730
9775
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
9731
|
-
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;
|
|
9776
|
+
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, usePublishState = _a.usePublishState, publishStatus = _a.publishStatus, matchUpTieId = _a.matchUpTieId, isRoundRobin = _a.isRoundRobin, roundProfile = _a.roundProfile, sideLineUps = _a.sideLineUps, matchUp = _a.matchUp, event = _a.event;
|
|
9732
9777
|
additionalContext = additionalContext !== null && additionalContext !== void 0 ? additionalContext : {};
|
|
9733
9778
|
var tieFormat = (_b = resolveTieFormat({
|
|
9734
9779
|
drawDefinition: drawDefinition,
|
|
@@ -9752,8 +9797,10 @@ function getAllStructureMatchUps(_a) {
|
|
|
9752
9797
|
scheduleVisibilityFilters: scheduleVisibilityFilters,
|
|
9753
9798
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
9754
9799
|
tournamentRecord: tournamentRecord,
|
|
9800
|
+
usePublishState: usePublishState,
|
|
9755
9801
|
scheduleTiming: scheduleTiming,
|
|
9756
9802
|
matchUpFormat: matchUpFormat,
|
|
9803
|
+
publishStatus: publishStatus,
|
|
9757
9804
|
matchUpType: matchUpType,
|
|
9758
9805
|
matchUp: matchUp,
|
|
9759
9806
|
event: event,
|
|
@@ -9899,7 +9946,7 @@ function getAllStructureMatchUps(_a) {
|
|
|
9899
9946
|
Object.assign(matchUpWithContext, makeDeepCopy({ sides: sides }, true, true));
|
|
9900
9947
|
}
|
|
9901
9948
|
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
9902
|
-
var participantAttributes_1 =
|
|
9949
|
+
var participantAttributes_1 = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_PARTICIPANT];
|
|
9903
9950
|
var getMappedParticipant_1 = function (participantId) {
|
|
9904
9951
|
var _a;
|
|
9905
9952
|
var participant = (_a = participantMap === null || participantMap === void 0 ? void 0 : participantMap[participantId]) === null || _a === void 0 ? void 0 : _a.participant;
|
|
@@ -10017,6 +10064,8 @@ function getAllStructureMatchUps(_a) {
|
|
|
10017
10064
|
additionalContext: additionalContext,
|
|
10018
10065
|
appliedPolicies: appliedPolicies,
|
|
10019
10066
|
isCollectionBye: isCollectionBye_1,
|
|
10067
|
+
usePublishState: usePublishState,
|
|
10068
|
+
publishStatus: publishStatus,
|
|
10020
10069
|
matchUpTieId: matchUpTieId,
|
|
10021
10070
|
isRoundRobin: isRoundRobin,
|
|
10022
10071
|
roundProfile: roundProfile,
|
|
@@ -10269,7 +10318,7 @@ function generateTieMatchUpScore(params) {
|
|
|
10269
10318
|
var tieFormat = ((_c = resolveTieFormat({ matchUp: matchUp, drawDefinition: drawDefinition, structure: structure, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat) || (params === null || params === void 0 ? void 0 : params.tieFormat);
|
|
10270
10319
|
if (!tieFormat)
|
|
10271
10320
|
return { error: MISSING_TIE_FORMAT };
|
|
10272
|
-
var result = validateTieFormat({ tieFormat: tieFormat
|
|
10321
|
+
var result = validateTieFormat({ tieFormat: tieFormat });
|
|
10273
10322
|
if (result.error)
|
|
10274
10323
|
return result;
|
|
10275
10324
|
var collectionDefinitions = (tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) || [];
|
|
@@ -10581,15 +10630,15 @@ function modifyPositionAssignmentsNotice(_a) {
|
|
|
10581
10630
|
}
|
|
10582
10631
|
|
|
10583
10632
|
function ensureSideLineUps(_a) {
|
|
10584
|
-
var _b, _c
|
|
10633
|
+
var _b, _c;
|
|
10585
10634
|
var inContextDualMatchUp = _a.inContextDualMatchUp, drawDefinition = _a.drawDefinition, tournamentId = _a.tournamentId, dualMatchUp = _a.dualMatchUp, eventId = _a.eventId;
|
|
10586
|
-
if (dualMatchUp
|
|
10635
|
+
if (dualMatchUp) {
|
|
10587
10636
|
if (!inContextDualMatchUp) {
|
|
10588
|
-
inContextDualMatchUp = (
|
|
10637
|
+
inContextDualMatchUp = (_b = findDrawMatchUp({
|
|
10589
10638
|
matchUpId: dualMatchUp.matchUpId,
|
|
10590
10639
|
inContext: true,
|
|
10591
10640
|
drawDefinition: drawDefinition,
|
|
10592
|
-
})) === null ||
|
|
10641
|
+
})) === null || _b === void 0 ? void 0 : _b.matchUp;
|
|
10593
10642
|
}
|
|
10594
10643
|
var extension = findExtension$2({
|
|
10595
10644
|
element: drawDefinition,
|
|
@@ -10600,9 +10649,18 @@ function ensureSideLineUps(_a) {
|
|
|
10600
10649
|
var displaySideNumber = _a.displaySideNumber, drawPosition = _a.drawPosition, sideNumber = _a.sideNumber;
|
|
10601
10650
|
return ({ drawPosition: drawPosition, sideNumber: sideNumber, displaySideNumber: displaySideNumber });
|
|
10602
10651
|
};
|
|
10603
|
-
dualMatchUp.sides = (
|
|
10604
|
-
var
|
|
10605
|
-
|
|
10652
|
+
dualMatchUp.sides = (_c = inContextDualMatchUp === null || inContextDualMatchUp === void 0 ? void 0 : inContextDualMatchUp.sides) === null || _c === void 0 ? void 0 : _c.map(function (contextSide) {
|
|
10653
|
+
var _a, _b;
|
|
10654
|
+
var participantId = contextSide.participantId;
|
|
10655
|
+
var referenceLineUp = (participantId && lineUps_1[participantId]) || undefined;
|
|
10656
|
+
var _c = (_b = (_a = dualMatchUp.sides) === null || _a === void 0 ? void 0 : _a.find(function (_a) {
|
|
10657
|
+
var sideNumber = _a.sideNumber;
|
|
10658
|
+
return sideNumber === contextSide.sideNumber;
|
|
10659
|
+
})) !== null && _b !== void 0 ? _b : {}, noContextLineUp = _c.lineUp, noContextSideDetail = __rest(_c, ["lineUp"]);
|
|
10660
|
+
var lineUp = (noContextLineUp === null || noContextLineUp === void 0 ? void 0 : noContextLineUp.length)
|
|
10661
|
+
? noContextLineUp
|
|
10662
|
+
: referenceLineUp;
|
|
10663
|
+
return __assign(__assign(__assign({}, extractSideDetail_1(contextSide)), noContextSideDetail), { lineUp: lineUp });
|
|
10606
10664
|
});
|
|
10607
10665
|
modifyMatchUpNotice({
|
|
10608
10666
|
context: 'ensureSidLineUps',
|
|
@@ -11430,7 +11488,7 @@ function getUpcomingInfo(params) {
|
|
|
11430
11488
|
}
|
|
11431
11489
|
|
|
11432
11490
|
function getStructureMatchUps(_a) {
|
|
11433
|
-
var _b = _a.requireParticipants, requireParticipants = _b === void 0 ? true : _b, scheduleVisibilityFilters = _a.scheduleVisibilityFilters, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, matchUpFilters = _a.matchUpFilters, contextFilters = _a.contextFilters, contextContent = _a.contextContent, participantMap = _a.participantMap, scheduleTiming = _a.scheduleTiming, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, exitProfiles = _a.exitProfiles, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, inContext = _a.inContext, structure = _a.structure, context = _a.context, event = _a.event;
|
|
11491
|
+
var _b = _a.requireParticipants, requireParticipants = _b === void 0 ? true : _b, scheduleVisibilityFilters = _a.scheduleVisibilityFilters, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, usePublishState = _a.usePublishState, matchUpFilters = _a.matchUpFilters, contextFilters = _a.contextFilters, contextContent = _a.contextContent, participantMap = _a.participantMap, scheduleTiming = _a.scheduleTiming, publishStatus = _a.publishStatus, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, exitProfiles = _a.exitProfiles, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, inContext = _a.inContext, structure = _a.structure, context = _a.context, event = _a.event;
|
|
11434
11492
|
if (!structure && structureId) {
|
|
11435
11493
|
(structure = findStructure({ drawDefinition: drawDefinition, structureId: structureId }).structure);
|
|
11436
11494
|
}
|
|
@@ -11441,13 +11499,15 @@ function getStructureMatchUps(_a) {
|
|
|
11441
11499
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
11442
11500
|
policyDefinitions: policyDefinitions,
|
|
11443
11501
|
tournamentRecord: tournamentRecord,
|
|
11444
|
-
|
|
11502
|
+
usePublishState: usePublishState,
|
|
11445
11503
|
matchUpFilters: matchUpFilters,
|
|
11446
11504
|
contextFilters: contextFilters,
|
|
11447
|
-
contextProfile: contextProfile,
|
|
11448
11505
|
contextContent: contextContent,
|
|
11449
11506
|
participantMap: participantMap,
|
|
11450
11507
|
scheduleTiming: scheduleTiming,
|
|
11508
|
+
publishStatus: publishStatus,
|
|
11509
|
+
contextProfile: contextProfile,
|
|
11510
|
+
drawDefinition: drawDefinition,
|
|
11451
11511
|
exitProfiles: exitProfiles,
|
|
11452
11512
|
matchUpsMap: matchUpsMap,
|
|
11453
11513
|
structure: structure,
|
|
@@ -11536,7 +11596,7 @@ function getDrawMatchUps(params) {
|
|
|
11536
11596
|
if (!(params === null || params === void 0 ? void 0 : params.drawDefinition))
|
|
11537
11597
|
return { error: MISSING_DRAW_DEFINITION };
|
|
11538
11598
|
var tournamentParticipants = params.tournamentParticipants, contextContent = params.contextContent, matchUpsMap = params.matchUpsMap;
|
|
11539
|
-
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, tournamentAppliedPolicies = params.tournamentAppliedPolicies, requireParticipants = params.requireParticipants, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, contextFilters = params.contextFilters,
|
|
11599
|
+
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, tournamentAppliedPolicies = params.tournamentAppliedPolicies, requireParticipants = params.requireParticipants, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, contextFilters = params.contextFilters, matchUpFilters = params.matchUpFilters, scheduleTiming = params.scheduleTiming, participantMap = params.participantMap, publishStatus = params.publishStatus, contextProfile = params.contextProfile, drawDefinition = params.drawDefinition, nextMatchUps = params.nextMatchUps, inContext = params.inContext, context = params.context, event = params.event;
|
|
11540
11600
|
var allAbandonedMatchUps = [];
|
|
11541
11601
|
var allCompletedMatchUps = [];
|
|
11542
11602
|
var allUpcomingMatchUps = [];
|
|
@@ -11586,9 +11646,11 @@ function getDrawMatchUps(params) {
|
|
|
11586
11646
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
11587
11647
|
policyDefinitions: policyDefinitions,
|
|
11588
11648
|
tournamentRecord: tournamentRecord,
|
|
11649
|
+
usePublishState: usePublishState,
|
|
11650
|
+
contextContent: contextContent,
|
|
11589
11651
|
participantMap: participantMap,
|
|
11590
11652
|
scheduleTiming: scheduleTiming,
|
|
11591
|
-
|
|
11653
|
+
publishStatus: publishStatus,
|
|
11592
11654
|
contextProfile: contextProfile,
|
|
11593
11655
|
drawDefinition: drawDefinition,
|
|
11594
11656
|
exitProfiles: exitProfiles,
|
|
@@ -17248,70 +17310,6 @@ var fixtures = {
|
|
|
17248
17310
|
flagIOC: flagIOC,
|
|
17249
17311
|
};
|
|
17250
17312
|
|
|
17251
|
-
function addNationalityCode(_a) {
|
|
17252
|
-
var participant = _a.participant, withISO2 = _a.withISO2, withIOC = _a.withIOC;
|
|
17253
|
-
var person = participant.person, individualParticipants = participant.individualParticipants;
|
|
17254
|
-
var persons = [person, individualParticipants === null || individualParticipants === void 0 ? void 0 : individualParticipants.map(function (_a) {
|
|
17255
|
-
var person = _a.person;
|
|
17256
|
-
return person;
|
|
17257
|
-
})]
|
|
17258
|
-
.flat()
|
|
17259
|
-
.filter(Boolean);
|
|
17260
|
-
function annotatePerson(person) {
|
|
17261
|
-
var nationalityCode = (person || {}).nationalityCode;
|
|
17262
|
-
if (nationalityCode) {
|
|
17263
|
-
var country = countries.find(function (_a) {
|
|
17264
|
-
var iso = _a.iso;
|
|
17265
|
-
return iso === nationalityCode;
|
|
17266
|
-
});
|
|
17267
|
-
if (withIOC && (country === null || country === void 0 ? void 0 : country.ioc) && !person.iocNationalityCode)
|
|
17268
|
-
person.iocNationalityCode = country.ioc;
|
|
17269
|
-
if (withISO2 && (country === null || country === void 0 ? void 0 : country.iso2) && !person.iso2NationalityCode)
|
|
17270
|
-
person.iso2NationalityCode = country.iso2;
|
|
17271
|
-
if ((country === null || country === void 0 ? void 0 : country.label) && !person.countryName)
|
|
17272
|
-
person.countryName = country.label;
|
|
17273
|
-
}
|
|
17274
|
-
}
|
|
17275
|
-
persons.forEach(annotatePerson);
|
|
17276
|
-
}
|
|
17277
|
-
|
|
17278
|
-
function addIndividualParticipants(_a) {
|
|
17279
|
-
var e_1, _b, e_2, _c;
|
|
17280
|
-
var _d;
|
|
17281
|
-
var participantMap = _a.participantMap, template = _a.template;
|
|
17282
|
-
var participantObjects = Object.values(participantMap);
|
|
17283
|
-
try {
|
|
17284
|
-
for (var participantObjects_1 = __values(participantObjects), participantObjects_1_1 = participantObjects_1.next(); !participantObjects_1_1.done; participantObjects_1_1 = participantObjects_1.next()) {
|
|
17285
|
-
var participantObject = participantObjects_1_1.value;
|
|
17286
|
-
var participant = participantObject.participant;
|
|
17287
|
-
if ((_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.length) {
|
|
17288
|
-
participant.individualParticipants = [];
|
|
17289
|
-
try {
|
|
17290
|
-
for (var _e = (e_2 = void 0, __values(participant.individualParticipantIds)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
17291
|
-
var participantId = _f.value;
|
|
17292
|
-
var source = participantMap[participantId].participant;
|
|
17293
|
-
participant.individualParticipants.push(template ? attributeFilter({ template: template, source: source }) : source);
|
|
17294
|
-
}
|
|
17295
|
-
}
|
|
17296
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
17297
|
-
finally {
|
|
17298
|
-
try {
|
|
17299
|
-
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
17300
|
-
}
|
|
17301
|
-
finally { if (e_2) throw e_2.error; }
|
|
17302
|
-
}
|
|
17303
|
-
}
|
|
17304
|
-
}
|
|
17305
|
-
}
|
|
17306
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
17307
|
-
finally {
|
|
17308
|
-
try {
|
|
17309
|
-
if (participantObjects_1_1 && !participantObjects_1_1.done && (_b = participantObjects_1.return)) _b.call(participantObjects_1);
|
|
17310
|
-
}
|
|
17311
|
-
finally { if (e_1) throw e_1.error; }
|
|
17312
|
-
}
|
|
17313
|
-
}
|
|
17314
|
-
|
|
17315
17313
|
function getTimeItem(_a) {
|
|
17316
17314
|
var returnPreviousValues = _a.returnPreviousValues, itemSubTypes = _a.itemSubTypes, itemType = _a.itemType, element = _a.element;
|
|
17317
17315
|
if (!element)
|
|
@@ -17405,6 +17403,80 @@ function getParticipantTimeItem(_a) {
|
|
|
17405
17403
|
return (timeItem && { timeItem: timeItem, previousItems: previousItems }) || { info: info };
|
|
17406
17404
|
}
|
|
17407
17405
|
|
|
17406
|
+
function getEventPublishStatus(_a) {
|
|
17407
|
+
var _b, _c, _d;
|
|
17408
|
+
var event = _a.event, _e = _a.status, status = _e === void 0 ? PUBLIC : _e;
|
|
17409
|
+
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
17410
|
+
return (_d = (_c = (_b = getEventTimeItem({
|
|
17411
|
+
itemType: itemType,
|
|
17412
|
+
event: event,
|
|
17413
|
+
})) === null || _b === void 0 ? void 0 : _b.timeItem) === null || _c === void 0 ? void 0 : _c.itemValue) === null || _d === void 0 ? void 0 : _d[status];
|
|
17414
|
+
}
|
|
17415
|
+
|
|
17416
|
+
function addNationalityCode(_a) {
|
|
17417
|
+
var participant = _a.participant, withISO2 = _a.withISO2, withIOC = _a.withIOC;
|
|
17418
|
+
var person = participant.person, individualParticipants = participant.individualParticipants;
|
|
17419
|
+
var persons = [person, individualParticipants === null || individualParticipants === void 0 ? void 0 : individualParticipants.map(function (_a) {
|
|
17420
|
+
var person = _a.person;
|
|
17421
|
+
return person;
|
|
17422
|
+
})]
|
|
17423
|
+
.flat()
|
|
17424
|
+
.filter(Boolean);
|
|
17425
|
+
function annotatePerson(person) {
|
|
17426
|
+
var nationalityCode = (person || {}).nationalityCode;
|
|
17427
|
+
if (nationalityCode) {
|
|
17428
|
+
var country = countries.find(function (_a) {
|
|
17429
|
+
var iso = _a.iso;
|
|
17430
|
+
return iso === nationalityCode;
|
|
17431
|
+
});
|
|
17432
|
+
if (withIOC && (country === null || country === void 0 ? void 0 : country.ioc) && !person.iocNationalityCode)
|
|
17433
|
+
person.iocNationalityCode = country.ioc;
|
|
17434
|
+
if (withISO2 && (country === null || country === void 0 ? void 0 : country.iso2) && !person.iso2NationalityCode)
|
|
17435
|
+
person.iso2NationalityCode = country.iso2;
|
|
17436
|
+
if ((country === null || country === void 0 ? void 0 : country.label) && !person.countryName)
|
|
17437
|
+
person.countryName = country.label;
|
|
17438
|
+
}
|
|
17439
|
+
}
|
|
17440
|
+
persons.forEach(annotatePerson);
|
|
17441
|
+
}
|
|
17442
|
+
|
|
17443
|
+
function addIndividualParticipants(_a) {
|
|
17444
|
+
var e_1, _b, e_2, _c;
|
|
17445
|
+
var _d;
|
|
17446
|
+
var participantMap = _a.participantMap, template = _a.template;
|
|
17447
|
+
var participantObjects = Object.values(participantMap);
|
|
17448
|
+
try {
|
|
17449
|
+
for (var participantObjects_1 = __values(participantObjects), participantObjects_1_1 = participantObjects_1.next(); !participantObjects_1_1.done; participantObjects_1_1 = participantObjects_1.next()) {
|
|
17450
|
+
var participantObject = participantObjects_1_1.value;
|
|
17451
|
+
var participant = participantObject.participant;
|
|
17452
|
+
if ((_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.length) {
|
|
17453
|
+
participant.individualParticipants = [];
|
|
17454
|
+
try {
|
|
17455
|
+
for (var _e = (e_2 = void 0, __values(participant.individualParticipantIds)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
17456
|
+
var participantId = _f.value;
|
|
17457
|
+
var source = participantMap[participantId].participant;
|
|
17458
|
+
participant.individualParticipants.push(template ? attributeFilter({ template: template, source: source }) : source);
|
|
17459
|
+
}
|
|
17460
|
+
}
|
|
17461
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
17462
|
+
finally {
|
|
17463
|
+
try {
|
|
17464
|
+
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
17465
|
+
}
|
|
17466
|
+
finally { if (e_2) throw e_2.error; }
|
|
17467
|
+
}
|
|
17468
|
+
}
|
|
17469
|
+
}
|
|
17470
|
+
}
|
|
17471
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
17472
|
+
finally {
|
|
17473
|
+
try {
|
|
17474
|
+
if (participantObjects_1_1 && !participantObjects_1_1.done && (_b = participantObjects_1.return)) _b.call(participantObjects_1);
|
|
17475
|
+
}
|
|
17476
|
+
finally { if (e_1) throw e_1.error; }
|
|
17477
|
+
}
|
|
17478
|
+
}
|
|
17479
|
+
|
|
17408
17480
|
var _a$4, _b;
|
|
17409
17481
|
var typeMap = (_a$4 = {},
|
|
17410
17482
|
_a$4[GROUP] = 'groupParticipantIds',
|
|
@@ -17792,7 +17864,7 @@ function tournamentMatchUps(params) {
|
|
|
17792
17864
|
if (!(params === null || params === void 0 ? void 0 : params.tournamentRecord))
|
|
17793
17865
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17794
17866
|
var contextContent = params.contextContent;
|
|
17795
|
-
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, useParticipantMap = params.useParticipantMap, tournamentRecord = params.tournamentRecord, _d = params.inContext, inContext = _d === void 0 ? true : _d,
|
|
17867
|
+
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, useParticipantMap = params.useParticipantMap, tournamentRecord = params.tournamentRecord, _d = params.inContext, inContext = _d === void 0 ? true : _d, usePublishState = params.usePublishState, contextFilters = params.contextFilters, matchUpFilters = params.matchUpFilters, contextProfile = params.contextProfile, nextMatchUps = params.nextMatchUps, context = params.context;
|
|
17796
17868
|
var tournamentId = (_a = params.tournamentId) !== null && _a !== void 0 ? _a : tournamentRecord.tournamentId;
|
|
17797
17869
|
var events = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) !== null && _b !== void 0 ? _b : [];
|
|
17798
17870
|
var _e = hydrateParticipants({
|
|
@@ -17827,6 +17899,7 @@ function tournamentMatchUps(params) {
|
|
|
17827
17899
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
17828
17900
|
policyDefinitions: policyDefinitions,
|
|
17829
17901
|
tournamentRecord: tournamentRecord,
|
|
17902
|
+
usePublishState: usePublishState,
|
|
17830
17903
|
contextFilters: contextFilters,
|
|
17831
17904
|
contextProfile: contextProfile,
|
|
17832
17905
|
contextContent: contextContent,
|
|
@@ -17858,7 +17931,7 @@ function eventMatchUps(params) {
|
|
|
17858
17931
|
var _a;
|
|
17859
17932
|
var _b, _c, _d;
|
|
17860
17933
|
var tournamentParticipants = params.participants, contextContent = params.contextContent, participantMap = params.participantMap;
|
|
17861
|
-
var tournamentAppliedPolicies = params.tournamentAppliedPolicies, scheduleVisibilityFilters = params.scheduleVisibilityFilters, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, useParticipantMap = params.useParticipantMap, tournamentRecord = params.tournamentRecord,
|
|
17934
|
+
var tournamentAppliedPolicies = params.tournamentAppliedPolicies, scheduleVisibilityFilters = params.scheduleVisibilityFilters, participantsProfile = params.participantsProfile, afterRecoveryTimes = params.afterRecoveryTimes, policyDefinitions = params.policyDefinitions, useParticipantMap = params.useParticipantMap, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, contextFilters = params.contextFilters, matchUpFilters = params.matchUpFilters, contextProfile = params.contextProfile, nextMatchUps = params.nextMatchUps, tournamentId = params.tournamentId, inContext = params.inContext, context = params.context, event = params.event;
|
|
17862
17935
|
if (!event)
|
|
17863
17936
|
return { error: MISSING_EVENT };
|
|
17864
17937
|
var eventId = event.eventId, eventName = event.eventName, endDate = event.endDate;
|
|
@@ -17888,6 +17961,7 @@ function eventMatchUps(params) {
|
|
|
17888
17961
|
contextProfile: contextProfile,
|
|
17889
17962
|
event: event,
|
|
17890
17963
|
});
|
|
17964
|
+
var publishStatus = getEventPublishStatus({ event: event });
|
|
17891
17965
|
var drawDefinitions = (_d = event.drawDefinitions) !== null && _d !== void 0 ? _d : [];
|
|
17892
17966
|
var eventResult = drawDefinitions.reduce(function (results, drawDefinition) {
|
|
17893
17967
|
var drawMatchUpsResult = getDrawMatchUps({
|
|
@@ -17899,12 +17973,14 @@ function eventMatchUps(params) {
|
|
|
17899
17973
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
17900
17974
|
policyDefinitions: policyDefinitions,
|
|
17901
17975
|
tournamentRecord: tournamentRecord,
|
|
17902
|
-
|
|
17976
|
+
usePublishState: usePublishState,
|
|
17903
17977
|
contextContent: contextContent,
|
|
17904
17978
|
contextFilters: contextFilters,
|
|
17905
|
-
contextProfile: contextProfile,
|
|
17906
17979
|
matchUpFilters: matchUpFilters,
|
|
17907
17980
|
participantMap: participantMap,
|
|
17981
|
+
publishStatus: publishStatus,
|
|
17982
|
+
contextProfile: contextProfile,
|
|
17983
|
+
drawDefinition: drawDefinition,
|
|
17908
17984
|
nextMatchUps: nextMatchUps,
|
|
17909
17985
|
inContext: inContext,
|
|
17910
17986
|
event: event,
|
|
@@ -17924,7 +18000,7 @@ function eventMatchUps(params) {
|
|
|
17924
18000
|
function drawMatchUps$1(_a) {
|
|
17925
18001
|
var _b;
|
|
17926
18002
|
var _c, _d, _e;
|
|
17927
|
-
var tournamentParticipants = _a.participants, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, scheduleVisibilityFilters = _a.scheduleVisibilityFilters, participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, useParticipantMap = _a.useParticipantMap, tournamentRecord = _a.tournamentRecord,
|
|
18003
|
+
var tournamentParticipants = _a.participants, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, scheduleVisibilityFilters = _a.scheduleVisibilityFilters, participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, useParticipantMap = _a.useParticipantMap, tournamentRecord = _a.tournamentRecord, usePublishState = _a.usePublishState, contextFilters = _a.contextFilters, contextContent = _a.contextContent, matchUpFilters = _a.matchUpFilters, participantMap = _a.participantMap, publishStatus = _a.publishStatus, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, nextMatchUps = _a.nextMatchUps, tournamentId = _a.tournamentId, inContext = _a.inContext, context = _a.context, event = _a.event;
|
|
17928
18004
|
var _f = event !== null && event !== void 0 ? event : {}, eventId = _f.eventId, eventName = _f.eventName, endDate = _f.endDate;
|
|
17929
18005
|
var additionalContext = __assign(__assign({}, context), definedAttributes({
|
|
17930
18006
|
eventId: eventId,
|
|
@@ -17962,12 +18038,14 @@ function drawMatchUps$1(_a) {
|
|
|
17962
18038
|
afterRecoveryTimes: afterRecoveryTimes,
|
|
17963
18039
|
policyDefinitions: policyDefinitions,
|
|
17964
18040
|
tournamentRecord: tournamentRecord,
|
|
18041
|
+
usePublishState: usePublishState,
|
|
17965
18042
|
participantMap: participantMap,
|
|
17966
|
-
|
|
17967
|
-
matchUpFilters: matchUpFilters,
|
|
18043
|
+
contextContent: contextContent,
|
|
17968
18044
|
contextFilters: contextFilters,
|
|
18045
|
+
matchUpFilters: matchUpFilters,
|
|
18046
|
+
publishStatus: publishStatus,
|
|
17969
18047
|
contextProfile: contextProfile,
|
|
17970
|
-
|
|
18048
|
+
drawDefinition: drawDefinition,
|
|
17971
18049
|
nextMatchUps: nextMatchUps,
|
|
17972
18050
|
inContext: inContext,
|
|
17973
18051
|
event: event,
|
|
@@ -18723,7 +18801,7 @@ function allCompetitionMatchUps(_a) {
|
|
|
18723
18801
|
return { matchUps: competitionMatchUps };
|
|
18724
18802
|
}
|
|
18725
18803
|
function competitionMatchUps(_a) {
|
|
18726
|
-
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, participantsProfile = _a.participantsProfile, tournamentRecords = _a.tournamentRecords, policyDefinitions = _a.policyDefinitions, matchUpFilters = _a.matchUpFilters, contextFilters = _a.contextFilters, nextMatchUps = _a.nextMatchUps, inContext = _a.inContext;
|
|
18804
|
+
var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, participantsProfile = _a.participantsProfile, tournamentRecords = _a.tournamentRecords, policyDefinitions = _a.policyDefinitions, usePublishState = _a.usePublishState, matchUpFilters = _a.matchUpFilters, contextFilters = _a.contextFilters, nextMatchUps = _a.nextMatchUps, inContext = _a.inContext;
|
|
18727
18805
|
if (typeof tournamentRecords !== 'object' ||
|
|
18728
18806
|
!Object.keys(tournamentRecords).length)
|
|
18729
18807
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
@@ -18735,6 +18813,7 @@ function competitionMatchUps(_a) {
|
|
|
18735
18813
|
participantsProfile: participantsProfile,
|
|
18736
18814
|
policyDefinitions: policyDefinitions,
|
|
18737
18815
|
tournamentRecord: tournamentRecord,
|
|
18816
|
+
usePublishState: usePublishState,
|
|
18738
18817
|
matchUpFilters: matchUpFilters,
|
|
18739
18818
|
contextFilters: contextFilters,
|
|
18740
18819
|
nextMatchUps: nextMatchUps,
|
|
@@ -24817,6 +24896,14 @@ function getMatchUpDailyLimits(_a) {
|
|
|
24817
24896
|
return { matchUpDailyLimits: dailyLimits };
|
|
24818
24897
|
}
|
|
24819
24898
|
|
|
24899
|
+
function getDrawPublishStatus(_a) {
|
|
24900
|
+
var _b;
|
|
24901
|
+
var drawDetails = _a.drawDetails, drawId = _a.drawId;
|
|
24902
|
+
// TODO: check details.embargo
|
|
24903
|
+
var details = (_b = drawDetails === null || drawDetails === void 0 ? void 0 : drawDetails[drawId]) === null || _b === void 0 ? void 0 : _b.publishingDetail;
|
|
24904
|
+
return details === null || details === void 0 ? void 0 : details.published;
|
|
24905
|
+
}
|
|
24906
|
+
|
|
24820
24907
|
function scheduledSortedMatchUps(_a) {
|
|
24821
24908
|
var e_1, _b, e_2, _c, e_3, _d, e_4, _e;
|
|
24822
24909
|
var schedulingProfile = _a.schedulingProfile, _f = _a.matchUps, matchUps = _f === void 0 ? [] : _f;
|
|
@@ -24986,26 +25073,28 @@ function courtGridRows(_a) {
|
|
|
24986
25073
|
}
|
|
24987
25074
|
|
|
24988
25075
|
function competitionScheduleMatchUps(params) {
|
|
24989
|
-
var _a
|
|
25076
|
+
var _a;
|
|
25077
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24990
25078
|
if (typeof (params === null || params === void 0 ? void 0 : params.tournamentRecords) !== 'object' ||
|
|
24991
25079
|
!Object.keys(params === null || params === void 0 ? void 0 : params.tournamentRecords).length)
|
|
24992
25080
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
24993
|
-
var
|
|
25081
|
+
var _k = getVenuesAndCourts(params), courts = _k.courts, venues = _k.venues;
|
|
24994
25082
|
var getResult = getSchedulingProfile$1(params);
|
|
24995
25083
|
var schedulingProfile = getResult.schedulingProfile;
|
|
24996
|
-
var
|
|
24997
|
-
|
|
24998
|
-
|
|
25084
|
+
var _l = params.sortDateMatchUps, sortDateMatchUps = _l === void 0 ? true : _l, courtCompletedMatchUps = params.courtCompletedMatchUps, alwaysReturnCompleted = params.alwaysReturnCompleted, activeTournamentId = params.activeTournamentId, tournamentRecords = params.tournamentRecords, withCourtGridRows = params.withCourtGridRows, minCourtGridRows = params.minCourtGridRows, usePublishState = params.usePublishState, _m = params.status, status = _m === void 0 ? PUBLIC : _m, sortCourtsData = params.sortCourtsData;
|
|
25085
|
+
// PUBLISH.STATUS is attached at the tournament level by `publishOrderOfPlay`
|
|
25086
|
+
var tournamentPublishStatus = usePublishState
|
|
25087
|
+
? (_c = (_b = getTournamentTimeItem({
|
|
24999
25088
|
tournamentRecord: tournamentRecords[activeTournamentId !== null && activeTournamentId !== void 0 ? activeTournamentId : getTournamentId()],
|
|
25000
25089
|
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
25001
|
-
}).timeItem
|
|
25090
|
+
}).timeItem) === null || _b === void 0 ? void 0 : _b.itemValue) === null || _c === void 0 ? void 0 : _c[status]
|
|
25002
25091
|
: undefined;
|
|
25003
|
-
var publishStatus = (_a = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _a === void 0 ? void 0 : _a[status];
|
|
25004
25092
|
var allCompletedMatchUps = alwaysReturnCompleted
|
|
25005
25093
|
? competitionMatchUps(__assign(__assign({}, params), { matchUpFilters: __assign(__assign({}, params.matchUpFilters), { matchUpStatuses: [MatchUpStatusEnum.Completed] }), contextFilters: params.contextFilters })).completedMatchUps
|
|
25006
25094
|
: [];
|
|
25095
|
+
// if { usePublishState: true } only return non-completed matchUps if there is orderOfPlay detail
|
|
25007
25096
|
if (usePublishState &&
|
|
25008
|
-
(!
|
|
25097
|
+
(!tournamentPublishStatus || !Object.keys(tournamentPublishStatus).length)) {
|
|
25009
25098
|
return {
|
|
25010
25099
|
completedMatchUps: allCompletedMatchUps,
|
|
25011
25100
|
dateMatchUps: [],
|
|
@@ -25013,57 +25102,62 @@ function competitionScheduleMatchUps(params) {
|
|
|
25013
25102
|
venues: venues,
|
|
25014
25103
|
};
|
|
25015
25104
|
}
|
|
25016
|
-
var publishedDrawIds
|
|
25017
|
-
|
|
25018
|
-
|
|
25105
|
+
var publishedDrawIds, detailsMap;
|
|
25106
|
+
if (usePublishState) {
|
|
25107
|
+
(_a = getCompetitionPublishedDrawDetails({
|
|
25108
|
+
tournamentRecords: tournamentRecords,
|
|
25109
|
+
}), publishedDrawIds = _a.drawIds, detailsMap = _a.detailsMap);
|
|
25110
|
+
}
|
|
25019
25111
|
if (publishedDrawIds === null || publishedDrawIds === void 0 ? void 0 : publishedDrawIds.length) {
|
|
25020
25112
|
if (!params.contextFilters)
|
|
25021
25113
|
params.contextFilters = {};
|
|
25022
|
-
if (!((
|
|
25114
|
+
if (!((_d = params.contextFilters) === null || _d === void 0 ? void 0 : _d.drawIds)) {
|
|
25023
25115
|
params.contextFilters.drawIds = publishedDrawIds;
|
|
25024
25116
|
}
|
|
25025
25117
|
else {
|
|
25026
25118
|
params.contextFilters.drawIds = params.contextFilters.drawIds.filter(function (drawId) { return publishedDrawIds.includes(drawId); });
|
|
25027
25119
|
}
|
|
25028
25120
|
}
|
|
25029
|
-
if ((
|
|
25121
|
+
if ((_e = tournamentPublishStatus === null || tournamentPublishStatus === void 0 ? void 0 : tournamentPublishStatus.eventIds) === null || _e === void 0 ? void 0 : _e.length) {
|
|
25030
25122
|
if (!params.matchUpFilters)
|
|
25031
25123
|
params.matchUpFilters = {};
|
|
25032
|
-
if ((
|
|
25124
|
+
if ((_f = params.matchUpFilters) === null || _f === void 0 ? void 0 : _f.eventIds) {
|
|
25033
25125
|
if (!params.matchUpFilters.eventIds.length) {
|
|
25034
|
-
params.matchUpFilters.eventIds =
|
|
25126
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
25035
25127
|
}
|
|
25036
25128
|
else {
|
|
25037
|
-
params.matchUpFilters.eventIds = params.matchUpFilters.eventIds.filter(function (eventId) { return
|
|
25129
|
+
params.matchUpFilters.eventIds = params.matchUpFilters.eventIds.filter(function (eventId) { return tournamentPublishStatus.eventIds.includes(eventId); });
|
|
25038
25130
|
}
|
|
25039
25131
|
}
|
|
25040
25132
|
else {
|
|
25041
|
-
params.matchUpFilters.eventIds =
|
|
25133
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
25042
25134
|
}
|
|
25043
25135
|
}
|
|
25044
|
-
if ((
|
|
25136
|
+
if ((_g = tournamentPublishStatus === null || tournamentPublishStatus === void 0 ? void 0 : tournamentPublishStatus.scheduledDates) === null || _g === void 0 ? void 0 : _g.length) {
|
|
25045
25137
|
if (!params.matchUpFilters)
|
|
25046
25138
|
params.matchUpFilters = {};
|
|
25047
25139
|
if (params.matchUpFilters.scheduledDates) {
|
|
25048
25140
|
if (!params.matchUpFilters.scheduledDates.length) {
|
|
25049
|
-
params.matchUpFilters.scheduledDates =
|
|
25141
|
+
params.matchUpFilters.scheduledDates =
|
|
25142
|
+
tournamentPublishStatus.scheduledDates;
|
|
25050
25143
|
}
|
|
25051
25144
|
else {
|
|
25052
25145
|
params.matchUpFilters.scheduledDates =
|
|
25053
25146
|
params.matchUpFilters.scheduledDates.filter(function (scheduledDate) {
|
|
25054
|
-
return
|
|
25147
|
+
return tournamentPublishStatus.scheduledDates.includes(scheduledDate);
|
|
25055
25148
|
});
|
|
25056
25149
|
}
|
|
25057
25150
|
}
|
|
25058
25151
|
else {
|
|
25059
|
-
params.matchUpFilters.scheduledDates =
|
|
25152
|
+
params.matchUpFilters.scheduledDates =
|
|
25153
|
+
tournamentPublishStatus.scheduledDates;
|
|
25060
25154
|
}
|
|
25061
25155
|
}
|
|
25062
25156
|
// optimization: if all completed matchUps have already been retrieved, skip the hydration process
|
|
25063
25157
|
if (alwaysReturnCompleted) {
|
|
25064
25158
|
if (!params.matchUpFilters)
|
|
25065
25159
|
params.matchUpFilters = {};
|
|
25066
|
-
if ((
|
|
25160
|
+
if ((_j = (_h = params.matchUpFilters) === null || _h === void 0 ? void 0 : _h.excludeMatchUpStatuses) === null || _j === void 0 ? void 0 : _j.length) {
|
|
25067
25161
|
if (!params.matchUpFilters.excludeMatchUpStatuses.includes(COMPLETED$1)) {
|
|
25068
25162
|
params.matchUpFilters.excludeMatchUpStatuses.push(COMPLETED$1);
|
|
25069
25163
|
}
|
|
@@ -25072,8 +25166,47 @@ function competitionScheduleMatchUps(params) {
|
|
|
25072
25166
|
params.matchUpFilters.excludeMatchUpStatuses = [COMPLETED$1];
|
|
25073
25167
|
}
|
|
25074
25168
|
}
|
|
25075
|
-
var
|
|
25169
|
+
var _o = competitionMatchUps(__assign(__assign({}, params), { matchUpFilters: params.matchUpFilters, contextFilters: params.contextFilters })), completedMatchUps = _o.completedMatchUps, upcomingMatchUps = _o.upcomingMatchUps, pendingMatchUps = _o.pendingMatchUps, groupInfo = _o.groupInfo;
|
|
25076
25170
|
var relevantMatchUps = __spreadArray(__spreadArray([], __read((upcomingMatchUps !== null && upcomingMatchUps !== void 0 ? upcomingMatchUps : [])), false), __read((pendingMatchUps !== null && pendingMatchUps !== void 0 ? pendingMatchUps : [])), false);
|
|
25171
|
+
// add any stage or structure filtering
|
|
25172
|
+
if (detailsMap && Object.keys(detailsMap).length) {
|
|
25173
|
+
relevantMatchUps = relevantMatchUps.filter(function (matchUp) {
|
|
25174
|
+
var drawId = matchUp.drawId, structureId = matchUp.structureId, stage = matchUp.stage;
|
|
25175
|
+
if (!detailsMap[drawId])
|
|
25176
|
+
return false;
|
|
25177
|
+
if (detailsMap[drawId].stageDetails) {
|
|
25178
|
+
var stageKeys = Object.keys(detailsMap[drawId].stageDetails);
|
|
25179
|
+
var unpublishedStages = stageKeys.filter(function (stage) { return !detailsMap[drawId].stageDetails[stage].published; });
|
|
25180
|
+
var publishedStages = stageKeys.filter(function (stage) { return detailsMap[drawId].stageDetails[stage].published; });
|
|
25181
|
+
if (unpublishedStages.length && unpublishedStages.includes(stage))
|
|
25182
|
+
return false;
|
|
25183
|
+
if (publishedStages.length && publishedStages.includes(stage))
|
|
25184
|
+
return true;
|
|
25185
|
+
return (unpublishedStages.length &&
|
|
25186
|
+
!unpublishedStages.includes(stage) &&
|
|
25187
|
+
!publishedStages.length);
|
|
25188
|
+
}
|
|
25189
|
+
if (detailsMap[drawId].structureDetails) {
|
|
25190
|
+
var structureIdKeys = Object.keys(detailsMap[drawId].structureDetails);
|
|
25191
|
+
var unpublishedStructureIds = structureIdKeys.filter(function (structureId) {
|
|
25192
|
+
return !detailsMap[drawId].structureDetails[structureId].published;
|
|
25193
|
+
});
|
|
25194
|
+
var publishedStructureIds = structureIdKeys.filter(function (structureId) {
|
|
25195
|
+
return detailsMap[drawId].structureDetails[structureId].published;
|
|
25196
|
+
});
|
|
25197
|
+
if (unpublishedStructureIds.length &&
|
|
25198
|
+
unpublishedStructureIds.includes(structureId))
|
|
25199
|
+
return false;
|
|
25200
|
+
if (publishedStructureIds.length &&
|
|
25201
|
+
publishedStructureIds.includes(structureId))
|
|
25202
|
+
return true;
|
|
25203
|
+
return (unpublishedStructureIds.length &&
|
|
25204
|
+
!unpublishedStructureIds.includes(structureId) &&
|
|
25205
|
+
!publishedStructureIds.length);
|
|
25206
|
+
}
|
|
25207
|
+
return true;
|
|
25208
|
+
});
|
|
25209
|
+
}
|
|
25077
25210
|
var dateMatchUps = sortDateMatchUps
|
|
25078
25211
|
? scheduledSortedMatchUps({ matchUps: relevantMatchUps, schedulingProfile: schedulingProfile })
|
|
25079
25212
|
: relevantMatchUps;
|
|
@@ -25083,19 +25216,19 @@ function competitionScheduleMatchUps(params) {
|
|
|
25083
25216
|
return __assign({ surfaceCategory: (_a = court === null || court === void 0 ? void 0 : court.surfaceCategory) !== null && _a !== void 0 ? _a : '', matchUps: matchUps }, court);
|
|
25084
25217
|
});
|
|
25085
25218
|
var result = {
|
|
25086
|
-
courtsData: courtsData,
|
|
25087
25219
|
completedMatchUps: alwaysReturnCompleted
|
|
25088
25220
|
? allCompletedMatchUps
|
|
25089
25221
|
: completedMatchUps, // completed matchUps for the filter date
|
|
25090
25222
|
dateMatchUps: dateMatchUps, // all incomplete matchUps for the filter date
|
|
25223
|
+
courtsData: courtsData,
|
|
25091
25224
|
groupInfo: groupInfo,
|
|
25092
25225
|
venues: venues,
|
|
25093
25226
|
};
|
|
25094
25227
|
if (withCourtGridRows) {
|
|
25095
|
-
var
|
|
25228
|
+
var _p = courtGridRows({
|
|
25096
25229
|
minRowsCount: minCourtGridRows,
|
|
25097
25230
|
courtsData: courtsData,
|
|
25098
|
-
}), rows =
|
|
25231
|
+
}), rows = _p.rows, courtPrefix = _p.courtPrefix;
|
|
25099
25232
|
result.courtPrefix = courtPrefix; // pass through for access to internal defaults by consumer
|
|
25100
25233
|
result.rows = rows;
|
|
25101
25234
|
}
|
|
@@ -25121,41 +25254,39 @@ function competitionScheduleMatchUps(params) {
|
|
|
25121
25254
|
: courtMatchUps;
|
|
25122
25255
|
}
|
|
25123
25256
|
}
|
|
25124
|
-
function
|
|
25257
|
+
function getCompetitionPublishedDrawDetails(_a) {
|
|
25125
25258
|
var e_1, _b, e_2, _c;
|
|
25126
|
-
var _d, _e
|
|
25259
|
+
var _d, _e;
|
|
25127
25260
|
var tournamentRecords = _a.tournamentRecords;
|
|
25128
25261
|
var drawIds = [];
|
|
25262
|
+
var detailsMap = {};
|
|
25129
25263
|
try {
|
|
25130
|
-
for (var
|
|
25131
|
-
var tournamentRecord =
|
|
25264
|
+
for (var _f = __values(Object.values(tournamentRecords)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
25265
|
+
var tournamentRecord = _g.value;
|
|
25266
|
+
var _loop_1 = function (event_1) {
|
|
25267
|
+
var eventPubStatus = getEventPublishStatus({ event: event_1 });
|
|
25268
|
+
var drawDetails = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.drawDetails;
|
|
25269
|
+
if (isObject(drawDetails)) {
|
|
25270
|
+
Object.assign(detailsMap, drawDetails);
|
|
25271
|
+
drawIds.push.apply(drawIds, __spreadArray([], __read(Object.keys(drawDetails).filter(function (drawId) {
|
|
25272
|
+
return getDrawPublishStatus({ drawId: drawId, drawDetails: drawDetails });
|
|
25273
|
+
})), false));
|
|
25274
|
+
}
|
|
25275
|
+
else if ((_e = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.drawIds) === null || _e === void 0 ? void 0 : _e.length) {
|
|
25276
|
+
// LEGACY - deprecate
|
|
25277
|
+
drawIds.push.apply(drawIds, __spreadArray([], __read(eventPubStatus.drawIds), false));
|
|
25278
|
+
}
|
|
25279
|
+
};
|
|
25132
25280
|
try {
|
|
25133
|
-
for (var
|
|
25134
|
-
var event_1 =
|
|
25135
|
-
|
|
25136
|
-
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
25137
|
-
event: event_1,
|
|
25138
|
-
}).timeItem;
|
|
25139
|
-
var pubState = (_e = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _e === void 0 ? void 0 : _e[PUBLIC];
|
|
25140
|
-
if ((_f = pubState === null || pubState === void 0 ? void 0 : pubState.drawIds) === null || _f === void 0 ? void 0 : _f.length) {
|
|
25141
|
-
drawIds.push.apply(drawIds, __spreadArray([], __read(pubState.drawIds), false));
|
|
25142
|
-
}
|
|
25143
|
-
else {
|
|
25144
|
-
// if there are no drawIds specified then all draws are published
|
|
25145
|
-
var eventDrawIds = ((_g = event_1.drawDefinitions) !== null && _g !== void 0 ? _g : [])
|
|
25146
|
-
.map(function (_a) {
|
|
25147
|
-
var drawId = _a.drawId;
|
|
25148
|
-
return drawId;
|
|
25149
|
-
})
|
|
25150
|
-
.filter(Boolean);
|
|
25151
|
-
drawIds.push.apply(drawIds, __spreadArray([], __read(eventDrawIds), false));
|
|
25152
|
-
}
|
|
25281
|
+
for (var _h = (e_2 = void 0, __values((_d = tournamentRecord.events) !== null && _d !== void 0 ? _d : [])), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
25282
|
+
var event_1 = _j.value;
|
|
25283
|
+
_loop_1(event_1);
|
|
25153
25284
|
}
|
|
25154
25285
|
}
|
|
25155
25286
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
25156
25287
|
finally {
|
|
25157
25288
|
try {
|
|
25158
|
-
if (
|
|
25289
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
25159
25290
|
}
|
|
25160
25291
|
finally { if (e_2) throw e_2.error; }
|
|
25161
25292
|
}
|
|
@@ -25164,11 +25295,11 @@ function getCompetitionPublishedDrawIds(_a) {
|
|
|
25164
25295
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
25165
25296
|
finally {
|
|
25166
25297
|
try {
|
|
25167
|
-
if (
|
|
25298
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
25168
25299
|
}
|
|
25169
25300
|
finally { if (e_1) throw e_1.error; }
|
|
25170
25301
|
}
|
|
25171
|
-
return { drawIds: drawIds };
|
|
25302
|
+
return { drawIds: drawIds, detailsMap: detailsMap };
|
|
25172
25303
|
}
|
|
25173
25304
|
|
|
25174
25305
|
var stageOrder = drawDefinitionConstants.stageOrder;
|
|
@@ -25513,23 +25644,24 @@ function getEventEntries(_a) {
|
|
|
25513
25644
|
}
|
|
25514
25645
|
|
|
25515
25646
|
function getEventPublishStatuses(_a) {
|
|
25516
|
-
var _b;
|
|
25517
25647
|
var event = _a.event;
|
|
25518
|
-
var
|
|
25519
|
-
|
|
25520
|
-
element: event,
|
|
25521
|
-
itemType: itemType,
|
|
25522
|
-
}).timeItem;
|
|
25523
|
-
if ((_b = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _b === void 0 ? void 0 : _b.PUBLIC) {
|
|
25524
|
-
var _c = timeItem.itemValue.PUBLIC || {}, _d = _c.drawIds, publishedDrawIds = _d === void 0 ? [] : _d, seeding = _c.seeding;
|
|
25648
|
+
var eventPubStatus = getEventPublishStatus({ event: event });
|
|
25649
|
+
if (eventPubStatus) {
|
|
25525
25650
|
var publishedSeeding = {
|
|
25526
25651
|
published: undefined, // seeding can be present for all entries in an event when no flights have been defined
|
|
25527
25652
|
seedingScaleNames: [],
|
|
25528
25653
|
drawIds: [], // seeding can be specific to drawIds
|
|
25529
25654
|
};
|
|
25530
|
-
if (seeding) {
|
|
25531
|
-
Object.assign(publishedSeeding,
|
|
25655
|
+
if (eventPubStatus.seeding) {
|
|
25656
|
+
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
25532
25657
|
}
|
|
25658
|
+
var drawDetails_1 = eventPubStatus.drawDetails, drawIds = eventPubStatus.drawIds;
|
|
25659
|
+
var publishedDrawIds = (drawDetails_1 &&
|
|
25660
|
+
Object.keys(drawDetails_1).filter(function (drawId) {
|
|
25661
|
+
return getDrawPublishStatus({ drawDetails: drawDetails_1, drawId: drawId });
|
|
25662
|
+
})) ||
|
|
25663
|
+
drawIds ||
|
|
25664
|
+
[];
|
|
25533
25665
|
return {
|
|
25534
25666
|
publishedDrawIds: publishedDrawIds,
|
|
25535
25667
|
publishedSeeding: publishedSeeding,
|
|
@@ -25968,7 +26100,7 @@ function processSides(params) {
|
|
|
25968
26100
|
|
|
25969
26101
|
function getParticipantEntries(params) {
|
|
25970
26102
|
var e_1, _a, e_2, _b;
|
|
25971
|
-
var _c, _d, _e, _f, _g, _h;
|
|
26103
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
25972
26104
|
var participantFilters = params.participantFilters, convertExtensions = params.convertExtensions, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, contextProfile = params.contextProfile, participantMap = params.participantMap, withPotentialMatchUps = params.withPotentialMatchUps, withRankingProfile = params.withRankingProfile, withScheduleItems = params.withScheduleItems, scheduleAnalysis = params.scheduleAnalysis, withTeamMatchUps = params.withTeamMatchUps, withStatistics = params.withStatistics, withOpponents = params.withOpponents, withMatchUps = params.withMatchUps, withSeeding = params.withSeeding, withEvents = params.withEvents, withDraws = params.withDraws;
|
|
25973
26105
|
var targetParticipantIds = participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.participantIds;
|
|
25974
26106
|
var getRelevantParticipantIds = function (participantId) {
|
|
@@ -26007,11 +26139,11 @@ function getParticipantEntries(params) {
|
|
|
26007
26139
|
return (_e = (_d = (_c = (_b = participantMap[participantId].participant) === null || _b === void 0 ? void 0 : _b.rankings) === null || _c === void 0 ? void 0 : _c[eventType]) === null || _d === void 0 ? void 0 : _d.find(function (ranking) { return scaleNames.includes(ranking.scaleName); })) === null || _e === void 0 ? void 0 : _e.scaleValue;
|
|
26008
26140
|
};
|
|
26009
26141
|
var _loop_1 = function (event_1) {
|
|
26010
|
-
var e_3,
|
|
26142
|
+
var e_3, _o, e_4, _p, e_5, _q;
|
|
26011
26143
|
if ((participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.eventIds) &&
|
|
26012
26144
|
!participantFilters.eventIds.includes(event_1.eventId))
|
|
26013
26145
|
return "continue";
|
|
26014
|
-
var
|
|
26146
|
+
var _r = event_1.drawDefinitions, drawDefinitions = _r === void 0 ? [] : _r, _s = event_1.extensions, extensions = _s === void 0 ? [] : _s, eventType = event_1.eventType, eventName = event_1.eventName, category = event_1.category, entries = event_1.entries, eventId = event_1.eventId, gender = event_1.gender;
|
|
26015
26147
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
26016
26148
|
var flights = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) !== null && _c !== void 0 ? _c : [];
|
|
26017
26149
|
var publishStatuses = getEventPublishStatuses({ event: event_1 });
|
|
@@ -26027,7 +26159,7 @@ function getParticipantEntries(params) {
|
|
|
26027
26159
|
category === null || category === void 0 ? void 0 : category.ageCategoryCode,
|
|
26028
26160
|
].filter(Boolean);
|
|
26029
26161
|
var _loop_3 = function (entry) {
|
|
26030
|
-
var
|
|
26162
|
+
var _t;
|
|
26031
26163
|
var participantId = entry.participantId;
|
|
26032
26164
|
if (!participantId || !participantMap[participantId])
|
|
26033
26165
|
return "continue"; // handle bad data
|
|
@@ -26036,13 +26168,13 @@ function getParticipantEntries(params) {
|
|
|
26036
26168
|
var seedAssignments, seedValue;
|
|
26037
26169
|
if (withSeeding) {
|
|
26038
26170
|
var participant = participantMap[participantId].participant;
|
|
26039
|
-
(
|
|
26171
|
+
(_t = getEventSeedAssignments({
|
|
26040
26172
|
publishedSeeding: publishedSeeding,
|
|
26041
26173
|
usePublishState: usePublishState,
|
|
26042
26174
|
withSeeding: withSeeding,
|
|
26043
26175
|
participant: participant,
|
|
26044
26176
|
event: event_1,
|
|
26045
|
-
}), seedAssignments =
|
|
26177
|
+
}), seedAssignments = _t.seedAssignments, seedValue = _t.seedValue);
|
|
26046
26178
|
}
|
|
26047
26179
|
// IMPORTANT NOTE!
|
|
26048
26180
|
// id is the pair, team or individual participant currently being processed
|
|
@@ -26078,7 +26210,7 @@ function getParticipantEntries(params) {
|
|
|
26078
26210
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
26079
26211
|
finally {
|
|
26080
26212
|
try {
|
|
26081
|
-
if (entries_1_1 && !entries_1_1.done && (
|
|
26213
|
+
if (entries_1_1 && !entries_1_1.done && (_o = entries_1.return)) _o.call(entries_1);
|
|
26082
26214
|
}
|
|
26083
26215
|
finally { if (e_3) throw e_3.error; }
|
|
26084
26216
|
}
|
|
@@ -26097,11 +26229,11 @@ function getParticipantEntries(params) {
|
|
|
26097
26229
|
};
|
|
26098
26230
|
var drawIds = unique(__spreadArray(__spreadArray([], __read(drawDefinitions.map(extractAttributes('drawId'))), false), __read(flights.map(extractAttributes('drawId'))), false));
|
|
26099
26231
|
var _loop_4 = function (drawId) {
|
|
26100
|
-
var e_6,
|
|
26232
|
+
var e_6, _u;
|
|
26101
26233
|
var drawDefinition = drawDefinitions.find(function (drawDefinition) { return drawDefinition.drawId === drawId; });
|
|
26102
26234
|
var flight = flights === null || flights === void 0 ? void 0 : flights.find(function (flight) { return flight.drawId === drawId; });
|
|
26103
26235
|
var entries_2 = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) || (flight === null || flight === void 0 ? void 0 : flight.drawEntries);
|
|
26104
|
-
var
|
|
26236
|
+
var _v = drawDefinition !== null && drawDefinition !== void 0 ? drawDefinition : {}, _w = _v.structures, structures = _w === void 0 ? [] : _w, drawOrder = _v.drawOrder, drawName = _v.drawName, drawType = _v.drawType;
|
|
26105
26237
|
var flightNumber = flight === null || flight === void 0 ? void 0 : flight.flightNumber;
|
|
26106
26238
|
var scaleNames = [
|
|
26107
26239
|
category === null || category === void 0 ? void 0 : category.categoryName,
|
|
@@ -26261,10 +26393,16 @@ function getParticipantEntries(params) {
|
|
|
26261
26393
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
26262
26394
|
finally {
|
|
26263
26395
|
try {
|
|
26264
|
-
if (relevantEntries_1_1 && !relevantEntries_1_1.done && (
|
|
26396
|
+
if (relevantEntries_1_1 && !relevantEntries_1_1.done && (_u = relevantEntries_1.return)) _u.call(relevantEntries_1);
|
|
26265
26397
|
}
|
|
26266
26398
|
finally { if (e_6) throw e_6.error; }
|
|
26267
26399
|
}
|
|
26400
|
+
var stages = ((_g = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _g !== void 0 ? _g : []).reduce(function (stages, structure) {
|
|
26401
|
+
if (!stages.includes(structure.stage))
|
|
26402
|
+
stages.push(structure.stage);
|
|
26403
|
+
return stages;
|
|
26404
|
+
}, []);
|
|
26405
|
+
var linksCount = ((_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.links) !== null && _h !== void 0 ? _h : []).length;
|
|
26268
26406
|
derivedDrawInfo[drawId] = {
|
|
26269
26407
|
qualifyingPositionAssignments: qualifyingPositionAssignments,
|
|
26270
26408
|
qualifyingSeedAssignments: qualifyingSeedAssignments,
|
|
@@ -26274,11 +26412,13 @@ function getParticipantEntries(params) {
|
|
|
26274
26412
|
orderedStructureIds: orderedStructureIds,
|
|
26275
26413
|
mainSeedingMap: mainSeedingMap,
|
|
26276
26414
|
flightNumber: flightNumber,
|
|
26415
|
+
linksCount: linksCount,
|
|
26277
26416
|
drawOrder: drawOrder,
|
|
26278
26417
|
drawName: drawName,
|
|
26279
26418
|
drawType: drawType,
|
|
26280
26419
|
drawSize: drawSize,
|
|
26281
26420
|
drawId: drawId,
|
|
26421
|
+
stages: stages,
|
|
26282
26422
|
// qualifyingDrawSize,
|
|
26283
26423
|
};
|
|
26284
26424
|
};
|
|
@@ -26291,7 +26431,7 @@ function getParticipantEntries(params) {
|
|
|
26291
26431
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
26292
26432
|
finally {
|
|
26293
26433
|
try {
|
|
26294
|
-
if (drawIds_1_1 && !drawIds_1_1.done && (
|
|
26434
|
+
if (drawIds_1_1 && !drawIds_1_1.done && (_p = drawIds_1.return)) _p.call(drawIds_1);
|
|
26295
26435
|
}
|
|
26296
26436
|
finally { if (e_4) throw e_4.error; }
|
|
26297
26437
|
}
|
|
@@ -26304,7 +26444,7 @@ function getParticipantEntries(params) {
|
|
|
26304
26444
|
withMatchUps ||
|
|
26305
26445
|
withDraws) {
|
|
26306
26446
|
var nextMatchUps = !!scheduleAnalysis || withPotentialMatchUps;
|
|
26307
|
-
var eventMatchUps = (
|
|
26447
|
+
var eventMatchUps = (_k = (_j = allEventMatchUps({
|
|
26308
26448
|
afterRecoveryTimes: !!scheduleAnalysis,
|
|
26309
26449
|
policyDefinitions: policyDefinitions,
|
|
26310
26450
|
tournamentRecord: tournamentRecord,
|
|
@@ -26313,10 +26453,10 @@ function getParticipantEntries(params) {
|
|
|
26313
26453
|
participantMap: participantMap,
|
|
26314
26454
|
nextMatchUps: nextMatchUps,
|
|
26315
26455
|
event: event_1,
|
|
26316
|
-
})) === null ||
|
|
26456
|
+
})) === null || _j === void 0 ? void 0 : _j.matchUps) !== null && _k !== void 0 ? _k : [];
|
|
26317
26457
|
var _loop_5 = function (matchUp) {
|
|
26318
|
-
var e_7,
|
|
26319
|
-
var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants,
|
|
26458
|
+
var e_7, _x;
|
|
26459
|
+
var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants, _y = matchUp.tieMatchUps, tieMatchUps = _y === void 0 ? [] : _y, _z = matchUp.sides, sides = _z === void 0 ? [] : _z, winningSide = matchUp.winningSide, matchUpType = matchUp.matchUpType, matchUpId = matchUp.matchUpId, eventId_1 = matchUp.eventId, drawId = matchUp.drawId, collectionId = matchUp.collectionId, stageSequence = matchUp.stageSequence, finishingRound = matchUp.finishingRound, matchUpStatus = matchUp.matchUpStatus, roundPosition = matchUp.roundPosition, roundNumber = matchUp.roundNumber, structureId = matchUp.structureId, schedule = matchUp.schedule, score = matchUp.score, stage = matchUp.stage;
|
|
26320
26460
|
mappedMatchUps[matchUpId] = matchUp;
|
|
26321
26461
|
var baseAttrs = {
|
|
26322
26462
|
finishingPositionRange: finishingPositionRange,
|
|
@@ -26336,14 +26476,14 @@ function getParticipantEntries(params) {
|
|
|
26336
26476
|
try {
|
|
26337
26477
|
for (var tieMatchUps_1 = (e_7 = void 0, __values(tieMatchUps)), tieMatchUps_1_1 = tieMatchUps_1.next(); !tieMatchUps_1_1.done; tieMatchUps_1_1 = tieMatchUps_1.next()) {
|
|
26338
26478
|
var tieMatchUp = tieMatchUps_1_1.value;
|
|
26339
|
-
var tieMatchUpWinningSide = tieMatchUp.winningSide,
|
|
26479
|
+
var tieMatchUpWinningSide = tieMatchUp.winningSide, _0 = tieMatchUp.sides, tieMatchUpSides = _0 === void 0 ? [] : _0, tieMatchUpId = tieMatchUp.matchUpId, matchUpStatus_1 = tieMatchUp.matchUpStatus, matchUpType_1 = tieMatchUp.matchUpType;
|
|
26340
26480
|
processSides(__assign(__assign(__assign({}, baseAttrs), withOpts), { winningSide: tieMatchUpWinningSide, tieWinningSide: winningSide, matchUpTieId: matchUpId, matchUpId: tieMatchUpId, sides: tieMatchUpSides, matchUpSides: sides, matchUpStatus: matchUpStatus_1, matchUpType: matchUpType_1 }));
|
|
26341
26481
|
}
|
|
26342
26482
|
}
|
|
26343
26483
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
26344
26484
|
finally {
|
|
26345
26485
|
try {
|
|
26346
|
-
if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (
|
|
26486
|
+
if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (_x = tieMatchUps_1.return)) _x.call(tieMatchUps_1);
|
|
26347
26487
|
}
|
|
26348
26488
|
finally { if (e_7) throw e_7.error; }
|
|
26349
26489
|
}
|
|
@@ -26394,7 +26534,7 @@ function getParticipantEntries(params) {
|
|
|
26394
26534
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
26395
26535
|
finally {
|
|
26396
26536
|
try {
|
|
26397
|
-
if (eventMatchUps_1_1 && !eventMatchUps_1_1.done && (
|
|
26537
|
+
if (eventMatchUps_1_1 && !eventMatchUps_1_1.done && (_q = eventMatchUps_1.return)) _q.call(eventMatchUps_1);
|
|
26398
26538
|
}
|
|
26399
26539
|
finally { if (e_5) throw e_5.error; }
|
|
26400
26540
|
}
|
|
@@ -26402,23 +26542,23 @@ function getParticipantEntries(params) {
|
|
|
26402
26542
|
}
|
|
26403
26543
|
};
|
|
26404
26544
|
try {
|
|
26405
|
-
for (var
|
|
26406
|
-
var event_1 =
|
|
26545
|
+
for (var _l = __values((tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) || []), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
26546
|
+
var event_1 = _m.value;
|
|
26407
26547
|
_loop_1(event_1);
|
|
26408
26548
|
}
|
|
26409
26549
|
}
|
|
26410
26550
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
26411
26551
|
finally {
|
|
26412
26552
|
try {
|
|
26413
|
-
if (
|
|
26553
|
+
if (_m && !_m.done && (_a = _l.return)) _a.call(_l);
|
|
26414
26554
|
}
|
|
26415
26555
|
finally { if (e_1) throw e_1.error; }
|
|
26416
26556
|
}
|
|
26417
26557
|
if (withStatistics || withRankingProfile || !!scheduleAnalysis) {
|
|
26418
26558
|
var aggregators = Object.values(participantMap);
|
|
26419
26559
|
var _loop_2 = function (participantAggregator) {
|
|
26420
|
-
var e_8,
|
|
26421
|
-
var
|
|
26560
|
+
var e_8, _1, e_9, _2, e_10, _3;
|
|
26561
|
+
var _4 = participantAggregator.counters, wins = _4.wins, losses = _4.losses, _5 = SINGLES$1, _6 = _4[_5], singlesWins = _6.wins, singlesLosses = _6.losses, _7 = DOUBLES$1, _8 = _4[_7], doublesWins = _8.wins, doublesLosses = _8.losses;
|
|
26422
26562
|
var addStatValue = function (statCode, wins, losses) {
|
|
26423
26563
|
var denominator = wins + losses;
|
|
26424
26564
|
var numerator = wins;
|
|
@@ -26441,7 +26581,7 @@ function getParticipantEntries(params) {
|
|
|
26441
26581
|
return Math.abs(range[0] - range[1]);
|
|
26442
26582
|
};
|
|
26443
26583
|
var _loop_7 = function (drawId) {
|
|
26444
|
-
var
|
|
26584
|
+
var _11 = derivedDrawInfo[drawId] || {}, _12 = _11.orderedStructureIds, orderedStructureIds = _12 === void 0 ? [] : _12, flightNumber = _11.flightNumber;
|
|
26445
26585
|
if (participantAggregator.structureParticipation &&
|
|
26446
26586
|
orderedStructureIds.length) {
|
|
26447
26587
|
var finishingPositionRange_1;
|
|
@@ -26477,15 +26617,15 @@ function getParticipantEntries(params) {
|
|
|
26477
26617
|
}
|
|
26478
26618
|
};
|
|
26479
26619
|
try {
|
|
26480
|
-
for (var
|
|
26481
|
-
var drawId =
|
|
26620
|
+
for (var _9 = (e_8 = void 0, __values(Object.keys(participantAggregator.draws))), _10 = _9.next(); !_10.done; _10 = _9.next()) {
|
|
26621
|
+
var drawId = _10.value;
|
|
26482
26622
|
_loop_7(drawId);
|
|
26483
26623
|
}
|
|
26484
26624
|
}
|
|
26485
26625
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
26486
26626
|
finally {
|
|
26487
26627
|
try {
|
|
26488
|
-
if (
|
|
26628
|
+
if (_10 && !_10.done && (_1 = _9.return)) _1.call(_9);
|
|
26489
26629
|
}
|
|
26490
26630
|
finally { if (e_8) throw e_8.error; }
|
|
26491
26631
|
}
|
|
@@ -26544,7 +26684,7 @@ function getParticipantEntries(params) {
|
|
|
26544
26684
|
// if there is a time overlap capture both the prior matchUpId and the conflicted matchUpId
|
|
26545
26685
|
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
26546
26686
|
var key = [scheduleItem.matchUpId, consideredItem.matchUpId]
|
|
26547
|
-
.sort()
|
|
26687
|
+
.sort(stringSort)
|
|
26548
26688
|
.join('|');
|
|
26549
26689
|
participantAggregator.scheduleConflicts[key] = {
|
|
26550
26690
|
priorScheduledMatchUpId: scheduleItem.matchUpId,
|
|
@@ -26556,7 +26696,7 @@ function getParticipantEntries(params) {
|
|
|
26556
26696
|
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
26557
26697
|
finally {
|
|
26558
26698
|
try {
|
|
26559
|
-
if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (
|
|
26699
|
+
if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (_3 = scheduleItemsToConsider_1.return)) _3.call(scheduleItemsToConsider_1);
|
|
26560
26700
|
}
|
|
26561
26701
|
finally { if (e_10) throw e_10.error; }
|
|
26562
26702
|
}
|
|
@@ -26565,7 +26705,7 @@ function getParticipantEntries(params) {
|
|
|
26565
26705
|
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
26566
26706
|
finally {
|
|
26567
26707
|
try {
|
|
26568
|
-
if (scheduleItems_1_1 && !scheduleItems_1_1.done && (
|
|
26708
|
+
if (scheduleItems_1_1 && !scheduleItems_1_1.done && (_2 = scheduleItems_1.return)) _2.call(scheduleItems_1);
|
|
26569
26709
|
}
|
|
26570
26710
|
finally { if (e_9) throw e_9.error; }
|
|
26571
26711
|
}
|
|
@@ -28704,7 +28844,7 @@ function getStructureGroups(_a) {
|
|
|
28704
28844
|
}
|
|
28705
28845
|
|
|
28706
28846
|
function getDrawData(params) {
|
|
28707
|
-
var _a = params.tournamentParticipants, tournamentParticipants = _a === void 0 ? [] : _a, includePositionAssignments = params.includePositionAssignments, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, _b = params.inContext, inContext = _b === void 0 ? true : _b, drawDefinition = params.drawDefinition, noDeepCopy = params.noDeepCopy, sortConfig = params.sortConfig, context = params.context, event = params.event;
|
|
28847
|
+
var _a = params.tournamentParticipants, tournamentParticipants = _a === void 0 ? [] : _a, includePositionAssignments = params.includePositionAssignments, policyDefinitions = params.policyDefinitions, tournamentRecord = params.tournamentRecord, _b = params.inContext, inContext = _b === void 0 ? true : _b, usePublishState = params.usePublishState, drawDefinition = params.drawDefinition, publishStatus = params.publishStatus, noDeepCopy = params.noDeepCopy, sortConfig = params.sortConfig, context = params.context, event = params.event;
|
|
28708
28848
|
if (!drawDefinition)
|
|
28709
28849
|
return { error: MISSING_DRAW_DEFINITION };
|
|
28710
28850
|
var drawInfo = (function (_a) {
|
|
@@ -28772,6 +28912,8 @@ function getDrawData(params) {
|
|
|
28772
28912
|
tournamentParticipants: tournamentParticipants,
|
|
28773
28913
|
policyDefinitions: policyDefinitions,
|
|
28774
28914
|
tournamentRecord: tournamentRecord,
|
|
28915
|
+
usePublishState: usePublishState,
|
|
28916
|
+
publishStatus: publishStatus,
|
|
28775
28917
|
drawDefinition: drawDefinition,
|
|
28776
28918
|
inContext: inContext,
|
|
28777
28919
|
structure: structure,
|
|
@@ -28855,8 +28997,7 @@ function getDrawData(params) {
|
|
|
28855
28997
|
}
|
|
28856
28998
|
|
|
28857
28999
|
function getEventData(params) {
|
|
28858
|
-
var _a;
|
|
28859
|
-
var includePositionAssignments = params.includePositionAssignments, t = params.tournamentRecord, participantsProfile = params.participantsProfile, policyDefinitions = params.policyDefinitions, usePublishState = params.usePublishState, _b = params.status, status = _b === void 0 ? PUBLIC : _b, sortConfig = params.sortConfig, e = params.event;
|
|
29000
|
+
var includePositionAssignments = params.includePositionAssignments, t = params.tournamentRecord, participantsProfile = params.participantsProfile, policyDefinitions = params.policyDefinitions, usePublishState = params.usePublishState, _a = params.status, status = _a === void 0 ? PUBLIC : _a, sortConfig = params.sortConfig, e = params.event;
|
|
28860
29001
|
var tournamentRecord = makeDeepCopy(t, false, true);
|
|
28861
29002
|
var event = makeDeepCopy(e, false, true);
|
|
28862
29003
|
if (!tournamentRecord)
|
|
@@ -28865,33 +29006,73 @@ function getEventData(params) {
|
|
|
28865
29006
|
return { error: MISSING_EVENT };
|
|
28866
29007
|
var eventId = event.eventId;
|
|
28867
29008
|
var tournamentId = tournamentRecord.tournamentId, endDate = tournamentRecord.endDate;
|
|
28868
|
-
var
|
|
28869
|
-
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
28870
|
-
event: event,
|
|
28871
|
-
}).timeItem;
|
|
28872
|
-
var publishStatus = (_a = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _a === void 0 ? void 0 : _a[status];
|
|
29009
|
+
var publishStatus = getEventPublishStatus({ event: event, status: status });
|
|
28873
29010
|
var tournamentParticipants = getParticipants$1(__assign(__assign({ withGroupings: true, withEvents: false, withDraws: false }, participantsProfile), { // order is important!!
|
|
28874
29011
|
tournamentRecord: tournamentRecord })).participants;
|
|
28875
29012
|
var stageFilter = function (_a) {
|
|
28876
|
-
var _b;
|
|
28877
|
-
var stage = _a.stage;
|
|
28878
|
-
|
|
28879
|
-
|
|
28880
|
-
|
|
29013
|
+
var _b, _c, _d;
|
|
29014
|
+
var stage = _a.stage, drawId = _a.drawId;
|
|
29015
|
+
if (!usePublishState)
|
|
29016
|
+
return true;
|
|
29017
|
+
var stageDetails = (_c = (_b = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.drawDetails) === null || _b === void 0 ? void 0 : _b[drawId]) === null || _c === void 0 ? void 0 : _c.stageDetails;
|
|
29018
|
+
if (!stageDetails || !Object.keys(stageDetails).length)
|
|
29019
|
+
return true;
|
|
29020
|
+
return (_d = stageDetails[stage]) === null || _d === void 0 ? void 0 : _d.published;
|
|
28881
29021
|
};
|
|
28882
29022
|
var structureFilter = function (_a) {
|
|
28883
|
-
var _b;
|
|
28884
|
-
var structureId = _a.structureId;
|
|
28885
|
-
|
|
28886
|
-
|
|
28887
|
-
|
|
29023
|
+
var _b, _c, _d;
|
|
29024
|
+
var structureId = _a.structureId, drawId = _a.drawId;
|
|
29025
|
+
if (!usePublishState)
|
|
29026
|
+
return true;
|
|
29027
|
+
var structureDetails = (_c = (_b = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.drawDetails) === null || _b === void 0 ? void 0 : _b[drawId]) === null || _c === void 0 ? void 0 : _c.structureDetails;
|
|
29028
|
+
if (!structureDetails || !Object.keys(structureDetails).length)
|
|
29029
|
+
return true;
|
|
29030
|
+
return (_d = structureDetails[structureId]) === null || _d === void 0 ? void 0 : _d.published;
|
|
28888
29031
|
};
|
|
28889
29032
|
var drawFilter = function (_a) {
|
|
28890
|
-
var _b;
|
|
29033
|
+
var _b, _c;
|
|
28891
29034
|
var drawId = _a.drawId;
|
|
28892
|
-
|
|
28893
|
-
|
|
28894
|
-
|
|
29035
|
+
if (!usePublishState)
|
|
29036
|
+
return true;
|
|
29037
|
+
if (publishStatus.drawDetails) {
|
|
29038
|
+
return (_c = (_b = publishStatus.drawDetails[drawId]) === null || _b === void 0 ? void 0 : _b.publishingDetail) === null || _c === void 0 ? void 0 : _c.published;
|
|
29039
|
+
}
|
|
29040
|
+
else if (publishStatus.drawIds) {
|
|
29041
|
+
return publishStatus.drawIds.includes(drawId);
|
|
29042
|
+
}
|
|
29043
|
+
return true;
|
|
29044
|
+
};
|
|
29045
|
+
var roundLimitMapper = function (_a) {
|
|
29046
|
+
var e_1, _b;
|
|
29047
|
+
var _c, _d, _e, _f;
|
|
29048
|
+
var drawId = _a.drawId, structure = _a.structure;
|
|
29049
|
+
if (!usePublishState)
|
|
29050
|
+
return structure;
|
|
29051
|
+
var roundLimit = (_f = (_e = (_d = (_c = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.drawDetails) === null || _c === void 0 ? void 0 : _c[drawId]) === null || _d === void 0 ? void 0 : _d.structureDetails) === null || _e === void 0 ? void 0 : _e[structure.structureId]) === null || _f === void 0 ? void 0 : _f.roundLimit;
|
|
29052
|
+
if (isConvertableInteger(roundLimit)) {
|
|
29053
|
+
var roundNumbers = generateRange(1, roundLimit + 1);
|
|
29054
|
+
var roundMatchUps = {};
|
|
29055
|
+
var roundProfile = {};
|
|
29056
|
+
try {
|
|
29057
|
+
for (var roundNumbers_1 = __values(roundNumbers), roundNumbers_1_1 = roundNumbers_1.next(); !roundNumbers_1_1.done; roundNumbers_1_1 = roundNumbers_1.next()) {
|
|
29058
|
+
var roundNumber = roundNumbers_1_1.value;
|
|
29059
|
+
if (structure.roundMatchUps[roundNumber]) {
|
|
29060
|
+
roundMatchUps[roundNumber] = structure.roundMatchUps[roundNumber];
|
|
29061
|
+
roundProfile[roundNumber] = structure.roundProfile[roundNumber];
|
|
29062
|
+
}
|
|
29063
|
+
}
|
|
29064
|
+
}
|
|
29065
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
29066
|
+
finally {
|
|
29067
|
+
try {
|
|
29068
|
+
if (roundNumbers_1_1 && !roundNumbers_1_1.done && (_b = roundNumbers_1.return)) _b.call(roundNumbers_1);
|
|
29069
|
+
}
|
|
29070
|
+
finally { if (e_1) throw e_1.error; }
|
|
29071
|
+
}
|
|
29072
|
+
structure.roundMatchUps = roundMatchUps;
|
|
29073
|
+
structure.roundProfile = roundProfile;
|
|
29074
|
+
}
|
|
29075
|
+
return structure;
|
|
28895
29076
|
};
|
|
28896
29077
|
var drawDefinitions = event.drawDefinitions || [];
|
|
28897
29078
|
var drawsData = drawDefinitions
|
|
@@ -28907,15 +29088,23 @@ function getEventData(params) {
|
|
|
28907
29088
|
noDeepCopy: true,
|
|
28908
29089
|
policyDefinitions: policyDefinitions,
|
|
28909
29090
|
tournamentRecord: tournamentRecord,
|
|
29091
|
+
usePublishState: usePublishState,
|
|
28910
29092
|
drawDefinition: drawDefinition,
|
|
29093
|
+
publishStatus: publishStatus,
|
|
28911
29094
|
sortConfig: sortConfig,
|
|
28912
29095
|
event: event,
|
|
28913
29096
|
}));
|
|
28914
29097
|
})
|
|
28915
29098
|
.map(function (_a) {
|
|
28916
|
-
var _b;
|
|
28917
29099
|
var structures = _a.structures, drawData = __rest(_a, ["structures"]);
|
|
28918
|
-
|
|
29100
|
+
var filteredStructures = structures === null || structures === void 0 ? void 0 : structures.filter(function (_a) {
|
|
29101
|
+
var stage = _a.stage, structureId = _a.structureId;
|
|
29102
|
+
return structureFilter({ structureId: structureId, drawId: drawData.drawId }) &&
|
|
29103
|
+
stageFilter({ stage: stage, drawId: drawData.drawId });
|
|
29104
|
+
}).map(function (structure) {
|
|
29105
|
+
return roundLimitMapper({ drawId: drawData.drawId, structure: structure });
|
|
29106
|
+
});
|
|
29107
|
+
return __assign(__assign({}, drawData), { structures: filteredStructures });
|
|
28919
29108
|
})
|
|
28920
29109
|
.filter(function (drawData) { var _a; return (_a = drawData.structures) === null || _a === void 0 ? void 0 : _a.length; });
|
|
28921
29110
|
var tournamentInfo = getTournamentInfo({ tournamentRecord: tournamentRecord }).tournamentInfo;
|
|
@@ -28952,10 +29141,7 @@ function getEventData(params) {
|
|
|
28952
29141
|
eventInfo: eventInfo,
|
|
28953
29142
|
drawsData: drawsData,
|
|
28954
29143
|
};
|
|
28955
|
-
eventData.eventInfo.publish =
|
|
28956
|
-
createdAt: timeItem === null || timeItem === void 0 ? void 0 : timeItem.createdAt,
|
|
28957
|
-
state: timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue,
|
|
28958
|
-
};
|
|
29144
|
+
eventData.eventInfo.publish = publishStatus;
|
|
28959
29145
|
return __assign(__assign({}, SUCCESS), { eventData: eventData });
|
|
28960
29146
|
}
|
|
28961
29147
|
|
|
@@ -34091,6 +34277,13 @@ function setMatchUpStatus$2(params) {
|
|
|
34091
34277
|
score: score_1,
|
|
34092
34278
|
});
|
|
34093
34279
|
}
|
|
34280
|
+
ensureSideLineUps({
|
|
34281
|
+
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
34282
|
+
inContextDualMatchUp: inContextMatchUp,
|
|
34283
|
+
eventId: event === null || event === void 0 ? void 0 : event.eventId,
|
|
34284
|
+
drawDefinition: drawDefinition,
|
|
34285
|
+
dualMatchUp: matchUp,
|
|
34286
|
+
});
|
|
34094
34287
|
}
|
|
34095
34288
|
if (matchUp.matchUpType === TEAM$2 &&
|
|
34096
34289
|
matchUpStatus &&
|
|
@@ -36026,10 +36219,7 @@ function modifyCollectionDefinition$1(_a) {
|
|
|
36026
36219
|
modifications.push({ collectionId: collectionId, gender: gender });
|
|
36027
36220
|
}
|
|
36028
36221
|
var modifiedTieFormat = definedAttributes(tieFormat);
|
|
36029
|
-
result = validateTieFormat({
|
|
36030
|
-
tieFormat: modifiedTieFormat,
|
|
36031
|
-
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36032
|
-
});
|
|
36222
|
+
result = validateTieFormat({ tieFormat: modifiedTieFormat });
|
|
36033
36223
|
if (result.error) {
|
|
36034
36224
|
return decorateResult({ result: result, stack: stack });
|
|
36035
36225
|
}
|
|
@@ -36322,8 +36512,7 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36322
36512
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36323
36513
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
36324
36514
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36325
|
-
|
|
36326
|
-
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36515
|
+
result = validateTieFormat({ tieFormat: tieFormat });
|
|
36327
36516
|
if (result.error)
|
|
36328
36517
|
return decorateResult({ result: result, stack: stack });
|
|
36329
36518
|
var targetCollection = (_e = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) === null || _e === void 0 ? void 0 : _e.find(function (collectionDefinition) { return collectionDefinition.collectionId === collectionId; });
|
|
@@ -36514,7 +36703,7 @@ function removeCollectionDefinition$1(_a) {
|
|
|
36514
36703
|
});
|
|
36515
36704
|
}
|
|
36516
36705
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36517
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
36706
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36518
36707
|
if (result.error)
|
|
36519
36708
|
return decorateResult({ result: result, stack: stack });
|
|
36520
36709
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -36598,8 +36787,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
36598
36787
|
matchUp = matchUp !== null && matchUp !== void 0 ? matchUp : result === null || result === void 0 ? void 0 : result.matchUp;
|
|
36599
36788
|
var existingTieFormat = (_k = matchUp === null || matchUp === void 0 ? void 0 : matchUp.tieFormat) !== null && _k !== void 0 ? _k : result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
36600
36789
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
36601
|
-
|
|
36602
|
-
result = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
36790
|
+
result = validateTieFormat({ tieFormat: tieFormat });
|
|
36603
36791
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36604
36792
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36605
36793
|
}
|
|
@@ -36643,7 +36831,7 @@ function addCollectionDefinition$1(_a) {
|
|
|
36643
36831
|
var addedMatchUps = [];
|
|
36644
36832
|
var targetMatchUps = [];
|
|
36645
36833
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36646
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
36834
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36647
36835
|
if (result === null || result === void 0 ? void 0 : result.error) {
|
|
36648
36836
|
return decorateResult({ result: { error: result.error }, stack: stack });
|
|
36649
36837
|
}
|
|
@@ -36965,10 +37153,7 @@ function collectionGroupUpdate(_a) {
|
|
|
36965
37153
|
event: event,
|
|
36966
37154
|
});
|
|
36967
37155
|
var prunedTieFormat = definedAttributes(tieFormat);
|
|
36968
|
-
var result = validateTieFormat({
|
|
36969
|
-
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
36970
|
-
tieFormat: prunedTieFormat,
|
|
36971
|
-
});
|
|
37156
|
+
var result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
36972
37157
|
if (result.error)
|
|
36973
37158
|
return result;
|
|
36974
37159
|
// TODO: implement use of tieFormats and tieFormatId
|
|
@@ -37017,7 +37202,7 @@ function removeCollectionGroup$1(_a) {
|
|
|
37017
37202
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37018
37203
|
var wasAggregateValue = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.aggregateValue;
|
|
37019
37204
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37020
|
-
result = validateTieFormat({ tieFormat: tieFormat
|
|
37205
|
+
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37021
37206
|
if (result.error)
|
|
37022
37207
|
return decorateResult({ result: result, stack: stack });
|
|
37023
37208
|
var modifiedCollectionIds = [];
|
|
@@ -37098,7 +37283,7 @@ function addCollectionGroup$1(_a) {
|
|
|
37098
37283
|
var existingTieFormat = result === null || result === void 0 ? void 0 : result.tieFormat;
|
|
37099
37284
|
var originalValueGoal = existingTieFormat === null || existingTieFormat === void 0 ? void 0 : existingTieFormat.winCriteria.valueGoal;
|
|
37100
37285
|
var tieFormat = copyTieFormat(existingTieFormat);
|
|
37101
|
-
result = validateTieFormat({ tieFormat: tieFormat
|
|
37286
|
+
result = validateTieFormat({ tieFormat: tieFormat });
|
|
37102
37287
|
if (result.error)
|
|
37103
37288
|
return decorateResult({ result: result, stack: stack });
|
|
37104
37289
|
try {
|
|
@@ -37163,10 +37348,7 @@ function modifyTieFormat$1(_a) {
|
|
|
37163
37348
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
37164
37349
|
var _e = _a.updateInProgressMatchUps, updateInProgressMatchUps = _e === void 0 ? false : _e, tieFormatComparison = _a.tieFormatComparison, modifiedTieFormat = _a.modifiedTieFormat, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, matchUpId = _a.matchUpId, eventId = _a.eventId, uuids = _a.uuids, event = _a.event;
|
|
37165
37350
|
var stack = 'modifyTieFormat';
|
|
37166
|
-
if (!validateTieFormat({
|
|
37167
|
-
tieFormat: modifiedTieFormat,
|
|
37168
|
-
eventType: event === null || event === void 0 ? void 0 : event.eventType,
|
|
37169
|
-
}).valid) {
|
|
37351
|
+
if (!validateTieFormat({ tieFormat: modifiedTieFormat }).valid) {
|
|
37170
37352
|
return decorateResult({
|
|
37171
37353
|
result: { error: INVALID_TIE_FORMAT },
|
|
37172
37354
|
info: 'falied validation',
|
|
@@ -46451,8 +46633,8 @@ function setStageQualifiersCount(_a) {
|
|
|
46451
46633
|
}
|
|
46452
46634
|
|
|
46453
46635
|
function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
46454
|
-
var _a, _b
|
|
46455
|
-
var
|
|
46636
|
+
var _a, _b;
|
|
46637
|
+
var _c = params || {}, _d = _c.modifyOriginal, modifyOriginal = _d === void 0 ? true : _d, _e = _c.stageSequence, stageSequence = _e === void 0 ? 1 : _e, isMock = _c.isMock;
|
|
46456
46638
|
var stack = 'generateDrawTypeAndModifyDrawDefinition';
|
|
46457
46639
|
if (!params.drawDefinition)
|
|
46458
46640
|
return decorateResult({
|
|
@@ -46464,12 +46646,11 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46464
46646
|
: makeDeepCopy(params.drawDefinition, false, true);
|
|
46465
46647
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
46466
46648
|
if (tieFormat) {
|
|
46467
|
-
var
|
|
46468
|
-
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
46649
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat });
|
|
46469
46650
|
if (result_1.error)
|
|
46470
46651
|
return result_1;
|
|
46471
46652
|
}
|
|
46472
|
-
tieFormat = copyTieFormat(tieFormat || ((
|
|
46653
|
+
tieFormat = copyTieFormat(tieFormat || ((_a = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _a === void 0 ? void 0 : _a.tieFormat));
|
|
46473
46654
|
matchUpType = matchUpType || drawDefinition.matchUpType || SINGLES$1;
|
|
46474
46655
|
params.tieFormat = tieFormat;
|
|
46475
46656
|
params.matchUpType = matchUpType;
|
|
@@ -46523,7 +46704,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46523
46704
|
}
|
|
46524
46705
|
var drawSize = params.drawSize || mainStageDrawPositionsCount;
|
|
46525
46706
|
Object.assign(params, definedAttributes({ drawSize: drawSize, matchUpType: matchUpType, tieFormat: tieFormat }));
|
|
46526
|
-
var
|
|
46707
|
+
var _f = getAllDrawMatchUps({ drawDefinition: drawDefinition }), matchUps = _f.matchUps, matchUpsMap = _f.matchUpsMap;
|
|
46527
46708
|
if (tieFormat) {
|
|
46528
46709
|
// if there were exiting matchUps, exclude them from this step
|
|
46529
46710
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (matchUp) {
|
|
@@ -46535,7 +46716,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
46535
46716
|
}
|
|
46536
46717
|
var inContextDrawMatchUps = addGoesTo({ drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }).inContextDrawMatchUps;
|
|
46537
46718
|
modifyDrawNotice({
|
|
46538
|
-
tournamentId: (
|
|
46719
|
+
tournamentId: (_b = params.tournamentRecord) === null || _b === void 0 ? void 0 : _b.tournamentId,
|
|
46539
46720
|
drawDefinition: drawDefinition,
|
|
46540
46721
|
});
|
|
46541
46722
|
return __assign(__assign({ inContextDrawMatchUps: inContextDrawMatchUps, drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }, SUCCESS), { structures: structures, matchUps: matchUps, links: links });
|
|
@@ -48996,8 +49177,8 @@ function addVoluntaryConsolationStage$1(_a) {
|
|
|
48996
49177
|
|
|
48997
49178
|
function generateVoluntaryConsolation$1(params) {
|
|
48998
49179
|
var _a, _b;
|
|
48999
|
-
var _c, _d, _e, _f, _g, _h, _j
|
|
49000
|
-
var
|
|
49180
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
49181
|
+
var _k = params.drawType, drawType = _k === void 0 ? SINGLE_ELIMINATION : _k, _l = params.attachConsolation, attachConsolation = _l === void 0 ? true : _l, _m = params.applyPositioning, applyPositioning = _m === void 0 ? true : _m, tournamentRecord = params.tournamentRecord, staggeredEntry = params.staggeredEntry, // optional - specifies main structure FEED_IN for drawTypes CURTIS_CONSOLATION, FEED_IN_CHAMPIONSHIPS, FMLC
|
|
49001
49182
|
automated = params.automated, placeByes = params.placeByes, isMock = params.isMock, event = params.event;
|
|
49002
49183
|
var drawDefinition = params === null || params === void 0 ? void 0 : params.drawDefinition;
|
|
49003
49184
|
if (!drawDefinition)
|
|
@@ -49028,13 +49209,12 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49028
49209
|
return { error: INVALID_DRAW_SIZE };
|
|
49029
49210
|
var tieFormat = params.tieFormat, matchUpType = params.matchUpType;
|
|
49030
49211
|
if (tieFormat) {
|
|
49031
|
-
var
|
|
49032
|
-
var result_1 = validateTieFormat({ tieFormat: tieFormat, eventType: eventType });
|
|
49212
|
+
var result_1 = validateTieFormat({ tieFormat: tieFormat });
|
|
49033
49213
|
if (result_1.error)
|
|
49034
49214
|
return result_1;
|
|
49035
49215
|
}
|
|
49036
|
-
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (
|
|
49037
|
-
matchUpType = (
|
|
49216
|
+
tieFormat = copyTieFormat(tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_d = resolveTieFormat({ drawDefinition: drawDefinition })) === null || _d === void 0 ? void 0 : _d.tieFormat);
|
|
49217
|
+
matchUpType = (_e = matchUpType !== null && matchUpType !== void 0 ? matchUpType : drawDefinition.matchUpType) !== null && _e !== void 0 ? _e : TypeEnum.Singles;
|
|
49038
49218
|
var stageStructures = getDrawStructures({
|
|
49039
49219
|
stageSequence: 1,
|
|
49040
49220
|
drawDefinition: drawDefinition,
|
|
@@ -49045,11 +49225,11 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
49045
49225
|
if (structureCount > 1)
|
|
49046
49226
|
return { error: STAGE_SEQUENCE_LIMIT };
|
|
49047
49227
|
// invalid to already have matchUps generated for any existing structure
|
|
49048
|
-
if ((
|
|
49228
|
+
if ((_g = (_f = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _f === void 0 ? void 0 : _f.matchUps) === null || _g === void 0 ? void 0 : _g.length)
|
|
49049
49229
|
return { error: EXISTING_STRUCTURE };
|
|
49050
|
-
var structureId = (
|
|
49230
|
+
var structureId = (_h = stageStructures === null || stageStructures === void 0 ? void 0 : stageStructures[0]) === null || _h === void 0 ? void 0 : _h.structureId;
|
|
49051
49231
|
Object.assign(params, definedAttributes({
|
|
49052
|
-
structureName: (
|
|
49232
|
+
structureName: (_j = params.structureName) !== null && _j !== void 0 ? _j : constantToString(VOLUNTARY_CONSOLATION),
|
|
49053
49233
|
structureId: structureId,
|
|
49054
49234
|
matchUpType: matchUpType,
|
|
49055
49235
|
tieFormat: tieFormat,
|
|
@@ -55641,7 +55821,7 @@ function addParticipantContext(params) {
|
|
|
55641
55821
|
params.withDraws) {
|
|
55642
55822
|
// loop through all filtered events and capture events played
|
|
55643
55823
|
(_a = params.tournamentEvents) === null || _a === void 0 ? void 0 : _a.forEach(function (rawEvent) {
|
|
55644
|
-
var _a, _b, _c, _d, _e, _f
|
|
55824
|
+
var _a, _b, _c, _d, _e, _f;
|
|
55645
55825
|
var event = makeDeepCopy(rawEvent, true, true);
|
|
55646
55826
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
55647
55827
|
var eventDrawsCount = ((_a = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _a === void 0 ? void 0 : _a.length) || ((_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.length) || 0;
|
|
@@ -55661,20 +55841,21 @@ function addParticipantContext(params) {
|
|
|
55661
55841
|
var extensionKeys = event && Object.keys(event).filter(function (key) { return key.startsWith('_'); });
|
|
55662
55842
|
extensionKeys === null || extensionKeys === void 0 ? void 0 : extensionKeys.forEach(function (extensionKey) { return (eventInfo[extensionKey] = event[extensionKey]); });
|
|
55663
55843
|
var eventEntries = event.entries || [];
|
|
55664
|
-
var
|
|
55665
|
-
|
|
55666
|
-
|
|
55667
|
-
|
|
55668
|
-
|
|
55669
|
-
|
|
55670
|
-
|
|
55844
|
+
var pubStatus = getEventPublishStatus({ event: event });
|
|
55845
|
+
if (isObject(pubStatus)) {
|
|
55846
|
+
var drawIds = pubStatus.drawIds, drawDetails_1 = pubStatus.drawDetails, seeding = pubStatus.seeding;
|
|
55847
|
+
var publishedDrawIds = drawDetails_1
|
|
55848
|
+
? Object.keys(drawDetails_1).filter(function (drawId) {
|
|
55849
|
+
return getDrawPublishStatus({ drawId: drawId, drawDetails: drawDetails_1 });
|
|
55850
|
+
})
|
|
55851
|
+
: drawIds !== null && drawIds !== void 0 ? drawIds : [];
|
|
55671
55852
|
var publishedSeeding = {
|
|
55672
55853
|
published: undefined, // seeding can be present for all entries in an event when no flights have been defined
|
|
55673
55854
|
seedingScaleNames: [],
|
|
55674
55855
|
drawIds: [], // seeding can be specific to drawIds
|
|
55675
55856
|
};
|
|
55676
55857
|
if (seeding)
|
|
55677
|
-
Object.assign(publishedSeeding,
|
|
55858
|
+
Object.assign(publishedSeeding, pubStatus.seeding);
|
|
55678
55859
|
eventsPublishStatuses[eventId] = {
|
|
55679
55860
|
publishedDrawIds: publishedDrawIds,
|
|
55680
55861
|
publishedSeeding: publishedSeeding,
|
|
@@ -55745,11 +55926,11 @@ function addParticipantContext(params) {
|
|
|
55745
55926
|
});
|
|
55746
55927
|
};
|
|
55747
55928
|
// iterate through flights to ensure that draw entries are captured if drawDefinitions have not yet been generated
|
|
55748
|
-
var drawIdsWithDefinitions = ((
|
|
55929
|
+
var drawIdsWithDefinitions = ((_c = event.drawDefinitions) === null || _c === void 0 ? void 0 : _c.map(function (_a) {
|
|
55749
55930
|
var drawId = _a.drawId;
|
|
55750
55931
|
return drawId;
|
|
55751
55932
|
})) || [];
|
|
55752
|
-
(
|
|
55933
|
+
(_e = (_d = eventInfo._flightProfile) === null || _d === void 0 ? void 0 : _d.flights) === null || _e === void 0 ? void 0 : _e.forEach(function (flight) {
|
|
55753
55934
|
var drawId = flight.drawId, drawEntries = flight.drawEntries;
|
|
55754
55935
|
if (!drawIdsWithDefinitions.includes(drawId)) {
|
|
55755
55936
|
drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.forEach(function (drawEntry) {
|
|
@@ -55757,10 +55938,10 @@ function addParticipantContext(params) {
|
|
|
55757
55938
|
});
|
|
55758
55939
|
}
|
|
55759
55940
|
});
|
|
55760
|
-
var
|
|
55941
|
+
var _g = getDrawDetails({
|
|
55761
55942
|
eventEntries: eventEntries,
|
|
55762
55943
|
event: event,
|
|
55763
|
-
}), drawDetails =
|
|
55944
|
+
}), drawDetails = _g.drawDetails, derivedInfo = _g.derivedInfo;
|
|
55764
55945
|
Object.assign(derivedDrawInfo, derivedInfo);
|
|
55765
55946
|
if (event.eventType === TEAM$2 || // for TEAM events some individual attributes can only be derived by processing
|
|
55766
55947
|
params.withScheduleItems ||
|
|
@@ -55769,14 +55950,14 @@ function addParticipantContext(params) {
|
|
|
55769
55950
|
params.withOpponents ||
|
|
55770
55951
|
params.withMatchUps ||
|
|
55771
55952
|
params.withDraws) {
|
|
55772
|
-
var matchUps = (
|
|
55953
|
+
var matchUps = (_f = allEventMatchUps({
|
|
55773
55954
|
afterRecoveryTimes: params.scheduleAnalysis,
|
|
55774
55955
|
participants: allTournamentParticipants,
|
|
55775
55956
|
nextMatchUps: true,
|
|
55776
55957
|
tournamentRecord: tournamentRecord,
|
|
55777
55958
|
inContext: true,
|
|
55778
55959
|
event: event,
|
|
55779
|
-
})) === null ||
|
|
55960
|
+
})) === null || _f === void 0 ? void 0 : _f.matchUps;
|
|
55780
55961
|
matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (matchUp) {
|
|
55781
55962
|
return processMatchUp({
|
|
55782
55963
|
relevantParticipantIdsMap: relevantParticipantIdsMap,
|
|
@@ -57549,35 +57730,48 @@ var participantGovernor = {
|
|
|
57549
57730
|
getParticipants: getParticipants$1,
|
|
57550
57731
|
};
|
|
57551
57732
|
|
|
57552
|
-
function
|
|
57733
|
+
function modifyEventPublishStatus(_a) {
|
|
57553
57734
|
var _b;
|
|
57554
|
-
var _c, _d,
|
|
57555
|
-
|
|
57735
|
+
var _c = _a.removePriorValues, removePriorValues = _c === void 0 ? true : _c, _d = _a.status, status = _d === void 0 ? PUBLIC : _d, statusObject = _a.statusObject, event = _a.event;
|
|
57736
|
+
if (!isObject(statusObject))
|
|
57737
|
+
return { error: INVALID_VALUES };
|
|
57738
|
+
var publishStatus = getEventPublishStatus({ event: event, status: status });
|
|
57739
|
+
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
57740
|
+
var updatedTimeItem = {
|
|
57741
|
+
itemValue: (_b = {}, _b[status] = __assign(__assign({}, publishStatus), statusObject), _b),
|
|
57742
|
+
itemType: itemType,
|
|
57743
|
+
};
|
|
57744
|
+
return addEventTimeItem({
|
|
57745
|
+
timeItem: updatedTimeItem,
|
|
57746
|
+
removePriorValues: removePriorValues,
|
|
57747
|
+
event: event,
|
|
57748
|
+
});
|
|
57749
|
+
}
|
|
57750
|
+
|
|
57751
|
+
function publishEventSeeding(_a) {
|
|
57752
|
+
var _b, _c, _d, _e;
|
|
57753
|
+
var _f = _a.removePriorValues, removePriorValues = _f === void 0 ? true : _f, stageSeedingScaleNames = _a.stageSeedingScaleNames, seedingScaleNames = _a.seedingScaleNames, tournamentRecord = _a.tournamentRecord, _g = _a.status, status = _g === void 0 ? PUBLIC : _g, _h = _a.drawIds, drawIds = _h === void 0 ? [] : _h, event = _a.event;
|
|
57556
57754
|
if (!tournamentRecord)
|
|
57557
57755
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57558
57756
|
if (!event)
|
|
57559
57757
|
return { error: MISSING_EVENT };
|
|
57560
|
-
var
|
|
57561
|
-
var
|
|
57562
|
-
|
|
57563
|
-
|
|
57564
|
-
|
|
57565
|
-
var
|
|
57566
|
-
var updatedSeedingScaleNames = (((_c = itemValue[status].seeding) === null || _c === void 0 ? void 0 : _c.seedingScaleNames) ||
|
|
57567
|
-
seedingScaleNames) && __assign(__assign({}, (_d = itemValue[status].seeding) === null || _d === void 0 ? void 0 : _d.seedingScaleNames), seedingScaleNames);
|
|
57568
|
-
var updatedStageSeedingScaleNames = (((_e = itemValue[status].seeding) === null || _e === void 0 ? void 0 : _e.stageSeedingScaleNames) ||
|
|
57569
|
-
stageSeedingScaleNames) && __assign(__assign({}, (_f = itemValue[status].seeding) === null || _f === void 0 ? void 0 : _f.stageSeedingScaleNames), stageSeedingScaleNames);
|
|
57570
|
-
itemValue[status].seeding = definedAttributes({
|
|
57758
|
+
var eventPubStatus = getEventPublishStatus({ event: event, status: status });
|
|
57759
|
+
var updatedSeedingScaleNames = (((_b = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.seeding) === null || _b === void 0 ? void 0 : _b.seedingScaleNames) ||
|
|
57760
|
+
seedingScaleNames) && __assign(__assign({}, (_c = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.seeding) === null || _c === void 0 ? void 0 : _c.seedingScaleNames), seedingScaleNames);
|
|
57761
|
+
var updatedStageSeedingScaleNames = (((_d = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.seeding) === null || _d === void 0 ? void 0 : _d.stageSeedingScaleNames) ||
|
|
57762
|
+
stageSeedingScaleNames) && __assign(__assign({}, (_e = eventPubStatus === null || eventPubStatus === void 0 ? void 0 : eventPubStatus.seeding) === null || _e === void 0 ? void 0 : _e.stageSeedingScaleNames), stageSeedingScaleNames);
|
|
57763
|
+
var seeding = definedAttributes({
|
|
57571
57764
|
stageSeedingScaleNames: updatedStageSeedingScaleNames,
|
|
57572
57765
|
seedingScaleNames: updatedSeedingScaleNames,
|
|
57573
57766
|
published: true,
|
|
57574
57767
|
drawIds: drawIds,
|
|
57575
57768
|
});
|
|
57576
|
-
|
|
57577
|
-
|
|
57578
|
-
|
|
57579
|
-
|
|
57580
|
-
|
|
57769
|
+
modifyEventPublishStatus({
|
|
57770
|
+
statusObject: { seeding: seeding },
|
|
57771
|
+
removePriorValues: removePriorValues,
|
|
57772
|
+
status: status,
|
|
57773
|
+
event: event,
|
|
57774
|
+
});
|
|
57581
57775
|
addNotice({
|
|
57582
57776
|
topic: PUBLISH_EVENT_SEEDING,
|
|
57583
57777
|
payload: {
|
|
@@ -57589,51 +57783,55 @@ function publishEventSeeding(_a) {
|
|
|
57589
57783
|
return __assign({}, SUCCESS);
|
|
57590
57784
|
}
|
|
57591
57785
|
function unPublishEventSeeding(_a) {
|
|
57592
|
-
var
|
|
57593
|
-
var _d, _e;
|
|
57594
|
-
var _f = _a.removePriorValues, removePriorValues = _f === void 0 ? true : _f, seedingScaleNames = _a.seedingScaleNames, tournamentRecord = _a.tournamentRecord, _g = _a.status, status = _g === void 0 ? PUBLIC : _g, stages = _a.stages, event = _a.event;
|
|
57786
|
+
var e_1, _b;
|
|
57787
|
+
var _c, _d, _e;
|
|
57788
|
+
var _f = _a.removePriorValues, removePriorValues = _f === void 0 ? true : _f, seedingScaleNames = _a.seedingScaleNames, tournamentRecord = _a.tournamentRecord, _g = _a.status, status = _g === void 0 ? PUBLIC : _g, drawIds = _a.drawIds, stages = _a.stages, event = _a.event;
|
|
57595
57789
|
if (!tournamentRecord)
|
|
57596
57790
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57597
57791
|
if (!event)
|
|
57598
57792
|
return { error: MISSING_EVENT };
|
|
57599
|
-
var
|
|
57600
|
-
|
|
57601
|
-
|
|
57602
|
-
|
|
57603
|
-
}).timeItem;
|
|
57604
|
-
var itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || (_b = {}, _b[status] = {}, _b);
|
|
57605
|
-
if (itemValue[status]) {
|
|
57606
|
-
if (Array.isArray(stages) &&
|
|
57607
|
-
((_d = itemValue[status].seeding) === null || _d === void 0 ? void 0 : _d.stageSeedingScaleNames)) {
|
|
57793
|
+
var eventPubStatus = getEventPublishStatus({ event: event });
|
|
57794
|
+
if (eventPubStatus) {
|
|
57795
|
+
var seeding = eventPubStatus.seeding;
|
|
57796
|
+
if (Array.isArray(stages) && seeding.stageSeedingScaleNames) {
|
|
57608
57797
|
try {
|
|
57609
57798
|
for (var stages_1 = __values(stages), stages_1_1 = stages_1.next(); !stages_1_1.done; stages_1_1 = stages_1.next()) {
|
|
57610
57799
|
var stage = stages_1_1.value;
|
|
57611
|
-
if (
|
|
57612
|
-
delete
|
|
57800
|
+
if (seeding.stageSeedingScaleNames[stage]) {
|
|
57801
|
+
delete seeding.stageSeedingScaleNames[stage];
|
|
57613
57802
|
}
|
|
57614
57803
|
}
|
|
57615
57804
|
}
|
|
57616
57805
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
57617
57806
|
finally {
|
|
57618
57807
|
try {
|
|
57619
|
-
if (stages_1_1 && !stages_1_1.done && (
|
|
57808
|
+
if (stages_1_1 && !stages_1_1.done && (_b = stages_1.return)) _b.call(stages_1);
|
|
57620
57809
|
}
|
|
57621
57810
|
finally { if (e_1) throw e_1.error; }
|
|
57622
57811
|
}
|
|
57623
57812
|
}
|
|
57624
|
-
if (Array.isArray(seedingScaleNames) &&
|
|
57625
|
-
|
|
57626
|
-
|
|
57813
|
+
if (Array.isArray(seedingScaleNames) && (seeding === null || seeding === void 0 ? void 0 : seeding.seedingScaleNames)) {
|
|
57814
|
+
seeding.seedingScaleNames = seeding.seedingScaleNames.filter(function (scaleName) { return !seedingScaleNames.includes(scaleName); });
|
|
57815
|
+
}
|
|
57816
|
+
if (Array.isArray(drawIds) && (seeding === null || seeding === void 0 ? void 0 : seeding.drawIds)) {
|
|
57817
|
+
seeding.drawIds = seeding.drawIds.filter(function (drawId) { return !drawIds.includes(drawId); });
|
|
57627
57818
|
}
|
|
57628
|
-
if (!
|
|
57629
|
-
|
|
57819
|
+
if ((!Object.values((_c = seeding.stageSeedingScaleNames) !== null && _c !== void 0 ? _c : {}).length &&
|
|
57820
|
+
!((_d = seeding.seedingScaleNames) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
57821
|
+
!((_e = seeding.drawIds) === null || _e === void 0 ? void 0 : _e.length)) ||
|
|
57822
|
+
(!stages && !seedingScaleNames && !(drawIds === null || drawIds === void 0 ? void 0 : drawIds.length))) {
|
|
57823
|
+
delete seeding.stageSeedingScaleNames;
|
|
57824
|
+
delete seeding.seedingScaleNames;
|
|
57825
|
+
delete seeding.drawIds;
|
|
57826
|
+
seeding.published = false;
|
|
57630
57827
|
}
|
|
57828
|
+
modifyEventPublishStatus({
|
|
57829
|
+
statusObject: { seeding: seeding },
|
|
57830
|
+
removePriorValues: removePriorValues,
|
|
57831
|
+
status: status,
|
|
57832
|
+
event: event,
|
|
57833
|
+
});
|
|
57631
57834
|
}
|
|
57632
|
-
var updatedTimeItem = {
|
|
57633
|
-
itemValue: itemValue,
|
|
57634
|
-
itemType: itemType,
|
|
57635
|
-
};
|
|
57636
|
-
addEventTimeItem({ event: event, timeItem: updatedTimeItem, removePriorValues: removePriorValues });
|
|
57637
57835
|
addNotice({
|
|
57638
57836
|
topic: UNPUBLISH_EVENT_SEEDING,
|
|
57639
57837
|
payload: {
|
|
@@ -57708,13 +57906,10 @@ function getAllEventData(_a) {
|
|
|
57708
57906
|
},
|
|
57709
57907
|
};
|
|
57710
57908
|
});
|
|
57711
|
-
var
|
|
57712
|
-
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
57713
|
-
event: event,
|
|
57714
|
-
}).timeItem;
|
|
57909
|
+
var publish = getEventPublishStatus({ event: event });
|
|
57715
57910
|
Object.assign(eventInfo, {
|
|
57716
|
-
publish: timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue,
|
|
57717
57911
|
drawsData: drawsData,
|
|
57912
|
+
publish: publish,
|
|
57718
57913
|
});
|
|
57719
57914
|
return eventInfo;
|
|
57720
57915
|
});
|
|
@@ -57722,6 +57917,72 @@ function getAllEventData(_a) {
|
|
|
57722
57917
|
return { allEventData: allEventData };
|
|
57723
57918
|
}
|
|
57724
57919
|
|
|
57920
|
+
function setEventDisplay(_a) {
|
|
57921
|
+
var e_1, _b, e_2, _c;
|
|
57922
|
+
var _d;
|
|
57923
|
+
var removePriorValues = _a.removePriorValues, tournamentRecord = _a.tournamentRecord, displaySettings = _a.displaySettings, _e = _a.status, status = _e === void 0 ? PUBLIC : _e, event = _a.event;
|
|
57924
|
+
if (!tournamentRecord)
|
|
57925
|
+
return decorateResult({ result: { error: MISSING_TOURNAMENT_RECORD } });
|
|
57926
|
+
if (!event)
|
|
57927
|
+
return decorateResult({ result: { error: MISSING_EVENT } });
|
|
57928
|
+
if (!isObject(displaySettings))
|
|
57929
|
+
return decorateResult({ result: { error: MISSING_VALUE } });
|
|
57930
|
+
// combine ScheduleDetails that are equivalent
|
|
57931
|
+
if (isObject(displaySettings.draws)) {
|
|
57932
|
+
try {
|
|
57933
|
+
for (var _f = __values(Object.keys(displaySettings.draws)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
57934
|
+
var key = _g.value;
|
|
57935
|
+
var details = (_d = displaySettings.draws[key].scheduleDetails) !== null && _d !== void 0 ? _d : [];
|
|
57936
|
+
if (details.length) {
|
|
57937
|
+
var scheduleDetails = [];
|
|
57938
|
+
var _loop_1 = function (detail) {
|
|
57939
|
+
var _h;
|
|
57940
|
+
var existingDetail = scheduleDetails.find(function (sd) {
|
|
57941
|
+
return objShallowEqual(sd.attributes, detail.attributes);
|
|
57942
|
+
});
|
|
57943
|
+
if ((existingDetail === null || existingDetail === void 0 ? void 0 : existingDetail.dates) && detail.dates) {
|
|
57944
|
+
(_h = existingDetail.dates).push.apply(_h, __spreadArray([], __read(detail.dates), false));
|
|
57945
|
+
}
|
|
57946
|
+
else {
|
|
57947
|
+
scheduleDetails.push(detail);
|
|
57948
|
+
}
|
|
57949
|
+
};
|
|
57950
|
+
try {
|
|
57951
|
+
for (var details_1 = (e_2 = void 0, __values(details)), details_1_1 = details_1.next(); !details_1_1.done; details_1_1 = details_1.next()) {
|
|
57952
|
+
var detail = details_1_1.value;
|
|
57953
|
+
_loop_1(detail);
|
|
57954
|
+
}
|
|
57955
|
+
}
|
|
57956
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
57957
|
+
finally {
|
|
57958
|
+
try {
|
|
57959
|
+
if (details_1_1 && !details_1_1.done && (_c = details_1.return)) _c.call(details_1);
|
|
57960
|
+
}
|
|
57961
|
+
finally { if (e_2) throw e_2.error; }
|
|
57962
|
+
}
|
|
57963
|
+
displaySettings.draws[key].scheduleDetails = scheduleDetails;
|
|
57964
|
+
}
|
|
57965
|
+
}
|
|
57966
|
+
}
|
|
57967
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
57968
|
+
finally {
|
|
57969
|
+
try {
|
|
57970
|
+
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
57971
|
+
}
|
|
57972
|
+
finally { if (e_1) throw e_1.error; }
|
|
57973
|
+
}
|
|
57974
|
+
}
|
|
57975
|
+
var result = modifyEventPublishStatus({
|
|
57976
|
+
statusObject: { displaySettings: displaySettings },
|
|
57977
|
+
removePriorValues: removePriorValues,
|
|
57978
|
+
status: status,
|
|
57979
|
+
event: event,
|
|
57980
|
+
});
|
|
57981
|
+
if (result.error)
|
|
57982
|
+
return result;
|
|
57983
|
+
return __assign({}, SUCCESS);
|
|
57984
|
+
}
|
|
57985
|
+
|
|
57725
57986
|
function unPublishEvent(_a) {
|
|
57726
57987
|
var _b;
|
|
57727
57988
|
var _c = _a.removePriorValues, removePriorValues = _c === void 0 ? true : _c, tournamentRecord = _a.tournamentRecord, _d = _a.status, status = _d === void 0 ? PUBLIC : _d, event = _a.event;
|
|
@@ -57735,10 +57996,21 @@ function unPublishEvent(_a) {
|
|
|
57735
57996
|
event: event,
|
|
57736
57997
|
}).timeItem;
|
|
57737
57998
|
var itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || (_b = {}, _b[status] = {}, _b);
|
|
57738
|
-
delete itemValue[status].structureIds;
|
|
57739
|
-
delete itemValue[status].
|
|
57999
|
+
delete itemValue[status].structureIds; // legacy
|
|
58000
|
+
delete itemValue[status].drawDetails;
|
|
58001
|
+
delete itemValue[status].drawIds; // legacy
|
|
57740
58002
|
var updatedTimeItem = { itemValue: itemValue, itemType: itemType };
|
|
57741
58003
|
addEventTimeItem({ event: event, timeItem: updatedTimeItem, removePriorValues: removePriorValues });
|
|
58004
|
+
modifyEventPublishStatus({
|
|
58005
|
+
statusObject: {
|
|
58006
|
+
structureIds: undefined,
|
|
58007
|
+
drawIds: undefined,
|
|
58008
|
+
seeding: undefined,
|
|
58009
|
+
},
|
|
58010
|
+
removePriorValues: removePriorValues,
|
|
58011
|
+
status: status,
|
|
58012
|
+
event: event,
|
|
58013
|
+
});
|
|
57742
58014
|
addNotice({
|
|
57743
58015
|
topic: UNPUBLISH_EVENT,
|
|
57744
58016
|
payload: {
|
|
@@ -57750,64 +58022,183 @@ function unPublishEvent(_a) {
|
|
|
57750
58022
|
}
|
|
57751
58023
|
|
|
57752
58024
|
function publishEvent(params) {
|
|
57753
|
-
var _a;
|
|
57754
|
-
var
|
|
57755
|
-
var
|
|
57756
|
-
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;
|
|
58025
|
+
var _a, e_1, _b;
|
|
58026
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
58027
|
+
var includePositionAssignments = params.includePositionAssignments, removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord, _q = params.status, status = _q === void 0 ? PUBLIC : _q, event = params.event, drawIdsToRemove = params.drawIdsToRemove, drawIdsToAdd = params.drawIdsToAdd;
|
|
57757
58028
|
if (!tournamentRecord)
|
|
57758
58029
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
57759
58030
|
if (!event)
|
|
57760
58031
|
return { error: MISSING_EVENT };
|
|
57761
|
-
|
|
57762
|
-
|
|
57763
|
-
|
|
57764
|
-
|
|
57765
|
-
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
57766
|
-
var eventDrawIds = (_c = (_b = event.drawDefinitions) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
|
|
58032
|
+
// publishing will draw on scoring policy, round naming policy and participant (privacy) policy
|
|
58033
|
+
var appliedPolicies = getAppliedPolicies({ tournamentRecord: tournamentRecord, event: event }).appliedPolicies;
|
|
58034
|
+
var policyDefinitions = __assign(__assign({}, appliedPolicies), params.policyDefinitions);
|
|
58035
|
+
var eventDrawIds = (_d = (_c = event.drawDefinitions) === null || _c === void 0 ? void 0 : _c.map(function (_a) {
|
|
57767
58036
|
var drawId = _a.drawId;
|
|
57768
58037
|
return drawId;
|
|
57769
|
-
})) !== null &&
|
|
57770
|
-
var
|
|
57771
|
-
|
|
57772
|
-
|
|
57773
|
-
|
|
57774
|
-
|
|
57775
|
-
|
|
57776
|
-
|
|
57777
|
-
|
|
57778
|
-
|
|
57779
|
-
|
|
57780
|
-
|
|
57781
|
-
|
|
57782
|
-
|
|
57783
|
-
|
|
58038
|
+
})) !== null && _d !== void 0 ? _d : [];
|
|
58039
|
+
var keyedDrawIds = params.drawDetails
|
|
58040
|
+
? Object.keys(params.drawDetails)
|
|
58041
|
+
: [];
|
|
58042
|
+
var specifiedDrawIds = keyedDrawIds.length ? [] : params.drawIds;
|
|
58043
|
+
var drawIdsToValidate = (_a = (drawIdsToAdd !== null && drawIdsToAdd !== void 0 ? drawIdsToAdd : [])).concat.apply(_a, __spreadArray(__spreadArray(__spreadArray([], __read((drawIdsToRemove !== null && drawIdsToRemove !== void 0 ? drawIdsToRemove : [])), false), __read((specifiedDrawIds !== null && specifiedDrawIds !== void 0 ? specifiedDrawIds : [])), false), __read(keyedDrawIds), false));
|
|
58044
|
+
var invalidDrawIds = drawIdsToValidate.filter(function (drawId) { return !eventDrawIds.includes(drawId); });
|
|
58045
|
+
if (invalidDrawIds.length) {
|
|
58046
|
+
return decorateResult({
|
|
58047
|
+
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
58048
|
+
context: { invalidDrawIds: invalidDrawIds },
|
|
58049
|
+
});
|
|
58050
|
+
}
|
|
58051
|
+
var pubStatus = getEventPublishStatus({ event: event, status: status });
|
|
58052
|
+
var drawDetails = (pubStatus === null || pubStatus === void 0 ? void 0 : pubStatus.drawDetails) || {};
|
|
58053
|
+
var _loop_1 = function (drawId) {
|
|
58054
|
+
var e_2, _r, e_3, _s, e_4, _t, e_5, _u, e_6, _v;
|
|
58055
|
+
if (!drawIdsToValidate.length || drawIdsToValidate.includes(drawId)) {
|
|
58056
|
+
if ((drawIdsToRemove === null || drawIdsToRemove === void 0 ? void 0 : drawIdsToRemove.includes(drawId)) ||
|
|
58057
|
+
((specifiedDrawIds === null || specifiedDrawIds === void 0 ? void 0 : specifiedDrawIds.length) && !specifiedDrawIds.includes(drawId))) {
|
|
58058
|
+
drawDetails[drawId] = __assign(__assign({}, drawDetails[drawId]), { publishingDetail: { published: false } });
|
|
58059
|
+
}
|
|
58060
|
+
else if ((drawIdsToAdd === null || drawIdsToAdd === void 0 ? void 0 : drawIdsToAdd.includes(drawId)) ||
|
|
58061
|
+
(specifiedDrawIds === null || specifiedDrawIds === void 0 ? void 0 : specifiedDrawIds.includes(drawId)) ||
|
|
58062
|
+
!(specifiedDrawIds === null || specifiedDrawIds === void 0 ? void 0 : specifiedDrawIds.length)) {
|
|
58063
|
+
drawDetails[drawId] = __assign(__assign({}, drawDetails[drawId]), { publishingDetail: { published: true } });
|
|
58064
|
+
}
|
|
58065
|
+
}
|
|
58066
|
+
if ((_e = params.drawDetails) === null || _e === void 0 ? void 0 : _e[drawId]) {
|
|
58067
|
+
var newDetail = params.drawDetails[drawId];
|
|
58068
|
+
var structureDetails = (_f = newDetail.structureDetails) !== null && _f !== void 0 ? _f : drawDetails[drawId].structureDetails;
|
|
58069
|
+
var stageDetails = (_h = (_g = newDetail.stageDetails) !== null && _g !== void 0 ? _g : drawDetails[drawId].stageDetails) !== null && _h !== void 0 ? _h : {};
|
|
58070
|
+
var _w = newDetail.structureIdsToRemove, structureIdsToRemove = _w === void 0 ? [] : _w, _x = newDetail.structureIdsToAdd, structureIdsToAdd = _x === void 0 ? [] : _x, _y = newDetail.publishingDetail, publishingDetail = _y === void 0 ? {} : _y, _z = newDetail.stagesToRemove, stagesToRemove = _z === void 0 ? [] : _z, _0 = newDetail.stagesToAdd, stagesToAdd = _0 === void 0 ? [] : _0;
|
|
58071
|
+
if (structureIdsToAdd || stagesToAdd)
|
|
58072
|
+
publishingDetail.published = true;
|
|
58073
|
+
drawDetails[drawId] = {
|
|
58074
|
+
publishingDetail: publishingDetail,
|
|
58075
|
+
structureDetails: structureDetails,
|
|
58076
|
+
stageDetails: stageDetails,
|
|
58077
|
+
};
|
|
58078
|
+
if (structureIdsToAdd.length || structureIdsToRemove.length) {
|
|
58079
|
+
var drawStructureIds_2 = ((_l = (_k = (_j = event.drawDefinitions) === null || _j === void 0 ? void 0 : _j.find(function (drawDefinition) { return drawDefinition.drawId === drawId; })) === null || _k === void 0 ? void 0 : _k.structures) !== null && _l !== void 0 ? _l : []).map(function (_a) {
|
|
58080
|
+
var structureId = _a.structureId;
|
|
58081
|
+
return structureId;
|
|
58082
|
+
});
|
|
58083
|
+
var structureIdsToValidate = (structureIdsToAdd !== null && structureIdsToAdd !== void 0 ? structureIdsToAdd : []).concat(structureIdsToRemove !== null && structureIdsToRemove !== void 0 ? structureIdsToRemove : []);
|
|
58084
|
+
var invalidStructureIds = structureIdsToValidate.filter(function (structureId) { return !drawStructureIds_2.includes(structureId); });
|
|
58085
|
+
if (invalidStructureIds.length) {
|
|
58086
|
+
return { value: decorateResult({
|
|
58087
|
+
result: { error: STRUCTURE_NOT_FOUND },
|
|
58088
|
+
context: { invalidStructureIds: invalidStructureIds },
|
|
58089
|
+
}) };
|
|
58090
|
+
}
|
|
58091
|
+
structureDetails = structureDetails !== null && structureDetails !== void 0 ? structureDetails : {};
|
|
58092
|
+
try {
|
|
58093
|
+
for (var drawStructureIds_1 = (e_2 = void 0, __values(drawStructureIds_2)), drawStructureIds_1_1 = drawStructureIds_1.next(); !drawStructureIds_1_1.done; drawStructureIds_1_1 = drawStructureIds_1.next()) {
|
|
58094
|
+
var structureId = drawStructureIds_1_1.value;
|
|
58095
|
+
if (structureIdsToRemove.includes(structureId)) {
|
|
58096
|
+
structureDetails[structureId] = { published: false };
|
|
58097
|
+
}
|
|
58098
|
+
else {
|
|
58099
|
+
structureDetails[structureId] = { published: true };
|
|
58100
|
+
}
|
|
58101
|
+
}
|
|
58102
|
+
}
|
|
58103
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
58104
|
+
finally {
|
|
58105
|
+
try {
|
|
58106
|
+
if (drawStructureIds_1_1 && !drawStructureIds_1_1.done && (_r = drawStructureIds_1.return)) _r.call(drawStructureIds_1);
|
|
58107
|
+
}
|
|
58108
|
+
finally { if (e_2) throw e_2.error; }
|
|
58109
|
+
}
|
|
58110
|
+
drawDetails[drawId].structureDetails = structureDetails;
|
|
58111
|
+
}
|
|
58112
|
+
var drawStages = ((_p = (_o = (_m = event.drawDefinitions) === null || _m === void 0 ? void 0 : _m.find(function (drawDefinition) { return drawDefinition.drawId === drawId; })) === null || _o === void 0 ? void 0 : _o.structures) !== null && _p !== void 0 ? _p : []).map(function (_a) {
|
|
58113
|
+
var stage = _a.stage;
|
|
58114
|
+
return stage;
|
|
58115
|
+
});
|
|
58116
|
+
if (stagesToAdd.length) {
|
|
58117
|
+
try {
|
|
58118
|
+
for (var stagesToAdd_1 = (e_3 = void 0, __values(stagesToAdd)), stagesToAdd_1_1 = stagesToAdd_1.next(); !stagesToAdd_1_1.done; stagesToAdd_1_1 = stagesToAdd_1.next()) {
|
|
58119
|
+
var stage = stagesToAdd_1_1.value;
|
|
58120
|
+
stageDetails[stage] = { published: true };
|
|
58121
|
+
}
|
|
58122
|
+
}
|
|
58123
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
58124
|
+
finally {
|
|
58125
|
+
try {
|
|
58126
|
+
if (stagesToAdd_1_1 && !stagesToAdd_1_1.done && (_s = stagesToAdd_1.return)) _s.call(stagesToAdd_1);
|
|
58127
|
+
}
|
|
58128
|
+
finally { if (e_3) throw e_3.error; }
|
|
58129
|
+
}
|
|
58130
|
+
try {
|
|
58131
|
+
for (var drawStages_1 = (e_4 = void 0, __values(drawStages)), drawStages_1_1 = drawStages_1.next(); !drawStages_1_1.done; drawStages_1_1 = drawStages_1.next()) {
|
|
58132
|
+
var stage = drawStages_1_1.value;
|
|
58133
|
+
if (!stageDetails[stage]) {
|
|
58134
|
+
stageDetails[stage] = { published: false };
|
|
58135
|
+
}
|
|
58136
|
+
}
|
|
58137
|
+
}
|
|
58138
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
58139
|
+
finally {
|
|
58140
|
+
try {
|
|
58141
|
+
if (drawStages_1_1 && !drawStages_1_1.done && (_t = drawStages_1.return)) _t.call(drawStages_1);
|
|
58142
|
+
}
|
|
58143
|
+
finally { if (e_4) throw e_4.error; }
|
|
58144
|
+
}
|
|
58145
|
+
}
|
|
58146
|
+
if (stagesToAdd.length || stagesToRemove.length) {
|
|
58147
|
+
try {
|
|
58148
|
+
for (var stagesToRemove_1 = (e_5 = void 0, __values(stagesToRemove)), stagesToRemove_1_1 = stagesToRemove_1.next(); !stagesToRemove_1_1.done; stagesToRemove_1_1 = stagesToRemove_1.next()) {
|
|
58149
|
+
var stage = stagesToRemove_1_1.value;
|
|
58150
|
+
stageDetails[stage] = { published: false };
|
|
58151
|
+
}
|
|
58152
|
+
}
|
|
58153
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
58154
|
+
finally {
|
|
58155
|
+
try {
|
|
58156
|
+
if (stagesToRemove_1_1 && !stagesToRemove_1_1.done && (_u = stagesToRemove_1.return)) _u.call(stagesToRemove_1);
|
|
58157
|
+
}
|
|
58158
|
+
finally { if (e_5) throw e_5.error; }
|
|
58159
|
+
}
|
|
58160
|
+
try {
|
|
58161
|
+
for (var drawStages_2 = (e_6 = void 0, __values(drawStages)), drawStages_2_1 = drawStages_2.next(); !drawStages_2_1.done; drawStages_2_1 = drawStages_2.next()) {
|
|
58162
|
+
var stage = drawStages_2_1.value;
|
|
58163
|
+
if (!stageDetails[stage]) {
|
|
58164
|
+
stageDetails[stage] = { published: true };
|
|
58165
|
+
}
|
|
58166
|
+
}
|
|
58167
|
+
}
|
|
58168
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
58169
|
+
finally {
|
|
58170
|
+
try {
|
|
58171
|
+
if (drawStages_2_1 && !drawStages_2_1.done && (_v = drawStages_2.return)) _v.call(drawStages_2);
|
|
58172
|
+
}
|
|
58173
|
+
finally { if (e_6) throw e_6.error; }
|
|
58174
|
+
}
|
|
58175
|
+
}
|
|
58176
|
+
if (stagesToAdd.length || stagesToRemove.length) {
|
|
58177
|
+
drawDetails[drawId].stageDetails = stageDetails;
|
|
58178
|
+
}
|
|
58179
|
+
}
|
|
58180
|
+
};
|
|
58181
|
+
try {
|
|
58182
|
+
for (var eventDrawIds_1 = __values(eventDrawIds), eventDrawIds_1_1 = eventDrawIds_1.next(); !eventDrawIds_1_1.done; eventDrawIds_1_1 = eventDrawIds_1.next()) {
|
|
58183
|
+
var drawId = eventDrawIds_1_1.value;
|
|
58184
|
+
var state_1 = _loop_1(drawId);
|
|
58185
|
+
if (typeof state_1 === "object")
|
|
58186
|
+
return state_1.value;
|
|
58187
|
+
}
|
|
57784
58188
|
}
|
|
57785
|
-
|
|
57786
|
-
|
|
57787
|
-
|
|
58189
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
58190
|
+
finally {
|
|
58191
|
+
try {
|
|
58192
|
+
if (eventDrawIds_1_1 && !eventDrawIds_1_1.done && (_b = eventDrawIds_1.return)) _b.call(eventDrawIds_1);
|
|
58193
|
+
}
|
|
58194
|
+
finally { if (e_1) throw e_1.error; }
|
|
57788
58195
|
}
|
|
57789
|
-
|
|
57790
|
-
|
|
57791
|
-
|
|
58196
|
+
modifyEventPublishStatus({
|
|
58197
|
+
statusObject: { drawDetails: drawDetails },
|
|
58198
|
+
removePriorValues: removePriorValues,
|
|
58199
|
+
status: status,
|
|
58200
|
+
event: event,
|
|
57792
58201
|
});
|
|
57793
|
-
if (structureIdsToAdd === null || structureIdsToAdd === void 0 ? void 0 : structureIdsToAdd.length) {
|
|
57794
|
-
structureIds = unique(structureIds.concat.apply(structureIds, __spreadArray([], __read(structureIdsToAdd), false)));
|
|
57795
|
-
}
|
|
57796
|
-
if (!stages && ((stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) || (stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length))) {
|
|
57797
|
-
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) || [];
|
|
57798
|
-
}
|
|
57799
|
-
stages = (stages !== null && stages !== void 0 ? stages : []).filter(function (stage) { return !(stagesToRemove === null || stagesToRemove === void 0 ? void 0 : stagesToRemove.length) || !stagesToRemove.includes(stage); });
|
|
57800
|
-
if (stagesToAdd === null || stagesToAdd === void 0 ? void 0 : stagesToAdd.length) {
|
|
57801
|
-
stages = unique(stages.concat.apply(stages, __spreadArray([], __read(stagesToAdd), false)));
|
|
57802
|
-
}
|
|
57803
|
-
var existingStatusValue = (_k = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _k === void 0 ? void 0 : _k[status];
|
|
57804
|
-
var updatedTimeItem = {
|
|
57805
|
-
itemValue: (_a = {},
|
|
57806
|
-
_a[status] = __assign(__assign({}, existingStatusValue), { drawIds: drawIds, structureIds: structureIds, stages: stages }),
|
|
57807
|
-
_a),
|
|
57808
|
-
itemType: itemType,
|
|
57809
|
-
};
|
|
57810
|
-
addEventTimeItem({ event: event, timeItem: updatedTimeItem, removePriorValues: removePriorValues });
|
|
57811
58202
|
var eventData = getEventData({
|
|
57812
58203
|
includePositionAssignments: includePositionAssignments,
|
|
57813
58204
|
usePublishState: true,
|
|
@@ -57815,13 +58206,6 @@ function publishEvent(params) {
|
|
|
57815
58206
|
policyDefinitions: policyDefinitions,
|
|
57816
58207
|
event: event,
|
|
57817
58208
|
}).eventData;
|
|
57818
|
-
// filter out drawData for unPublished draws
|
|
57819
|
-
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;
|
|
57820
|
-
eventData.drawsData = eventData.drawsData.filter(function (_a) {
|
|
57821
|
-
var _b;
|
|
57822
|
-
var drawId = _a.drawId;
|
|
57823
|
-
return (_b = publishState === null || publishState === void 0 ? void 0 : publishState.PUBLIC) === null || _b === void 0 ? void 0 : _b.drawIds.includes(drawId);
|
|
57824
|
-
});
|
|
57825
58209
|
addNotice({
|
|
57826
58210
|
payload: { eventData: eventData, tournamentId: tournamentRecord.tournamentId },
|
|
57827
58211
|
topic: PUBLISH_EVENT,
|
|
@@ -57838,6 +58222,7 @@ var publishingGovernor = {
|
|
|
57838
58222
|
getDrawData: getDrawData,
|
|
57839
58223
|
unPublishEventSeeding: unPublishEventSeeding,
|
|
57840
58224
|
publishEventSeeding: publishEventSeeding,
|
|
58225
|
+
setEventDisplay: setEventDisplay,
|
|
57841
58226
|
unPublishEvent: unPublishEvent,
|
|
57842
58227
|
publishEvent: publishEvent,
|
|
57843
58228
|
unPublishOrderOfPlay: unPublishOrderOfPlay$1,
|
|
@@ -58236,7 +58621,7 @@ var sortingConstants = { ASC: ASC, ASCENDING: ASCENDING, DESC: DESC, DESCENDING:
|
|
|
58236
58621
|
// by default if there are no scaleValues matching the scaleAccessor then participants will be assigned in the array order of [team].individidualParticipantIds
|
|
58237
58622
|
function generateLineUps(params) {
|
|
58238
58623
|
var e_1, _a, e_2, _b;
|
|
58239
|
-
var _c, _d, _e, _f, _g, _h, _j
|
|
58624
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
58240
58625
|
var tieFormat = params.tieFormat;
|
|
58241
58626
|
var useDefaultEventRanking = params.useDefaultEventRanking, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, scaleAccessor = params.scaleAccessor, // e.g. { scaleType: 'RANKINGS', scaleName: 'U18', accessor: 'wtnRating', sortOrder: 'ASC' }
|
|
58242
58627
|
singlesOnly = params.singlesOnly, // use singles scale for doubles events
|
|
@@ -58250,25 +58635,25 @@ function generateLineUps(params) {
|
|
|
58250
58635
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
58251
58636
|
tieFormat =
|
|
58252
58637
|
tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
58253
|
-
if (validateTieFormat({ tieFormat: tieFormat
|
|
58638
|
+
if (validateTieFormat({ tieFormat: tieFormat }).error)
|
|
58254
58639
|
return { error: INVALID_TIE_FORMAT };
|
|
58255
58640
|
if (typeof scaleAccessor !== 'object' && !useDefaultEventRanking)
|
|
58256
58641
|
return { error: INVALID_VALUES, context: { scaleAccessor: scaleAccessor } };
|
|
58257
58642
|
var lineUps = {};
|
|
58258
|
-
var targetEntries = ((
|
|
58643
|
+
var targetEntries = ((_e = (_d = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) !== null && _d !== void 0 ? _d : event === null || event === void 0 ? void 0 : event.entries) !== null && _e !== void 0 ? _e : []).filter(function (entry) { return (entry === null || entry === void 0 ? void 0 : entry.entryStatus) === DIRECT_ACCEPTANCE; });
|
|
58259
58644
|
var participantIds = targetEntries.map(getParticipantId);
|
|
58260
|
-
var
|
|
58645
|
+
var _k = getParticipants$1({
|
|
58261
58646
|
withIndividualParticipants: true,
|
|
58262
58647
|
withScaleValues: true,
|
|
58263
58648
|
tournamentRecord: tournamentRecord,
|
|
58264
|
-
}).participants, participants =
|
|
58649
|
+
}).participants, participants = _k === void 0 ? [] : _k;
|
|
58265
58650
|
var teamParticipants = participants.filter(function (_a) {
|
|
58266
58651
|
var participantId = _a.participantId;
|
|
58267
58652
|
return participantIds.includes(participantId);
|
|
58268
58653
|
});
|
|
58269
58654
|
var formatScaleType = function (type) { return (type === RANKING$1 ? 'rankings' : 'ratings'); };
|
|
58270
|
-
var defaultScaleName = (
|
|
58271
|
-
var
|
|
58655
|
+
var defaultScaleName = (_g = (_f = event === null || event === void 0 ? void 0 : event.category) === null || _f === void 0 ? void 0 : _f.categoryName) !== null && _g !== void 0 ? _g : (_h = event === null || event === void 0 ? void 0 : event.category) === null || _h === void 0 ? void 0 : _h.ageCategoryCode;
|
|
58656
|
+
var _l = scaleAccessor || {}, _m = _l.scaleName, scaleName = _m === void 0 ? defaultScaleName : _m, _o = _l.scaleType, scaleType = _o === void 0 ? RANKING$1 : _o, sortOrder = _l.sortOrder, accessor = _l.accessor;
|
|
58272
58657
|
var formattedScaleType = formatScaleType(scaleType);
|
|
58273
58658
|
var getScaleValue = function (individualParticipant, matchUpType) {
|
|
58274
58659
|
var _a, _b, _c;
|
|
@@ -58296,9 +58681,9 @@ function generateLineUps(params) {
|
|
|
58296
58681
|
var singlesScaleSort = function (a, b) { return sortMethod(a, b, SINGLES_MATCHUP); };
|
|
58297
58682
|
var doublesScaleSort = function (a, b) { return sortMethod(a, b, DOUBLES_MATCHUP); };
|
|
58298
58683
|
var participantIdPairs = [];
|
|
58299
|
-
var collectionDefinitions = (
|
|
58684
|
+
var collectionDefinitions = (_j = tieFormat === null || tieFormat === void 0 ? void 0 : tieFormat.collectionDefinitions) !== null && _j !== void 0 ? _j : [];
|
|
58300
58685
|
var _loop_1 = function (teamParticipant) {
|
|
58301
|
-
var e_3,
|
|
58686
|
+
var e_3, _p;
|
|
58302
58687
|
var singlesSort = teamParticipant.individualParticipants.sort(singlesScaleSort);
|
|
58303
58688
|
var doublesSort = singlesOnly
|
|
58304
58689
|
? singlesSort
|
|
@@ -58345,7 +58730,7 @@ function generateLineUps(params) {
|
|
|
58345
58730
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
58346
58731
|
finally {
|
|
58347
58732
|
try {
|
|
58348
|
-
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (
|
|
58733
|
+
if (collectionDefinitions_1_1 && !collectionDefinitions_1_1.done && (_p = collectionDefinitions_1.return)) _p.call(collectionDefinitions_1);
|
|
58349
58734
|
}
|
|
58350
58735
|
finally { if (e_3) throw e_3.error; }
|
|
58351
58736
|
}
|
|
@@ -61295,13 +61680,13 @@ function getPositionAssignments(_a) {
|
|
|
61295
61680
|
|
|
61296
61681
|
function deleteDrawDefinitions(params) {
|
|
61297
61682
|
var e_1, _a;
|
|
61298
|
-
var _b, _c, _d, _e, _f, _g;
|
|
61683
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
61299
61684
|
if (!params.tournamentRecord)
|
|
61300
61685
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61301
61686
|
var stack = 'deleteDrawDefinitions';
|
|
61302
61687
|
var drawIds = (_b = params.drawIds) !== null && _b !== void 0 ? _b : [];
|
|
61303
61688
|
var event = params.event;
|
|
61304
|
-
var
|
|
61689
|
+
var _k = params.autoPublish, autoPublish = _k === void 0 ? true : _k, tournamentRecord = params.tournamentRecord, auditData = params.auditData, eventId = params.eventId, force = params.force;
|
|
61305
61690
|
var appliedPolicies = getAppliedPolicies({ tournamentRecord: tournamentRecord, event: event }).appliedPolicies;
|
|
61306
61691
|
var policyDefinitions = __assign(__assign({}, appliedPolicies), params.policyDefinitions);
|
|
61307
61692
|
var drawId = Array.isArray(drawIds) ? drawIds[0] : undefined;
|
|
@@ -61341,6 +61726,9 @@ function deleteDrawDefinitions(params) {
|
|
|
61341
61726
|
};
|
|
61342
61727
|
var allowDeletionWithScoresPresent = force ||
|
|
61343
61728
|
((_d = (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCORING]) === null || _c === void 0 ? void 0 : _c.allowDeletionWithScoresPresent) === null || _d === void 0 ? void 0 : _d.drawDefinitions);
|
|
61729
|
+
var publishStatus = (_e = getEventPublishStatus({ event: event })) !== null && _e !== void 0 ? _e : {};
|
|
61730
|
+
var updatedDrawIds = (_g = (_f = publishStatus.drawIds) !== null && _f !== void 0 ? _f : (publishStatus.drawDetails && Object.keys(publishStatus.drawDetails))) !== null && _g !== void 0 ? _g : [];
|
|
61731
|
+
var publishedDrawsDeleted;
|
|
61344
61732
|
var drawIdsWithScoresPresent = [];
|
|
61345
61733
|
var filteredDrawDefinitions = event.drawDefinitions.filter(function (drawDefinition) {
|
|
61346
61734
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -61361,6 +61749,10 @@ function deleteDrawDefinitions(params) {
|
|
|
61361
61749
|
return STRUCTURE_ENTERED_TYPES.includes(entry.entryStatus);
|
|
61362
61750
|
});
|
|
61363
61751
|
}
|
|
61752
|
+
if (updatedDrawIds.includes(drawId_1)) {
|
|
61753
|
+
updatedDrawIds = updatedDrawIds.filter(function (id) { return id !== drawId_1; });
|
|
61754
|
+
publishedDrawsDeleted = true;
|
|
61755
|
+
}
|
|
61364
61756
|
var mainStructure = (_f = (_e = getDrawStructures({
|
|
61365
61757
|
stageSequence: 1,
|
|
61366
61758
|
drawDefinition: drawDefinition,
|
|
@@ -61390,6 +61782,7 @@ function deleteDrawDefinitions(params) {
|
|
|
61390
61782
|
return { positionAssignments: positionAssignments, stageSequence: stageSequence };
|
|
61391
61783
|
})
|
|
61392
61784
|
: undefined;
|
|
61785
|
+
// TODO: conditionally add auditTrail based on policyDefinitions
|
|
61393
61786
|
var audit = {
|
|
61394
61787
|
action: DELETE_DRAW_DEFINITIONS,
|
|
61395
61788
|
payload: {
|
|
@@ -61433,43 +61826,29 @@ function deleteDrawDefinitions(params) {
|
|
|
61433
61826
|
}
|
|
61434
61827
|
// cleanup references to drawId in schedulingProfile extension
|
|
61435
61828
|
checkSchedulingProfile({ tournamentRecord: tournamentRecord });
|
|
61436
|
-
|
|
61437
|
-
|
|
61438
|
-
var publishStatus = (_e = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _e === void 0 ? void 0 : _e[PUBLIC];
|
|
61439
|
-
var publishedDrawsDeleted;
|
|
61440
|
-
var _loop_1 = function (drawId_2) {
|
|
61441
|
-
var _j;
|
|
61442
|
-
var drawPublished = (_f = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.drawIds) === null || _f === void 0 ? void 0 : _f.includes(drawId_2);
|
|
61443
|
-
if (drawPublished) {
|
|
61444
|
-
publishedDrawsDeleted = true;
|
|
61445
|
-
var updatedDrawIds = ((_g = publishStatus.drawIds) === null || _g === void 0 ? void 0 : _g.filter(function (publishedDrawId) { return publishedDrawId !== drawId_2; })) || [];
|
|
61446
|
-
var timeItem_1 = {
|
|
61447
|
-
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
61448
|
-
itemValue: (_j = {},
|
|
61449
|
-
_j[PUBLIC] = {
|
|
61450
|
-
drawIds: updatedDrawIds,
|
|
61451
|
-
},
|
|
61452
|
-
_j),
|
|
61453
|
-
};
|
|
61454
|
-
var result = addEventTimeItem({ event: event, timeItem: timeItem_1 });
|
|
61455
|
-
if (result.error)
|
|
61456
|
-
return { value: { error: result.error } };
|
|
61457
|
-
}
|
|
61458
|
-
};
|
|
61459
|
-
try {
|
|
61460
|
-
for (var drawIds_1 = __values(drawIds), drawIds_1_1 = drawIds_1.next(); !drawIds_1_1.done; drawIds_1_1 = drawIds_1.next()) {
|
|
61461
|
-
var drawId_2 = drawIds_1_1.value;
|
|
61462
|
-
var state_1 = _loop_1(drawId_2);
|
|
61463
|
-
if (typeof state_1 === "object")
|
|
61464
|
-
return state_1.value;
|
|
61465
|
-
}
|
|
61466
|
-
}
|
|
61467
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61468
|
-
finally {
|
|
61829
|
+
if (publishedDrawsDeleted) {
|
|
61830
|
+
var drawDetails = {};
|
|
61469
61831
|
try {
|
|
61470
|
-
|
|
61832
|
+
for (var updatedDrawIds_1 = __values(updatedDrawIds), updatedDrawIds_1_1 = updatedDrawIds_1.next(); !updatedDrawIds_1_1.done; updatedDrawIds_1_1 = updatedDrawIds_1.next()) {
|
|
61833
|
+
var drawId_2 = updatedDrawIds_1_1.value;
|
|
61834
|
+
drawDetails[drawId_2] = (_j = (_h = publishStatus.drawDetails) === null || _h === void 0 ? void 0 : _h[drawId_2]) !== null && _j !== void 0 ? _j : {
|
|
61835
|
+
published: true,
|
|
61836
|
+
};
|
|
61837
|
+
}
|
|
61471
61838
|
}
|
|
61472
|
-
|
|
61839
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61840
|
+
finally {
|
|
61841
|
+
try {
|
|
61842
|
+
if (updatedDrawIds_1_1 && !updatedDrawIds_1_1.done && (_a = updatedDrawIds_1.return)) _a.call(updatedDrawIds_1);
|
|
61843
|
+
}
|
|
61844
|
+
finally { if (e_1) throw e_1.error; }
|
|
61845
|
+
}
|
|
61846
|
+
var result = modifyEventPublishStatus({
|
|
61847
|
+
statusObject: { drawDetails: drawDetails },
|
|
61848
|
+
event: event,
|
|
61849
|
+
});
|
|
61850
|
+
if (result.error)
|
|
61851
|
+
return { error: result.error };
|
|
61473
61852
|
}
|
|
61474
61853
|
if (auditTrail.length) {
|
|
61475
61854
|
addNotice({ topic: AUDIT, payload: auditTrail });
|
|
@@ -61485,9 +61864,14 @@ function deleteDrawDefinitions(params) {
|
|
|
61485
61864
|
});
|
|
61486
61865
|
addDrawDeletionTelemetry({ event: event, deletedDrawsDetail: deletedDrawsDetail, auditData: auditData });
|
|
61487
61866
|
if (autoPublish && publishedDrawsDeleted) {
|
|
61488
|
-
var result = publishEvent({
|
|
61867
|
+
var result = publishEvent({
|
|
61868
|
+
drawIdsToRemove: drawIds,
|
|
61869
|
+
policyDefinitions: policyDefinitions,
|
|
61870
|
+
tournamentRecord: tournamentRecord,
|
|
61871
|
+
event: event,
|
|
61872
|
+
});
|
|
61489
61873
|
if (result.error)
|
|
61490
|
-
|
|
61874
|
+
return __assign(__assign({}, SUCCESS), { info: result.error });
|
|
61491
61875
|
}
|
|
61492
61876
|
return __assign({}, SUCCESS);
|
|
61493
61877
|
}
|
|
@@ -62137,10 +62521,7 @@ function addEvent(_a) {
|
|
|
62137
62521
|
var eventRecord = __assign({ drawDefinitions: [], eventType: TypeEnum.Singles, entries: [], startDate: startDate, endDate: endDate }, event);
|
|
62138
62522
|
if (event.eventType === TypeEnum.Team) {
|
|
62139
62523
|
if (event.tieFormat) {
|
|
62140
|
-
var result = validateTieFormat({
|
|
62141
|
-
tieFormat: event.tieFormat,
|
|
62142
|
-
eventType: event.eventType,
|
|
62143
|
-
});
|
|
62524
|
+
var result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
62144
62525
|
if (result.error)
|
|
62145
62526
|
return result;
|
|
62146
62527
|
}
|
|
@@ -64776,7 +65157,6 @@ function generateDrawDefinition(params) {
|
|
|
64776
65157
|
gender: event === null || event === void 0 ? void 0 : event.gender,
|
|
64777
65158
|
enforceGender: enforceGender,
|
|
64778
65159
|
tieFormat: tieFormat,
|
|
64779
|
-
event: event,
|
|
64780
65160
|
});
|
|
64781
65161
|
if (result.error)
|
|
64782
65162
|
return decorateResult({ result: result, stack: stack });
|
|
@@ -64804,10 +65184,7 @@ function generateDrawDefinition(params) {
|
|
|
64804
65184
|
// there is no need to attach to the drawDefinition
|
|
64805
65185
|
if (!equivalentInScope) {
|
|
64806
65186
|
if (tieFormat) {
|
|
64807
|
-
var result = checkTieFormat({
|
|
64808
|
-
eventType: event.eventType,
|
|
64809
|
-
tieFormat: tieFormat,
|
|
64810
|
-
});
|
|
65187
|
+
var result = checkTieFormat({ tieFormat: tieFormat });
|
|
64811
65188
|
if (result.error)
|
|
64812
65189
|
return decorateResult({ result: result, stack: stack });
|
|
64813
65190
|
drawDefinition.tieFormat = (_13 = result.tieFormat) !== null && _13 !== void 0 ? _13 : tieFormat;
|
|
@@ -65149,7 +65526,7 @@ function generateDrawDefinition(params) {
|
|
|
65149
65526
|
}
|
|
65150
65527
|
drawDefinition.drawName =
|
|
65151
65528
|
(_33 = params.drawName) !== null && _33 !== void 0 ? _33 : (drawType && constantToString(drawType));
|
|
65152
|
-
if (typeof voluntaryConsolation === 'object') {
|
|
65529
|
+
if (typeof voluntaryConsolation === 'object' && drawSize >= 4) {
|
|
65153
65530
|
addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
|
|
65154
65531
|
}
|
|
65155
65532
|
if (addToEvent) {
|
|
@@ -66351,10 +66728,8 @@ function bulkUpdatePublishedEventIds(_a) {
|
|
|
66351
66728
|
if (!eventIdsMap[eventId]) {
|
|
66352
66729
|
eventIdsMap[eventId] = [drawId];
|
|
66353
66730
|
}
|
|
66354
|
-
else {
|
|
66355
|
-
|
|
66356
|
-
eventIdsMap[eventId].push(drawId);
|
|
66357
|
-
}
|
|
66731
|
+
else if (!eventIdsMap[eventId].includes(drawId)) {
|
|
66732
|
+
eventIdsMap[eventId].push(drawId);
|
|
66358
66733
|
}
|
|
66359
66734
|
}
|
|
66360
66735
|
return eventIdsMap;
|
|
@@ -66365,15 +66740,16 @@ function bulkUpdatePublishedEventIds(_a) {
|
|
|
66365
66740
|
});
|
|
66366
66741
|
var publishedEventIds = relevantEvents
|
|
66367
66742
|
.filter(function (event) {
|
|
66368
|
-
var
|
|
66369
|
-
|
|
66370
|
-
event: event,
|
|
66371
|
-
}).timeItem;
|
|
66372
|
-
var pubState = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue;
|
|
66743
|
+
var pubStatus = getEventPublishStatus({ event: event });
|
|
66744
|
+
var _a = pubStatus !== null && pubStatus !== void 0 ? pubStatus : {}, drawDetails = _a.drawDetails, drawIds = _a.drawIds;
|
|
66373
66745
|
var eventId = event.eventId;
|
|
66374
66746
|
var publishedDrawIds = eventIdsMap[eventId].filter(function (drawId) {
|
|
66375
|
-
var
|
|
66376
|
-
|
|
66747
|
+
var keyedDrawIds = drawDetails
|
|
66748
|
+
? Object.keys(pubStatus.drawDetails).filter(function (drawId) {
|
|
66749
|
+
return getDrawPublishStatus({ drawId: drawId, drawDetails: drawDetails });
|
|
66750
|
+
})
|
|
66751
|
+
: [];
|
|
66752
|
+
return (drawIds === null || drawIds === void 0 ? void 0 : drawIds.includes(drawId)) || keyedDrawIds.includes(drawId);
|
|
66377
66753
|
});
|
|
66378
66754
|
return publishedDrawIds.length;
|
|
66379
66755
|
})
|