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
package/dist/index.mjs
CHANGED
|
@@ -1980,7 +1980,22 @@ function isString(obj) {
|
|
|
1980
1980
|
return typeof obj === "string";
|
|
1981
1981
|
}
|
|
1982
1982
|
function isObject(obj) {
|
|
1983
|
-
return typeof obj === "object";
|
|
1983
|
+
return obj !== null && typeof obj === "object";
|
|
1984
|
+
}
|
|
1985
|
+
function objShallowEqual(o1, o2) {
|
|
1986
|
+
if (!isObject(o1) || !isObject(o2))
|
|
1987
|
+
return false;
|
|
1988
|
+
const keys1 = Object.keys(o1);
|
|
1989
|
+
const keys2 = Object.keys(o2);
|
|
1990
|
+
if (keys1.length !== keys2.length) {
|
|
1991
|
+
return false;
|
|
1992
|
+
}
|
|
1993
|
+
for (const key of keys1) {
|
|
1994
|
+
if (o1[key] !== o2[key]) {
|
|
1995
|
+
return false;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
return true;
|
|
1984
1999
|
}
|
|
1985
2000
|
function createMap(objectArray, attribute) {
|
|
1986
2001
|
if (!Array.isArray(objectArray))
|
|
@@ -2404,7 +2419,7 @@ const matchUpFormatCode = {
|
|
|
2404
2419
|
};
|
|
2405
2420
|
|
|
2406
2421
|
function factoryVersion() {
|
|
2407
|
-
return "1.
|
|
2422
|
+
return "1.9.0";
|
|
2408
2423
|
}
|
|
2409
2424
|
|
|
2410
2425
|
function getObjectTieFormat(obj) {
|
|
@@ -2490,34 +2505,6 @@ function decorateResult({
|
|
|
2490
2505
|
return result ?? { success: true };
|
|
2491
2506
|
}
|
|
2492
2507
|
|
|
2493
|
-
const ANY = "ANY";
|
|
2494
|
-
const MALE = "MALE";
|
|
2495
|
-
const MIXED = "MIXED";
|
|
2496
|
-
const OTHER$3 = "OTHER";
|
|
2497
|
-
const FEMALE = "FEMALE";
|
|
2498
|
-
const genderConstants = {
|
|
2499
|
-
ANY,
|
|
2500
|
-
MALE,
|
|
2501
|
-
FEMALE,
|
|
2502
|
-
MIXED,
|
|
2503
|
-
OTHER: OTHER$3
|
|
2504
|
-
};
|
|
2505
|
-
|
|
2506
|
-
const SINGLES_MATCHUP = "SINGLES";
|
|
2507
|
-
const SINGLES$1 = "SINGLES";
|
|
2508
|
-
const DOUBLES_MATCHUP = "DOUBLES";
|
|
2509
|
-
const DOUBLES$1 = "DOUBLES";
|
|
2510
|
-
const TEAM_MATCHUP = "TEAM";
|
|
2511
|
-
const TEAM$2 = "TEAM";
|
|
2512
|
-
const matchUpTypes = {
|
|
2513
|
-
SINGLES_MATCHUP,
|
|
2514
|
-
SINGLES: SINGLES$1,
|
|
2515
|
-
DOUBLES_MATCHUP,
|
|
2516
|
-
DOUBLES: DOUBLES$1,
|
|
2517
|
-
TEAM_MATCHUP,
|
|
2518
|
-
TEAM: TEAM$2
|
|
2519
|
-
};
|
|
2520
|
-
|
|
2521
2508
|
var DrawTypeEnum = /* @__PURE__ */ ((DrawTypeEnum2) => {
|
|
2522
2509
|
DrawTypeEnum2["AdHoc"] = "AD_HOC";
|
|
2523
2510
|
DrawTypeEnum2["Compass"] = "COMPASS";
|
|
@@ -2632,6 +2619,19 @@ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
|
|
|
2632
2619
|
return ParticipantTypeEnum2;
|
|
2633
2620
|
})(ParticipantTypeEnum || {});
|
|
2634
2621
|
|
|
2622
|
+
const ANY = "ANY";
|
|
2623
|
+
const MALE = "MALE";
|
|
2624
|
+
const MIXED = "MIXED";
|
|
2625
|
+
const OTHER$3 = "OTHER";
|
|
2626
|
+
const FEMALE = "FEMALE";
|
|
2627
|
+
const genderConstants = {
|
|
2628
|
+
ANY,
|
|
2629
|
+
MALE,
|
|
2630
|
+
FEMALE,
|
|
2631
|
+
MIXED,
|
|
2632
|
+
OTHER: OTHER$3
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
2635
|
const mixedGenderError = "MIXED events can not contain mixed singles or { gender: ANY } collections";
|
|
2636
2636
|
const anyMixedError = "events with { gender: ANY } can not contain MIXED singles collections";
|
|
2637
2637
|
function tieFormatGenderValidityCheck(params) {
|
|
@@ -2643,8 +2643,7 @@ function tieFormatGenderValidityCheck(params) {
|
|
|
2643
2643
|
context: { gender },
|
|
2644
2644
|
stack
|
|
2645
2645
|
});
|
|
2646
|
-
|
|
2647
|
-
if (referenceGender === MIXED && (eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
2646
|
+
if (referenceGender === MIXED && (gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
2648
2647
|
return decorateResult({
|
|
2649
2648
|
result: { error: INVALID_GENDER, valid: false },
|
|
2650
2649
|
info: mixedGenderError,
|
|
@@ -2932,7 +2931,6 @@ function validateTieFormat(params) {
|
|
|
2932
2931
|
const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
|
|
2933
2932
|
referenceCategory: params.category,
|
|
2934
2933
|
referenceGender: params.gender,
|
|
2935
|
-
eventType: params.eventType,
|
|
2936
2934
|
collectionDefinition,
|
|
2937
2935
|
checkCollectionIds,
|
|
2938
2936
|
checkCategory,
|
|
@@ -2984,7 +2982,6 @@ function validateCollectionDefinition({
|
|
|
2984
2982
|
checkGender = true,
|
|
2985
2983
|
referenceCategory,
|
|
2986
2984
|
referenceGender,
|
|
2987
|
-
eventType,
|
|
2988
2985
|
event
|
|
2989
2986
|
}) {
|
|
2990
2987
|
referenceGender = referenceGender ?? event?.gender;
|
|
@@ -3052,7 +3049,6 @@ function validateCollectionDefinition({
|
|
|
3052
3049
|
}
|
|
3053
3050
|
if (checkGender) {
|
|
3054
3051
|
const result = tieFormatGenderValidityCheck({
|
|
3055
|
-
eventType: eventType ?? event?.eventType,
|
|
3056
3052
|
referenceGender,
|
|
3057
3053
|
matchUpType,
|
|
3058
3054
|
gender
|
|
@@ -3085,12 +3081,10 @@ function validateCollectionDefinition({
|
|
|
3085
3081
|
return { valid: true };
|
|
3086
3082
|
}
|
|
3087
3083
|
function checkTieFormat({
|
|
3088
|
-
tieFormat
|
|
3089
|
-
eventType
|
|
3084
|
+
tieFormat
|
|
3090
3085
|
}) {
|
|
3091
3086
|
const result = validateTieFormat({
|
|
3092
3087
|
checkCollectionIds: false,
|
|
3093
|
-
eventType,
|
|
3094
3088
|
tieFormat
|
|
3095
3089
|
});
|
|
3096
3090
|
if (result.error)
|
|
@@ -3503,6 +3497,21 @@ function calculatePercentages({
|
|
|
3503
3497
|
});
|
|
3504
3498
|
}
|
|
3505
3499
|
|
|
3500
|
+
const SINGLES_MATCHUP = "SINGLES";
|
|
3501
|
+
const SINGLES$1 = "SINGLES";
|
|
3502
|
+
const DOUBLES_MATCHUP = "DOUBLES";
|
|
3503
|
+
const DOUBLES$1 = "DOUBLES";
|
|
3504
|
+
const TEAM_MATCHUP = "TEAM";
|
|
3505
|
+
const TEAM$2 = "TEAM";
|
|
3506
|
+
const matchUpTypes = {
|
|
3507
|
+
SINGLES_MATCHUP,
|
|
3508
|
+
SINGLES: SINGLES$1,
|
|
3509
|
+
DOUBLES_MATCHUP,
|
|
3510
|
+
DOUBLES: DOUBLES$1,
|
|
3511
|
+
TEAM_MATCHUP,
|
|
3512
|
+
TEAM: TEAM$2
|
|
3513
|
+
};
|
|
3514
|
+
|
|
3506
3515
|
function getParticipantResults({
|
|
3507
3516
|
participantIds,
|
|
3508
3517
|
matchUpFormat,
|
|
@@ -4314,6 +4323,7 @@ function tallyParticipantResults({
|
|
|
4314
4323
|
return result;
|
|
4315
4324
|
}
|
|
4316
4325
|
|
|
4326
|
+
const ACTIVE_SUSPENSION = "activeSuspension";
|
|
4317
4327
|
const APPLIED_POLICIES = "appliedPolicies";
|
|
4318
4328
|
const AUDIT_POSITION_ACTIONS = "positionActions";
|
|
4319
4329
|
const CONTEXT = "context";
|
|
@@ -4325,6 +4335,7 @@ const DRAW_DELETIONS = "drawDeletions";
|
|
|
4325
4335
|
const DRAW_PROFILE = "drawProfile";
|
|
4326
4336
|
const ENTRY_PROFILE = "entryProfile";
|
|
4327
4337
|
const EVENT_PROFILE = "eventProfile";
|
|
4338
|
+
const EVENT_WITHDRAWAL_REQUESTS = "eventWithdrawalRequests";
|
|
4328
4339
|
const FACTORY$1 = "factory";
|
|
4329
4340
|
const FLIGHT_PROFILE = "flightProfile";
|
|
4330
4341
|
const GROUPING_ATTRIBUTE = "groupingAttribute";
|
|
@@ -4343,6 +4354,7 @@ const SUB_ORDER = "subOrder";
|
|
|
4343
4354
|
const TALLY = "tally";
|
|
4344
4355
|
const TIE_FORMAT_MODIFICATIONS = "tieFormatModification";
|
|
4345
4356
|
const extensionConstants = {
|
|
4357
|
+
ACTIVE_SUSPENSION,
|
|
4346
4358
|
APPLIED_POLICIES,
|
|
4347
4359
|
AUDIT_POSITION_ACTIONS,
|
|
4348
4360
|
CONTEXT,
|
|
@@ -4356,6 +4368,7 @@ const extensionConstants = {
|
|
|
4356
4368
|
ENTRY_PROFILE,
|
|
4357
4369
|
// used for drawGeneration; not relevant for anonymized tournaments
|
|
4358
4370
|
EVENT_PROFILE,
|
|
4371
|
+
EVENT_WITHDRAWAL_REQUESTS,
|
|
4359
4372
|
FLIGHT_PROFILE,
|
|
4360
4373
|
GROUPING_ATTRIBUTE,
|
|
4361
4374
|
// for generating teams; not relevant for anonymized tournaments
|
|
@@ -6060,8 +6073,10 @@ function getMatchUpScheduleDetails({
|
|
|
6060
6073
|
scheduleVisibilityFilters,
|
|
6061
6074
|
afterRecoveryTimes,
|
|
6062
6075
|
tournamentRecord,
|
|
6076
|
+
usePublishState,
|
|
6063
6077
|
scheduleTiming,
|
|
6064
6078
|
matchUpFormat,
|
|
6079
|
+
publishStatus,
|
|
6065
6080
|
matchUpType,
|
|
6066
6081
|
matchUp,
|
|
6067
6082
|
event
|
|
@@ -6178,15 +6193,36 @@ function getMatchUpScheduleDetails({
|
|
|
6178
6193
|
});
|
|
6179
6194
|
} else {
|
|
6180
6195
|
schedule = definedAttributes({
|
|
6181
|
-
|
|
6196
|
+
milliseconds,
|
|
6182
6197
|
startTime,
|
|
6183
6198
|
endTime,
|
|
6184
|
-
|
|
6199
|
+
time
|
|
6185
6200
|
});
|
|
6186
6201
|
}
|
|
6187
|
-
const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
6188
6202
|
const { scheduledDate } = scheduledMatchUpDate({ matchUp });
|
|
6189
6203
|
const { scheduledTime } = scheduledMatchUpTime({ matchUp });
|
|
6204
|
+
if (usePublishState && publishStatus?.displaySettings?.draws) {
|
|
6205
|
+
const drawSettings = publishStatus.displaySettings.draws;
|
|
6206
|
+
const scheduleDetails = (drawSettings?.[matchUp.drawId] ?? drawSettings?.default)?.scheduleDetails;
|
|
6207
|
+
if (scheduleDetails) {
|
|
6208
|
+
const scheduleAttributes = (scheduleDetails.find(
|
|
6209
|
+
(details) => scheduledDate && details.dates?.includes(scheduledDate)
|
|
6210
|
+
) ?? scheduleDetails.find((details) => !details.dates?.length))?.attributes;
|
|
6211
|
+
if (scheduleAttributes) {
|
|
6212
|
+
const template = Object.assign(
|
|
6213
|
+
{},
|
|
6214
|
+
...Object.keys(schedule).map((key) => ({ [key]: true })),
|
|
6215
|
+
// overwrite with publishStatus attributes
|
|
6216
|
+
scheduleAttributes
|
|
6217
|
+
);
|
|
6218
|
+
schedule = attributeFilter({
|
|
6219
|
+
source: schedule,
|
|
6220
|
+
template
|
|
6221
|
+
});
|
|
6222
|
+
}
|
|
6223
|
+
}
|
|
6224
|
+
}
|
|
6225
|
+
const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
6190
6226
|
const endDate = hasCompletedStatus && (extractDate(endTime) || extractDate(scheduledDate) || extractDate(scheduledTime)) || void 0;
|
|
6191
6227
|
return { schedule, endDate };
|
|
6192
6228
|
}
|
|
@@ -8053,6 +8089,7 @@ function getAllStructureMatchUps({
|
|
|
8053
8089
|
policyDefinitions,
|
|
8054
8090
|
tournamentRecord,
|
|
8055
8091
|
seedAssignments,
|
|
8092
|
+
usePublishState,
|
|
8056
8093
|
contextFilters,
|
|
8057
8094
|
contextContent,
|
|
8058
8095
|
matchUpFilters,
|
|
@@ -8060,6 +8097,7 @@ function getAllStructureMatchUps({
|
|
|
8060
8097
|
scheduleTiming,
|
|
8061
8098
|
contextProfile,
|
|
8062
8099
|
drawDefinition,
|
|
8100
|
+
publishStatus,
|
|
8063
8101
|
context = {},
|
|
8064
8102
|
exitProfiles,
|
|
8065
8103
|
matchUpsMap,
|
|
@@ -8168,6 +8206,8 @@ function getAllStructureMatchUps({
|
|
|
8168
8206
|
roundNamingProfile,
|
|
8169
8207
|
initialRoundOfPlay,
|
|
8170
8208
|
appliedPolicies,
|
|
8209
|
+
usePublishState,
|
|
8210
|
+
publishStatus,
|
|
8171
8211
|
isRoundRobin,
|
|
8172
8212
|
roundProfile,
|
|
8173
8213
|
matchUp,
|
|
@@ -8237,6 +8277,8 @@ function getAllStructureMatchUps({
|
|
|
8237
8277
|
tieDrawPositions,
|
|
8238
8278
|
appliedPolicies: appliedPolicies2,
|
|
8239
8279
|
isCollectionBye,
|
|
8280
|
+
usePublishState: usePublishState2,
|
|
8281
|
+
publishStatus: publishStatus2,
|
|
8240
8282
|
matchUpTieId,
|
|
8241
8283
|
isRoundRobin: isRoundRobin2,
|
|
8242
8284
|
roundProfile: roundProfile2,
|
|
@@ -8262,8 +8304,10 @@ function getAllStructureMatchUps({
|
|
|
8262
8304
|
scheduleVisibilityFilters: scheduleVisibilityFilters2,
|
|
8263
8305
|
afterRecoveryTimes,
|
|
8264
8306
|
tournamentRecord,
|
|
8307
|
+
usePublishState: usePublishState2,
|
|
8265
8308
|
scheduleTiming,
|
|
8266
8309
|
matchUpFormat,
|
|
8310
|
+
publishStatus: publishStatus2,
|
|
8267
8311
|
matchUpType,
|
|
8268
8312
|
matchUp,
|
|
8269
8313
|
event: event2
|
|
@@ -8386,7 +8430,7 @@ function getAllStructureMatchUps({
|
|
|
8386
8430
|
Object.assign(matchUpWithContext, makeDeepCopy({ sides }, true, true));
|
|
8387
8431
|
}
|
|
8388
8432
|
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
8389
|
-
const participantAttributes =
|
|
8433
|
+
const participantAttributes = appliedPolicies2?.[POLICY_TYPE_PARTICIPANT];
|
|
8390
8434
|
const getMappedParticipant = (participantId) => {
|
|
8391
8435
|
const participant = participantMap?.[participantId]?.participant;
|
|
8392
8436
|
return participant && attributeFilter({
|
|
@@ -8502,6 +8546,8 @@ function getAllStructureMatchUps({
|
|
|
8502
8546
|
additionalContext: additionalContext2,
|
|
8503
8547
|
appliedPolicies: appliedPolicies2,
|
|
8504
8548
|
isCollectionBye: isCollectionBye2,
|
|
8549
|
+
usePublishState: usePublishState2,
|
|
8550
|
+
publishStatus: publishStatus2,
|
|
8505
8551
|
matchUpTieId: matchUpTieId2,
|
|
8506
8552
|
isRoundRobin: isRoundRobin2,
|
|
8507
8553
|
roundProfile: roundProfile2,
|
|
@@ -8756,7 +8802,7 @@ function generateTieMatchUpScore(params) {
|
|
|
8756
8802
|
const tieFormat = resolveTieFormat({ matchUp, drawDefinition, structure, event })?.tieFormat || params?.tieFormat;
|
|
8757
8803
|
if (!tieFormat)
|
|
8758
8804
|
return { error: MISSING_TIE_FORMAT };
|
|
8759
|
-
const result = validateTieFormat({ tieFormat
|
|
8805
|
+
const result = validateTieFormat({ tieFormat });
|
|
8760
8806
|
if (result.error)
|
|
8761
8807
|
return result;
|
|
8762
8808
|
const collectionDefinitions = tieFormat?.collectionDefinitions || [];
|
|
@@ -9061,7 +9107,7 @@ function ensureSideLineUps({
|
|
|
9061
9107
|
dualMatchUp,
|
|
9062
9108
|
eventId
|
|
9063
9109
|
}) {
|
|
9064
|
-
if (dualMatchUp
|
|
9110
|
+
if (dualMatchUp) {
|
|
9065
9111
|
if (!inContextDualMatchUp) {
|
|
9066
9112
|
inContextDualMatchUp = findDrawMatchUp({
|
|
9067
9113
|
matchUpId: dualMatchUp.matchUpId,
|
|
@@ -9079,11 +9125,17 @@ function ensureSideLineUps({
|
|
|
9079
9125
|
drawPosition,
|
|
9080
9126
|
sideNumber
|
|
9081
9127
|
}) => ({ drawPosition, sideNumber, displaySideNumber });
|
|
9082
|
-
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((
|
|
9083
|
-
const participantId =
|
|
9128
|
+
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((contextSide) => {
|
|
9129
|
+
const participantId = contextSide.participantId;
|
|
9130
|
+
const referenceLineUp = participantId && lineUps[participantId] || void 0;
|
|
9131
|
+
const { lineUp: noContextLineUp, ...noContextSideDetail } = dualMatchUp.sides?.find(
|
|
9132
|
+
({ sideNumber }) => sideNumber === contextSide.sideNumber
|
|
9133
|
+
) ?? {};
|
|
9134
|
+
const lineUp = noContextLineUp?.length ? noContextLineUp : referenceLineUp;
|
|
9084
9135
|
return {
|
|
9085
|
-
...extractSideDetail(
|
|
9086
|
-
|
|
9136
|
+
...extractSideDetail(contextSide),
|
|
9137
|
+
...noContextSideDetail,
|
|
9138
|
+
lineUp
|
|
9087
9139
|
};
|
|
9088
9140
|
});
|
|
9089
9141
|
modifyMatchUpNotice({
|
|
@@ -9872,11 +9924,13 @@ function getStructureMatchUps({
|
|
|
9872
9924
|
afterRecoveryTimes,
|
|
9873
9925
|
policyDefinitions,
|
|
9874
9926
|
tournamentRecord,
|
|
9927
|
+
usePublishState,
|
|
9875
9928
|
matchUpFilters,
|
|
9876
9929
|
contextFilters,
|
|
9877
9930
|
contextContent,
|
|
9878
9931
|
participantMap,
|
|
9879
9932
|
scheduleTiming,
|
|
9933
|
+
publishStatus,
|
|
9880
9934
|
contextProfile,
|
|
9881
9935
|
drawDefinition,
|
|
9882
9936
|
exitProfiles,
|
|
@@ -9897,13 +9951,15 @@ function getStructureMatchUps({
|
|
|
9897
9951
|
afterRecoveryTimes,
|
|
9898
9952
|
policyDefinitions,
|
|
9899
9953
|
tournamentRecord,
|
|
9900
|
-
|
|
9954
|
+
usePublishState,
|
|
9901
9955
|
matchUpFilters,
|
|
9902
9956
|
contextFilters,
|
|
9903
|
-
contextProfile,
|
|
9904
9957
|
contextContent,
|
|
9905
9958
|
participantMap,
|
|
9906
9959
|
scheduleTiming,
|
|
9960
|
+
publishStatus,
|
|
9961
|
+
contextProfile,
|
|
9962
|
+
drawDefinition,
|
|
9907
9963
|
exitProfiles,
|
|
9908
9964
|
matchUpsMap,
|
|
9909
9965
|
structure,
|
|
@@ -9999,12 +10055,14 @@ function getDrawMatchUps(params) {
|
|
|
9999
10055
|
afterRecoveryTimes,
|
|
10000
10056
|
policyDefinitions,
|
|
10001
10057
|
tournamentRecord,
|
|
10058
|
+
usePublishState,
|
|
10002
10059
|
contextFilters,
|
|
10003
|
-
contextProfile,
|
|
10004
|
-
drawDefinition,
|
|
10005
10060
|
matchUpFilters,
|
|
10006
10061
|
scheduleTiming,
|
|
10007
10062
|
participantMap,
|
|
10063
|
+
publishStatus,
|
|
10064
|
+
contextProfile,
|
|
10065
|
+
drawDefinition,
|
|
10008
10066
|
nextMatchUps,
|
|
10009
10067
|
inContext,
|
|
10010
10068
|
context,
|
|
@@ -10059,9 +10117,11 @@ function getDrawMatchUps(params) {
|
|
|
10059
10117
|
afterRecoveryTimes,
|
|
10060
10118
|
policyDefinitions,
|
|
10061
10119
|
tournamentRecord,
|
|
10120
|
+
usePublishState,
|
|
10121
|
+
contextContent,
|
|
10062
10122
|
participantMap,
|
|
10063
10123
|
scheduleTiming,
|
|
10064
|
-
|
|
10124
|
+
publishStatus,
|
|
10065
10125
|
contextProfile,
|
|
10066
10126
|
drawDefinition,
|
|
10067
10127
|
exitProfiles,
|
|
@@ -15611,44 +15671,6 @@ const fixtures = {
|
|
|
15611
15671
|
flagIOC
|
|
15612
15672
|
};
|
|
15613
15673
|
|
|
15614
|
-
function addNationalityCode({
|
|
15615
|
-
participant,
|
|
15616
|
-
withISO2,
|
|
15617
|
-
withIOC
|
|
15618
|
-
}) {
|
|
15619
|
-
const { person, individualParticipants } = participant;
|
|
15620
|
-
const persons = [person, individualParticipants?.map(({ person: person2 }) => person2)].flat().filter(Boolean);
|
|
15621
|
-
function annotatePerson(person2) {
|
|
15622
|
-
const { nationalityCode } = person2 || {};
|
|
15623
|
-
if (nationalityCode) {
|
|
15624
|
-
const country = countries.find(({ iso }) => iso === nationalityCode);
|
|
15625
|
-
if (withIOC && country?.ioc && !person2.iocNationalityCode)
|
|
15626
|
-
person2.iocNationalityCode = country.ioc;
|
|
15627
|
-
if (withISO2 && country?.iso2 && !person2.iso2NationalityCode)
|
|
15628
|
-
person2.iso2NationalityCode = country.iso2;
|
|
15629
|
-
if (country?.label && !person2.countryName)
|
|
15630
|
-
person2.countryName = country.label;
|
|
15631
|
-
}
|
|
15632
|
-
}
|
|
15633
|
-
persons.forEach(annotatePerson);
|
|
15634
|
-
}
|
|
15635
|
-
|
|
15636
|
-
function addIndividualParticipants({ participantMap, template }) {
|
|
15637
|
-
const participantObjects = Object.values(participantMap);
|
|
15638
|
-
for (const participantObject of participantObjects) {
|
|
15639
|
-
const participant = participantObject.participant;
|
|
15640
|
-
if (participant.individualParticipantIds?.length) {
|
|
15641
|
-
participant.individualParticipants = [];
|
|
15642
|
-
for (const participantId of participant.individualParticipantIds) {
|
|
15643
|
-
const source = participantMap[participantId].participant;
|
|
15644
|
-
participant.individualParticipants.push(
|
|
15645
|
-
template ? attributeFilter({ template, source }) : source
|
|
15646
|
-
);
|
|
15647
|
-
}
|
|
15648
|
-
}
|
|
15649
|
-
}
|
|
15650
|
-
}
|
|
15651
|
-
|
|
15652
15674
|
function getTimeItem({
|
|
15653
15675
|
returnPreviousValues,
|
|
15654
15676
|
itemSubTypes,
|
|
@@ -15760,6 +15782,52 @@ function getParticipantTimeItem({
|
|
|
15760
15782
|
return timeItem && { timeItem, previousItems } || { info };
|
|
15761
15783
|
}
|
|
15762
15784
|
|
|
15785
|
+
function getEventPublishStatus({ event, status = PUBLIC }) {
|
|
15786
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
15787
|
+
return getEventTimeItem({
|
|
15788
|
+
itemType,
|
|
15789
|
+
event
|
|
15790
|
+
})?.timeItem?.itemValue?.[status];
|
|
15791
|
+
}
|
|
15792
|
+
|
|
15793
|
+
function addNationalityCode({
|
|
15794
|
+
participant,
|
|
15795
|
+
withISO2,
|
|
15796
|
+
withIOC
|
|
15797
|
+
}) {
|
|
15798
|
+
const { person, individualParticipants } = participant;
|
|
15799
|
+
const persons = [person, individualParticipants?.map(({ person: person2 }) => person2)].flat().filter(Boolean);
|
|
15800
|
+
function annotatePerson(person2) {
|
|
15801
|
+
const { nationalityCode } = person2 || {};
|
|
15802
|
+
if (nationalityCode) {
|
|
15803
|
+
const country = countries.find(({ iso }) => iso === nationalityCode);
|
|
15804
|
+
if (withIOC && country?.ioc && !person2.iocNationalityCode)
|
|
15805
|
+
person2.iocNationalityCode = country.ioc;
|
|
15806
|
+
if (withISO2 && country?.iso2 && !person2.iso2NationalityCode)
|
|
15807
|
+
person2.iso2NationalityCode = country.iso2;
|
|
15808
|
+
if (country?.label && !person2.countryName)
|
|
15809
|
+
person2.countryName = country.label;
|
|
15810
|
+
}
|
|
15811
|
+
}
|
|
15812
|
+
persons.forEach(annotatePerson);
|
|
15813
|
+
}
|
|
15814
|
+
|
|
15815
|
+
function addIndividualParticipants({ participantMap, template }) {
|
|
15816
|
+
const participantObjects = Object.values(participantMap);
|
|
15817
|
+
for (const participantObject of participantObjects) {
|
|
15818
|
+
const participant = participantObject.participant;
|
|
15819
|
+
if (participant.individualParticipantIds?.length) {
|
|
15820
|
+
participant.individualParticipants = [];
|
|
15821
|
+
for (const participantId of participant.individualParticipantIds) {
|
|
15822
|
+
const source = participantMap[participantId].participant;
|
|
15823
|
+
participant.individualParticipants.push(
|
|
15824
|
+
template ? attributeFilter({ template, source }) : source
|
|
15825
|
+
);
|
|
15826
|
+
}
|
|
15827
|
+
}
|
|
15828
|
+
}
|
|
15829
|
+
}
|
|
15830
|
+
|
|
15763
15831
|
const typeMap = {
|
|
15764
15832
|
[GROUP]: "groupParticipantIds",
|
|
15765
15833
|
[PAIR]: "pairParticipantIds",
|
|
@@ -16200,9 +16268,10 @@ function tournamentMatchUps(params) {
|
|
|
16200
16268
|
useParticipantMap,
|
|
16201
16269
|
tournamentRecord,
|
|
16202
16270
|
inContext = true,
|
|
16271
|
+
usePublishState,
|
|
16203
16272
|
contextFilters,
|
|
16204
|
-
contextProfile,
|
|
16205
16273
|
matchUpFilters,
|
|
16274
|
+
contextProfile,
|
|
16206
16275
|
nextMatchUps,
|
|
16207
16276
|
context
|
|
16208
16277
|
} = params;
|
|
@@ -16240,6 +16309,7 @@ function tournamentMatchUps(params) {
|
|
|
16240
16309
|
afterRecoveryTimes,
|
|
16241
16310
|
policyDefinitions,
|
|
16242
16311
|
tournamentRecord,
|
|
16312
|
+
usePublishState,
|
|
16243
16313
|
contextFilters,
|
|
16244
16314
|
contextProfile,
|
|
16245
16315
|
contextContent,
|
|
@@ -16285,9 +16355,10 @@ function eventMatchUps(params) {
|
|
|
16285
16355
|
policyDefinitions,
|
|
16286
16356
|
useParticipantMap,
|
|
16287
16357
|
tournamentRecord,
|
|
16358
|
+
usePublishState,
|
|
16288
16359
|
contextFilters,
|
|
16289
|
-
contextProfile,
|
|
16290
16360
|
matchUpFilters,
|
|
16361
|
+
contextProfile,
|
|
16291
16362
|
nextMatchUps,
|
|
16292
16363
|
tournamentId,
|
|
16293
16364
|
inContext,
|
|
@@ -16330,6 +16401,7 @@ function eventMatchUps(params) {
|
|
|
16330
16401
|
contextProfile,
|
|
16331
16402
|
event
|
|
16332
16403
|
});
|
|
16404
|
+
const publishStatus = getEventPublishStatus({ event });
|
|
16333
16405
|
const drawDefinitions = event.drawDefinitions ?? [];
|
|
16334
16406
|
const eventResult = drawDefinitions.reduce((results, drawDefinition) => {
|
|
16335
16407
|
const drawMatchUpsResult = getDrawMatchUps({
|
|
@@ -16341,12 +16413,14 @@ function eventMatchUps(params) {
|
|
|
16341
16413
|
afterRecoveryTimes,
|
|
16342
16414
|
policyDefinitions,
|
|
16343
16415
|
tournamentRecord,
|
|
16344
|
-
|
|
16416
|
+
usePublishState,
|
|
16345
16417
|
contextContent,
|
|
16346
16418
|
contextFilters,
|
|
16347
|
-
contextProfile,
|
|
16348
16419
|
matchUpFilters,
|
|
16349
16420
|
participantMap,
|
|
16421
|
+
publishStatus,
|
|
16422
|
+
contextProfile,
|
|
16423
|
+
drawDefinition,
|
|
16350
16424
|
nextMatchUps,
|
|
16351
16425
|
inContext,
|
|
16352
16426
|
event
|
|
@@ -16372,12 +16446,14 @@ function drawMatchUps$1({
|
|
|
16372
16446
|
policyDefinitions,
|
|
16373
16447
|
useParticipantMap,
|
|
16374
16448
|
tournamentRecord,
|
|
16449
|
+
usePublishState,
|
|
16375
16450
|
contextFilters,
|
|
16376
|
-
contextProfile,
|
|
16377
16451
|
contextContent,
|
|
16378
|
-
drawDefinition,
|
|
16379
16452
|
matchUpFilters,
|
|
16380
16453
|
participantMap,
|
|
16454
|
+
publishStatus,
|
|
16455
|
+
contextProfile,
|
|
16456
|
+
drawDefinition,
|
|
16381
16457
|
nextMatchUps,
|
|
16382
16458
|
tournamentId,
|
|
16383
16459
|
inContext,
|
|
@@ -16428,12 +16504,14 @@ function drawMatchUps$1({
|
|
|
16428
16504
|
afterRecoveryTimes,
|
|
16429
16505
|
policyDefinitions,
|
|
16430
16506
|
tournamentRecord,
|
|
16507
|
+
usePublishState,
|
|
16431
16508
|
participantMap,
|
|
16432
|
-
|
|
16433
|
-
matchUpFilters,
|
|
16509
|
+
contextContent,
|
|
16434
16510
|
contextFilters,
|
|
16511
|
+
matchUpFilters,
|
|
16512
|
+
publishStatus,
|
|
16435
16513
|
contextProfile,
|
|
16436
|
-
|
|
16514
|
+
drawDefinition,
|
|
16437
16515
|
nextMatchUps,
|
|
16438
16516
|
inContext,
|
|
16439
16517
|
event
|
|
@@ -17139,6 +17217,7 @@ function competitionMatchUps({
|
|
|
17139
17217
|
participantsProfile,
|
|
17140
17218
|
tournamentRecords,
|
|
17141
17219
|
policyDefinitions,
|
|
17220
|
+
usePublishState,
|
|
17142
17221
|
matchUpFilters,
|
|
17143
17222
|
contextFilters,
|
|
17144
17223
|
nextMatchUps,
|
|
@@ -17154,6 +17233,7 @@ function competitionMatchUps({
|
|
|
17154
17233
|
participantsProfile,
|
|
17155
17234
|
policyDefinitions,
|
|
17156
17235
|
tournamentRecord,
|
|
17236
|
+
usePublishState,
|
|
17157
17237
|
matchUpFilters,
|
|
17158
17238
|
contextFilters,
|
|
17159
17239
|
nextMatchUps,
|
|
@@ -22546,6 +22626,11 @@ function getMatchUpDailyLimits({
|
|
|
22546
22626
|
return { matchUpDailyLimits: dailyLimits };
|
|
22547
22627
|
}
|
|
22548
22628
|
|
|
22629
|
+
function getDrawPublishStatus({ drawDetails, drawId }) {
|
|
22630
|
+
const details = drawDetails?.[drawId]?.publishingDetail;
|
|
22631
|
+
return details?.published;
|
|
22632
|
+
}
|
|
22633
|
+
|
|
22549
22634
|
function scheduledSortedMatchUps({
|
|
22550
22635
|
schedulingProfile,
|
|
22551
22636
|
matchUps = []
|
|
@@ -22670,11 +22755,10 @@ function competitionScheduleMatchUps(params) {
|
|
|
22670
22755
|
status = PUBLIC,
|
|
22671
22756
|
sortCourtsData
|
|
22672
22757
|
} = params;
|
|
22673
|
-
const
|
|
22758
|
+
const tournamentPublishStatus = usePublishState ? getTournamentTimeItem({
|
|
22674
22759
|
tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId()],
|
|
22675
22760
|
itemType: `${PUBLISH}.${STATUS$1}`
|
|
22676
|
-
}).timeItem : void 0;
|
|
22677
|
-
const publishStatus = timeItem?.itemValue?.[status];
|
|
22761
|
+
}).timeItem?.itemValue?.[status] : void 0;
|
|
22678
22762
|
const allCompletedMatchUps = alwaysReturnCompleted ? competitionMatchUps({
|
|
22679
22763
|
...params,
|
|
22680
22764
|
matchUpFilters: {
|
|
@@ -22683,7 +22767,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
22683
22767
|
},
|
|
22684
22768
|
contextFilters: params.contextFilters
|
|
22685
22769
|
}).completedMatchUps : [];
|
|
22686
|
-
if (usePublishState && (!
|
|
22770
|
+
if (usePublishState && (!tournamentPublishStatus || !Object.keys(tournamentPublishStatus).length)) {
|
|
22687
22771
|
return {
|
|
22688
22772
|
completedMatchUps: allCompletedMatchUps,
|
|
22689
22773
|
dateMatchUps: [],
|
|
@@ -22691,7 +22775,12 @@ function competitionScheduleMatchUps(params) {
|
|
|
22691
22775
|
venues
|
|
22692
22776
|
};
|
|
22693
22777
|
}
|
|
22694
|
-
|
|
22778
|
+
let publishedDrawIds, detailsMap;
|
|
22779
|
+
if (usePublishState) {
|
|
22780
|
+
({ drawIds: publishedDrawIds, detailsMap } = getCompetitionPublishedDrawDetails({
|
|
22781
|
+
tournamentRecords
|
|
22782
|
+
}));
|
|
22783
|
+
}
|
|
22695
22784
|
if (publishedDrawIds?.length) {
|
|
22696
22785
|
if (!params.contextFilters)
|
|
22697
22786
|
params.contextFilters = {};
|
|
@@ -22703,34 +22792,34 @@ function competitionScheduleMatchUps(params) {
|
|
|
22703
22792
|
);
|
|
22704
22793
|
}
|
|
22705
22794
|
}
|
|
22706
|
-
if (
|
|
22795
|
+
if (tournamentPublishStatus?.eventIds?.length) {
|
|
22707
22796
|
if (!params.matchUpFilters)
|
|
22708
22797
|
params.matchUpFilters = {};
|
|
22709
22798
|
if (params.matchUpFilters?.eventIds) {
|
|
22710
22799
|
if (!params.matchUpFilters.eventIds.length) {
|
|
22711
|
-
params.matchUpFilters.eventIds =
|
|
22800
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
22712
22801
|
} else {
|
|
22713
22802
|
params.matchUpFilters.eventIds = params.matchUpFilters.eventIds.filter(
|
|
22714
|
-
(eventId) =>
|
|
22803
|
+
(eventId) => tournamentPublishStatus.eventIds.includes(eventId)
|
|
22715
22804
|
);
|
|
22716
22805
|
}
|
|
22717
22806
|
} else {
|
|
22718
|
-
params.matchUpFilters.eventIds =
|
|
22807
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
22719
22808
|
}
|
|
22720
22809
|
}
|
|
22721
|
-
if (
|
|
22810
|
+
if (tournamentPublishStatus?.scheduledDates?.length) {
|
|
22722
22811
|
if (!params.matchUpFilters)
|
|
22723
22812
|
params.matchUpFilters = {};
|
|
22724
22813
|
if (params.matchUpFilters.scheduledDates) {
|
|
22725
22814
|
if (!params.matchUpFilters.scheduledDates.length) {
|
|
22726
|
-
params.matchUpFilters.scheduledDates =
|
|
22815
|
+
params.matchUpFilters.scheduledDates = tournamentPublishStatus.scheduledDates;
|
|
22727
22816
|
} else {
|
|
22728
22817
|
params.matchUpFilters.scheduledDates = params.matchUpFilters.scheduledDates.filter(
|
|
22729
|
-
(scheduledDate) =>
|
|
22818
|
+
(scheduledDate) => tournamentPublishStatus.scheduledDates.includes(scheduledDate)
|
|
22730
22819
|
);
|
|
22731
22820
|
}
|
|
22732
22821
|
} else {
|
|
22733
|
-
params.matchUpFilters.scheduledDates =
|
|
22822
|
+
params.matchUpFilters.scheduledDates = tournamentPublishStatus.scheduledDates;
|
|
22734
22823
|
}
|
|
22735
22824
|
}
|
|
22736
22825
|
if (alwaysReturnCompleted) {
|
|
@@ -22749,10 +22838,48 @@ function competitionScheduleMatchUps(params) {
|
|
|
22749
22838
|
matchUpFilters: params.matchUpFilters,
|
|
22750
22839
|
contextFilters: params.contextFilters
|
|
22751
22840
|
});
|
|
22752
|
-
|
|
22841
|
+
let relevantMatchUps = [
|
|
22753
22842
|
...upcomingMatchUps ?? [],
|
|
22754
22843
|
...pendingMatchUps ?? []
|
|
22755
22844
|
];
|
|
22845
|
+
if (detailsMap && Object.keys(detailsMap).length) {
|
|
22846
|
+
relevantMatchUps = relevantMatchUps.filter((matchUp) => {
|
|
22847
|
+
const { drawId, structureId, stage } = matchUp;
|
|
22848
|
+
if (!detailsMap[drawId])
|
|
22849
|
+
return false;
|
|
22850
|
+
if (detailsMap[drawId].stageDetails) {
|
|
22851
|
+
const stageKeys = Object.keys(detailsMap[drawId].stageDetails);
|
|
22852
|
+
const unpublishedStages = stageKeys.filter(
|
|
22853
|
+
(stage2) => !detailsMap[drawId].stageDetails[stage2].published
|
|
22854
|
+
);
|
|
22855
|
+
const publishedStages = stageKeys.filter(
|
|
22856
|
+
(stage2) => detailsMap[drawId].stageDetails[stage2].published
|
|
22857
|
+
);
|
|
22858
|
+
if (unpublishedStages.length && unpublishedStages.includes(stage))
|
|
22859
|
+
return false;
|
|
22860
|
+
if (publishedStages.length && publishedStages.includes(stage))
|
|
22861
|
+
return true;
|
|
22862
|
+
return unpublishedStages.length && !unpublishedStages.includes(stage) && !publishedStages.length;
|
|
22863
|
+
}
|
|
22864
|
+
if (detailsMap[drawId].structureDetails) {
|
|
22865
|
+
const structureIdKeys = Object.keys(
|
|
22866
|
+
detailsMap[drawId].structureDetails
|
|
22867
|
+
);
|
|
22868
|
+
const unpublishedStructureIds = structureIdKeys.filter(
|
|
22869
|
+
(structureId2) => !detailsMap[drawId].structureDetails[structureId2].published
|
|
22870
|
+
);
|
|
22871
|
+
const publishedStructureIds = structureIdKeys.filter(
|
|
22872
|
+
(structureId2) => detailsMap[drawId].structureDetails[structureId2].published
|
|
22873
|
+
);
|
|
22874
|
+
if (unpublishedStructureIds.length && unpublishedStructureIds.includes(structureId))
|
|
22875
|
+
return false;
|
|
22876
|
+
if (publishedStructureIds.length && publishedStructureIds.includes(structureId))
|
|
22877
|
+
return true;
|
|
22878
|
+
return unpublishedStructureIds.length && !unpublishedStructureIds.includes(structureId) && !publishedStructureIds.length;
|
|
22879
|
+
}
|
|
22880
|
+
return true;
|
|
22881
|
+
});
|
|
22882
|
+
}
|
|
22756
22883
|
const dateMatchUps = sortDateMatchUps ? scheduledSortedMatchUps({ matchUps: relevantMatchUps, schedulingProfile }) : relevantMatchUps;
|
|
22757
22884
|
const courtsData = courts?.map((court) => {
|
|
22758
22885
|
const matchUps = getCourtMatchUps(court);
|
|
@@ -22763,11 +22890,11 @@ function competitionScheduleMatchUps(params) {
|
|
|
22763
22890
|
};
|
|
22764
22891
|
});
|
|
22765
22892
|
const result = {
|
|
22766
|
-
courtsData,
|
|
22767
22893
|
completedMatchUps: alwaysReturnCompleted ? allCompletedMatchUps : completedMatchUps,
|
|
22768
22894
|
// completed matchUps for the filter date
|
|
22769
22895
|
dateMatchUps,
|
|
22770
22896
|
// all incomplete matchUps for the filter date
|
|
22897
|
+
courtsData,
|
|
22771
22898
|
groupInfo,
|
|
22772
22899
|
venues
|
|
22773
22900
|
};
|
|
@@ -22791,26 +22918,28 @@ function competitionScheduleMatchUps(params) {
|
|
|
22791
22918
|
}) : courtMatchUps;
|
|
22792
22919
|
}
|
|
22793
22920
|
}
|
|
22794
|
-
function
|
|
22921
|
+
function getCompetitionPublishedDrawDetails({
|
|
22795
22922
|
tournamentRecords
|
|
22796
22923
|
}) {
|
|
22797
22924
|
const drawIds = [];
|
|
22925
|
+
const detailsMap = {};
|
|
22798
22926
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
22799
22927
|
for (const event of tournamentRecord.events ?? []) {
|
|
22800
|
-
const
|
|
22801
|
-
|
|
22802
|
-
|
|
22803
|
-
|
|
22804
|
-
|
|
22805
|
-
|
|
22806
|
-
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22928
|
+
const eventPubStatus = getEventPublishStatus({ event });
|
|
22929
|
+
const drawDetails = eventPubStatus?.drawDetails;
|
|
22930
|
+
if (isObject(drawDetails)) {
|
|
22931
|
+
Object.assign(detailsMap, drawDetails);
|
|
22932
|
+
drawIds.push(
|
|
22933
|
+
...Object.keys(drawDetails).filter(
|
|
22934
|
+
(drawId) => getDrawPublishStatus({ drawId, drawDetails })
|
|
22935
|
+
)
|
|
22936
|
+
);
|
|
22937
|
+
} else if (eventPubStatus?.drawIds?.length) {
|
|
22938
|
+
drawIds.push(...eventPubStatus.drawIds);
|
|
22810
22939
|
}
|
|
22811
22940
|
}
|
|
22812
22941
|
}
|
|
22813
|
-
return { drawIds };
|
|
22942
|
+
return { drawIds, detailsMap };
|
|
22814
22943
|
}
|
|
22815
22944
|
|
|
22816
22945
|
const { stageOrder } = drawDefinitionConstants;
|
|
@@ -23129,13 +23258,8 @@ function getEventEntries({ eventEntryStatuses, tournamentEvents }) {
|
|
|
23129
23258
|
}
|
|
23130
23259
|
|
|
23131
23260
|
function getEventPublishStatuses({ event }) {
|
|
23132
|
-
const
|
|
23133
|
-
|
|
23134
|
-
element: event,
|
|
23135
|
-
itemType
|
|
23136
|
-
});
|
|
23137
|
-
if (timeItem?.itemValue?.PUBLIC) {
|
|
23138
|
-
const { drawIds: publishedDrawIds = [], seeding } = timeItem.itemValue.PUBLIC || {};
|
|
23261
|
+
const eventPubStatus = getEventPublishStatus({ event });
|
|
23262
|
+
if (eventPubStatus) {
|
|
23139
23263
|
const publishedSeeding = {
|
|
23140
23264
|
published: void 0,
|
|
23141
23265
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
@@ -23143,9 +23267,13 @@ function getEventPublishStatuses({ event }) {
|
|
|
23143
23267
|
drawIds: []
|
|
23144
23268
|
// seeding can be specific to drawIds
|
|
23145
23269
|
};
|
|
23146
|
-
if (seeding) {
|
|
23147
|
-
Object.assign(publishedSeeding,
|
|
23270
|
+
if (eventPubStatus.seeding) {
|
|
23271
|
+
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
23148
23272
|
}
|
|
23273
|
+
const { drawDetails, drawIds } = eventPubStatus;
|
|
23274
|
+
const publishedDrawIds = drawDetails && Object.keys(drawDetails).filter(
|
|
23275
|
+
(drawId) => getDrawPublishStatus({ drawDetails, drawId })
|
|
23276
|
+
) || drawIds || [];
|
|
23149
23277
|
return {
|
|
23150
23278
|
publishedDrawIds,
|
|
23151
23279
|
publishedSeeding
|
|
@@ -23861,6 +23989,15 @@ function getParticipantEntries(params) {
|
|
|
23861
23989
|
individualParticipantIds?.forEach(addDrawEntry);
|
|
23862
23990
|
}
|
|
23863
23991
|
}
|
|
23992
|
+
const stages = (drawDefinition?.structures ?? []).reduce(
|
|
23993
|
+
(stages2, structure) => {
|
|
23994
|
+
if (!stages2.includes(structure.stage))
|
|
23995
|
+
stages2.push(structure.stage);
|
|
23996
|
+
return stages2;
|
|
23997
|
+
},
|
|
23998
|
+
[]
|
|
23999
|
+
);
|
|
24000
|
+
const linksCount = (drawDefinition?.links ?? []).length;
|
|
23864
24001
|
derivedDrawInfo[drawId] = {
|
|
23865
24002
|
qualifyingPositionAssignments,
|
|
23866
24003
|
qualifyingSeedAssignments,
|
|
@@ -23870,11 +24007,13 @@ function getParticipantEntries(params) {
|
|
|
23870
24007
|
orderedStructureIds,
|
|
23871
24008
|
mainSeedingMap,
|
|
23872
24009
|
flightNumber,
|
|
24010
|
+
linksCount,
|
|
23873
24011
|
drawOrder,
|
|
23874
24012
|
drawName,
|
|
23875
24013
|
drawType,
|
|
23876
24014
|
drawSize,
|
|
23877
|
-
drawId
|
|
24015
|
+
drawId,
|
|
24016
|
+
stages
|
|
23878
24017
|
// qualifyingDrawSize,
|
|
23879
24018
|
};
|
|
23880
24019
|
}
|
|
@@ -24091,7 +24230,7 @@ function getParticipantEntries(params) {
|
|
|
24091
24230
|
const itemIsPrior = consideredMinutes >= scheduledMinutes;
|
|
24092
24231
|
const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
|
|
24093
24232
|
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
24094
|
-
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
|
|
24233
|
+
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join("|");
|
|
24095
24234
|
participantAggregator.scheduleConflicts[key] = {
|
|
24096
24235
|
priorScheduledMatchUpId: scheduleItem.matchUpId,
|
|
24097
24236
|
matchUpIdWithConflict: consideredItem.matchUpId
|
|
@@ -26057,7 +26196,9 @@ function getDrawData(params) {
|
|
|
26057
26196
|
policyDefinitions,
|
|
26058
26197
|
tournamentRecord,
|
|
26059
26198
|
inContext = true,
|
|
26199
|
+
usePublishState,
|
|
26060
26200
|
drawDefinition,
|
|
26201
|
+
publishStatus,
|
|
26061
26202
|
noDeepCopy,
|
|
26062
26203
|
sortConfig,
|
|
26063
26204
|
context,
|
|
@@ -26129,6 +26270,8 @@ function getDrawData(params) {
|
|
|
26129
26270
|
tournamentParticipants,
|
|
26130
26271
|
policyDefinitions,
|
|
26131
26272
|
tournamentRecord,
|
|
26273
|
+
usePublishState,
|
|
26274
|
+
publishStatus,
|
|
26132
26275
|
drawDefinition,
|
|
26133
26276
|
inContext,
|
|
26134
26277
|
structure,
|
|
@@ -26242,11 +26385,7 @@ function getEventData(params) {
|
|
|
26242
26385
|
return { error: MISSING_EVENT };
|
|
26243
26386
|
const { eventId } = event;
|
|
26244
26387
|
const { tournamentId, endDate } = tournamentRecord;
|
|
26245
|
-
const
|
|
26246
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
26247
|
-
event
|
|
26248
|
-
});
|
|
26249
|
-
const publishStatus = timeItem?.itemValue?.[status];
|
|
26388
|
+
const publishStatus = getEventPublishStatus({ event, status });
|
|
26250
26389
|
const { participants: tournamentParticipants } = getParticipants$1({
|
|
26251
26390
|
withGroupings: true,
|
|
26252
26391
|
withEvents: false,
|
|
@@ -26255,9 +26394,51 @@ function getEventData(params) {
|
|
|
26255
26394
|
// order is important!!
|
|
26256
26395
|
tournamentRecord
|
|
26257
26396
|
});
|
|
26258
|
-
const stageFilter = ({ stage }) =>
|
|
26259
|
-
|
|
26260
|
-
|
|
26397
|
+
const stageFilter = ({ stage, drawId }) => {
|
|
26398
|
+
if (!usePublishState)
|
|
26399
|
+
return true;
|
|
26400
|
+
const stageDetails = publishStatus?.drawDetails?.[drawId]?.stageDetails;
|
|
26401
|
+
if (!stageDetails || !Object.keys(stageDetails).length)
|
|
26402
|
+
return true;
|
|
26403
|
+
return stageDetails[stage]?.published;
|
|
26404
|
+
};
|
|
26405
|
+
const structureFilter = ({ structureId, drawId }) => {
|
|
26406
|
+
if (!usePublishState)
|
|
26407
|
+
return true;
|
|
26408
|
+
const structureDetails = publishStatus?.drawDetails?.[drawId]?.structureDetails;
|
|
26409
|
+
if (!structureDetails || !Object.keys(structureDetails).length)
|
|
26410
|
+
return true;
|
|
26411
|
+
return structureDetails[structureId]?.published;
|
|
26412
|
+
};
|
|
26413
|
+
const drawFilter = ({ drawId }) => {
|
|
26414
|
+
if (!usePublishState)
|
|
26415
|
+
return true;
|
|
26416
|
+
if (publishStatus.drawDetails) {
|
|
26417
|
+
return publishStatus.drawDetails[drawId]?.publishingDetail?.published;
|
|
26418
|
+
} else if (publishStatus.drawIds) {
|
|
26419
|
+
return publishStatus.drawIds.includes(drawId);
|
|
26420
|
+
}
|
|
26421
|
+
return true;
|
|
26422
|
+
};
|
|
26423
|
+
const roundLimitMapper = ({ drawId, structure }) => {
|
|
26424
|
+
if (!usePublishState)
|
|
26425
|
+
return structure;
|
|
26426
|
+
const roundLimit = publishStatus?.drawDetails?.[drawId]?.structureDetails?.[structure.structureId]?.roundLimit;
|
|
26427
|
+
if (isConvertableInteger(roundLimit)) {
|
|
26428
|
+
const roundNumbers = generateRange(1, roundLimit + 1);
|
|
26429
|
+
const roundMatchUps = {};
|
|
26430
|
+
const roundProfile = {};
|
|
26431
|
+
for (const roundNumber of roundNumbers) {
|
|
26432
|
+
if (structure.roundMatchUps[roundNumber]) {
|
|
26433
|
+
roundMatchUps[roundNumber] = structure.roundMatchUps[roundNumber];
|
|
26434
|
+
roundProfile[roundNumber] = structure.roundProfile[roundNumber];
|
|
26435
|
+
}
|
|
26436
|
+
}
|
|
26437
|
+
structure.roundMatchUps = roundMatchUps;
|
|
26438
|
+
structure.roundProfile = roundProfile;
|
|
26439
|
+
}
|
|
26440
|
+
return structure;
|
|
26441
|
+
};
|
|
26261
26442
|
const drawDefinitions = event.drawDefinitions || [];
|
|
26262
26443
|
const drawsData = drawDefinitions.filter(drawFilter).map(
|
|
26263
26444
|
(drawDefinition) => (({ drawInfo, structures }) => ({
|
|
@@ -26271,15 +26452,24 @@ function getEventData(params) {
|
|
|
26271
26452
|
noDeepCopy: true,
|
|
26272
26453
|
policyDefinitions,
|
|
26273
26454
|
tournamentRecord,
|
|
26455
|
+
usePublishState,
|
|
26274
26456
|
drawDefinition,
|
|
26457
|
+
publishStatus,
|
|
26275
26458
|
sortConfig,
|
|
26276
26459
|
event
|
|
26277
26460
|
})
|
|
26278
26461
|
)
|
|
26279
|
-
).map(({ structures, ...drawData }) =>
|
|
26280
|
-
|
|
26281
|
-
|
|
26282
|
-
|
|
26462
|
+
).map(({ structures, ...drawData }) => {
|
|
26463
|
+
const filteredStructures = structures?.filter(
|
|
26464
|
+
({ stage, structureId }) => structureFilter({ structureId, drawId: drawData.drawId }) && stageFilter({ stage, drawId: drawData.drawId })
|
|
26465
|
+
).map(
|
|
26466
|
+
(structure) => roundLimitMapper({ drawId: drawData.drawId, structure })
|
|
26467
|
+
);
|
|
26468
|
+
return {
|
|
26469
|
+
...drawData,
|
|
26470
|
+
structures: filteredStructures
|
|
26471
|
+
};
|
|
26472
|
+
}).filter((drawData) => drawData.structures?.length);
|
|
26283
26473
|
const { tournamentInfo } = getTournamentInfo({ tournamentRecord });
|
|
26284
26474
|
const venues = tournamentRecord.venues || [];
|
|
26285
26475
|
const venuesData = venues.map(
|
|
@@ -26325,10 +26515,7 @@ function getEventData(params) {
|
|
|
26325
26515
|
eventInfo,
|
|
26326
26516
|
drawsData
|
|
26327
26517
|
};
|
|
26328
|
-
eventData.eventInfo.publish =
|
|
26329
|
-
createdAt: timeItem?.createdAt,
|
|
26330
|
-
state: timeItem?.itemValue
|
|
26331
|
-
};
|
|
26518
|
+
eventData.eventInfo.publish = publishStatus;
|
|
26332
26519
|
return { ...SUCCESS, eventData };
|
|
26333
26520
|
}
|
|
26334
26521
|
|
|
@@ -31563,6 +31750,13 @@ function setMatchUpStatus$2(params) {
|
|
|
31563
31750
|
score: score2
|
|
31564
31751
|
});
|
|
31565
31752
|
}
|
|
31753
|
+
ensureSideLineUps({
|
|
31754
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
31755
|
+
inContextDualMatchUp: inContextMatchUp,
|
|
31756
|
+
eventId: event?.eventId,
|
|
31757
|
+
drawDefinition,
|
|
31758
|
+
dualMatchUp: matchUp
|
|
31759
|
+
});
|
|
31566
31760
|
}
|
|
31567
31761
|
if (matchUp.matchUpType === TEAM$2 && matchUpStatus && [
|
|
31568
31762
|
AWAITING_RESULT
|
|
@@ -33324,10 +33518,7 @@ function modifyCollectionDefinition$1({
|
|
|
33324
33518
|
modifications.push({ collectionId, gender });
|
|
33325
33519
|
}
|
|
33326
33520
|
const modifiedTieFormat = definedAttributes(tieFormat);
|
|
33327
|
-
result = validateTieFormat({
|
|
33328
|
-
tieFormat: modifiedTieFormat,
|
|
33329
|
-
eventType: event?.eventType
|
|
33330
|
-
});
|
|
33521
|
+
result = validateTieFormat({ tieFormat: modifiedTieFormat });
|
|
33331
33522
|
if (result.error) {
|
|
33332
33523
|
return decorateResult({ result, stack });
|
|
33333
33524
|
}
|
|
@@ -33598,8 +33789,7 @@ function removeCollectionDefinition$1({
|
|
|
33598
33789
|
matchUp = matchUp ?? result?.matchUp;
|
|
33599
33790
|
const existingTieFormat = result?.tieFormat;
|
|
33600
33791
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33601
|
-
|
|
33602
|
-
result = validateTieFormat({ tieFormat, eventType });
|
|
33792
|
+
result = validateTieFormat({ tieFormat });
|
|
33603
33793
|
if (result.error)
|
|
33604
33794
|
return decorateResult({ result, stack });
|
|
33605
33795
|
const targetCollection = tieFormat?.collectionDefinitions?.find(
|
|
@@ -33736,7 +33926,7 @@ function removeCollectionDefinition$1({
|
|
|
33736
33926
|
});
|
|
33737
33927
|
}
|
|
33738
33928
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33739
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
33929
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33740
33930
|
if (result.error)
|
|
33741
33931
|
return decorateResult({ result, stack });
|
|
33742
33932
|
if (eventId && event) {
|
|
@@ -33828,8 +34018,7 @@ function addCollectionDefinition$1({
|
|
|
33828
34018
|
matchUp = matchUp ?? result?.matchUp;
|
|
33829
34019
|
const existingTieFormat = matchUp?.tieFormat ?? result?.tieFormat;
|
|
33830
34020
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33831
|
-
|
|
33832
|
-
result = validateTieFormat({ tieFormat, eventType });
|
|
34021
|
+
result = validateTieFormat({ tieFormat });
|
|
33833
34022
|
if (result?.error) {
|
|
33834
34023
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33835
34024
|
}
|
|
@@ -33864,7 +34053,7 @@ function addCollectionDefinition$1({
|
|
|
33864
34053
|
const addedMatchUps = [];
|
|
33865
34054
|
let targetMatchUps = [];
|
|
33866
34055
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33867
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
34056
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33868
34057
|
if (result?.error) {
|
|
33869
34058
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33870
34059
|
}
|
|
@@ -34152,10 +34341,7 @@ function collectionGroupUpdate({
|
|
|
34152
34341
|
event
|
|
34153
34342
|
});
|
|
34154
34343
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
34155
|
-
const result = validateTieFormat({
|
|
34156
|
-
eventType: event?.eventType,
|
|
34157
|
-
tieFormat: prunedTieFormat
|
|
34158
|
-
});
|
|
34344
|
+
const result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
34159
34345
|
if (result.error)
|
|
34160
34346
|
return result;
|
|
34161
34347
|
if (eventId && event) {
|
|
@@ -34205,7 +34391,7 @@ function removeCollectionGroup$1({
|
|
|
34205
34391
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34206
34392
|
const wasAggregateValue = existingTieFormat?.winCriteria.aggregateValue;
|
|
34207
34393
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34208
|
-
result = validateTieFormat({ tieFormat
|
|
34394
|
+
result = validateTieFormat({ tieFormat });
|
|
34209
34395
|
if (result.error)
|
|
34210
34396
|
return decorateResult({ result, stack });
|
|
34211
34397
|
const modifiedCollectionIds = [];
|
|
@@ -34292,7 +34478,7 @@ function addCollectionGroup$1({
|
|
|
34292
34478
|
const existingTieFormat = result?.tieFormat;
|
|
34293
34479
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34294
34480
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34295
|
-
result = validateTieFormat({ tieFormat
|
|
34481
|
+
result = validateTieFormat({ tieFormat });
|
|
34296
34482
|
if (result.error)
|
|
34297
34483
|
return decorateResult({ result, stack });
|
|
34298
34484
|
for (const collectionDefinition of tieFormat.collectionDefinitions) {
|
|
@@ -34356,10 +34542,7 @@ function modifyTieFormat$1({
|
|
|
34356
34542
|
event
|
|
34357
34543
|
}) {
|
|
34358
34544
|
const stack = "modifyTieFormat";
|
|
34359
|
-
if (!validateTieFormat({
|
|
34360
|
-
tieFormat: modifiedTieFormat,
|
|
34361
|
-
eventType: event?.eventType
|
|
34362
|
-
}).valid) {
|
|
34545
|
+
if (!validateTieFormat({ tieFormat: modifiedTieFormat }).valid) {
|
|
34363
34546
|
return decorateResult({
|
|
34364
34547
|
result: { error: INVALID_TIE_FORMAT },
|
|
34365
34548
|
info: "falied validation",
|
|
@@ -42921,8 +43104,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
42921
43104
|
const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
|
|
42922
43105
|
let { tieFormat, matchUpType } = params;
|
|
42923
43106
|
if (tieFormat) {
|
|
42924
|
-
const
|
|
42925
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
43107
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
42926
43108
|
if (result2.error)
|
|
42927
43109
|
return result2;
|
|
42928
43110
|
}
|
|
@@ -45389,8 +45571,7 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
45389
45571
|
return { error: INVALID_DRAW_SIZE };
|
|
45390
45572
|
let { tieFormat, matchUpType } = params;
|
|
45391
45573
|
if (tieFormat) {
|
|
45392
|
-
const
|
|
45393
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
45574
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
45394
45575
|
if (result2.error)
|
|
45395
45576
|
return result2;
|
|
45396
45577
|
}
|
|
@@ -51392,13 +51573,12 @@ function addParticipantContext(params) {
|
|
|
51392
51573
|
(extensionKey) => eventInfo[extensionKey] = event[extensionKey]
|
|
51393
51574
|
);
|
|
51394
51575
|
const eventEntries = event.entries || [];
|
|
51395
|
-
const
|
|
51396
|
-
|
|
51397
|
-
|
|
51398
|
-
|
|
51399
|
-
|
|
51400
|
-
|
|
51401
|
-
const { drawIds: publishedDrawIds = [], seeding } = timeItem.itemValue.PUBLIC || {};
|
|
51576
|
+
const pubStatus = getEventPublishStatus({ event });
|
|
51577
|
+
if (isObject(pubStatus)) {
|
|
51578
|
+
const { drawIds, drawDetails: drawDetails2, seeding } = pubStatus;
|
|
51579
|
+
const publishedDrawIds = drawDetails2 ? Object.keys(drawDetails2).filter(
|
|
51580
|
+
(drawId) => getDrawPublishStatus({ drawId, drawDetails: drawDetails2 })
|
|
51581
|
+
) : drawIds ?? [];
|
|
51402
51582
|
const publishedSeeding = {
|
|
51403
51583
|
published: void 0,
|
|
51404
51584
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
@@ -51407,7 +51587,7 @@ function addParticipantContext(params) {
|
|
|
51407
51587
|
// seeding can be specific to drawIds
|
|
51408
51588
|
};
|
|
51409
51589
|
if (seeding)
|
|
51410
|
-
Object.assign(publishedSeeding,
|
|
51590
|
+
Object.assign(publishedSeeding, pubStatus.seeding);
|
|
51411
51591
|
eventsPublishStatuses[eventId] = {
|
|
51412
51592
|
publishedDrawIds,
|
|
51413
51593
|
publishedSeeding
|
|
@@ -53092,6 +53272,27 @@ const participantGovernor = {
|
|
|
53092
53272
|
getParticipants: getParticipants$1
|
|
53093
53273
|
};
|
|
53094
53274
|
|
|
53275
|
+
function modifyEventPublishStatus({
|
|
53276
|
+
removePriorValues = true,
|
|
53277
|
+
status = PUBLIC,
|
|
53278
|
+
statusObject,
|
|
53279
|
+
event
|
|
53280
|
+
}) {
|
|
53281
|
+
if (!isObject(statusObject))
|
|
53282
|
+
return { error: INVALID_VALUES };
|
|
53283
|
+
const publishStatus = getEventPublishStatus({ event, status });
|
|
53284
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
53285
|
+
const updatedTimeItem = {
|
|
53286
|
+
itemValue: { [status]: { ...publishStatus, ...statusObject } },
|
|
53287
|
+
itemType
|
|
53288
|
+
};
|
|
53289
|
+
return addEventTimeItem({
|
|
53290
|
+
timeItem: updatedTimeItem,
|
|
53291
|
+
removePriorValues,
|
|
53292
|
+
event
|
|
53293
|
+
});
|
|
53294
|
+
}
|
|
53295
|
+
|
|
53095
53296
|
function publishEventSeeding({
|
|
53096
53297
|
removePriorValues = true,
|
|
53097
53298
|
stageSeedingScaleNames,
|
|
@@ -53105,31 +53306,27 @@ function publishEventSeeding({
|
|
|
53105
53306
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53106
53307
|
if (!event)
|
|
53107
53308
|
return { error: MISSING_EVENT };
|
|
53108
|
-
const
|
|
53109
|
-
const
|
|
53110
|
-
|
|
53111
|
-
event
|
|
53112
|
-
});
|
|
53113
|
-
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53114
|
-
const updatedSeedingScaleNames = (itemValue[status].seeding?.seedingScaleNames || seedingScaleNames) && {
|
|
53115
|
-
...itemValue[status].seeding?.seedingScaleNames,
|
|
53309
|
+
const eventPubStatus = getEventPublishStatus({ event, status });
|
|
53310
|
+
const updatedSeedingScaleNames = (eventPubStatus?.seeding?.seedingScaleNames || seedingScaleNames) && {
|
|
53311
|
+
...eventPubStatus?.seeding?.seedingScaleNames,
|
|
53116
53312
|
...seedingScaleNames
|
|
53117
53313
|
};
|
|
53118
|
-
const updatedStageSeedingScaleNames = (
|
|
53119
|
-
...
|
|
53314
|
+
const updatedStageSeedingScaleNames = (eventPubStatus?.seeding?.stageSeedingScaleNames || stageSeedingScaleNames) && {
|
|
53315
|
+
...eventPubStatus?.seeding?.stageSeedingScaleNames,
|
|
53120
53316
|
...stageSeedingScaleNames
|
|
53121
53317
|
};
|
|
53122
|
-
|
|
53318
|
+
const seeding = definedAttributes({
|
|
53123
53319
|
stageSeedingScaleNames: updatedStageSeedingScaleNames,
|
|
53124
53320
|
seedingScaleNames: updatedSeedingScaleNames,
|
|
53125
53321
|
published: true,
|
|
53126
53322
|
drawIds
|
|
53127
53323
|
});
|
|
53128
|
-
|
|
53129
|
-
|
|
53130
|
-
|
|
53131
|
-
|
|
53132
|
-
|
|
53324
|
+
modifyEventPublishStatus({
|
|
53325
|
+
statusObject: { seeding },
|
|
53326
|
+
removePriorValues,
|
|
53327
|
+
status,
|
|
53328
|
+
event
|
|
53329
|
+
});
|
|
53133
53330
|
addNotice({
|
|
53134
53331
|
topic: PUBLISH_EVENT_SEEDING,
|
|
53135
53332
|
payload: {
|
|
@@ -53145,6 +53342,7 @@ function unPublishEventSeeding({
|
|
|
53145
53342
|
seedingScaleNames,
|
|
53146
53343
|
tournamentRecord,
|
|
53147
53344
|
status = PUBLIC,
|
|
53345
|
+
drawIds,
|
|
53148
53346
|
stages,
|
|
53149
53347
|
event
|
|
53150
53348
|
}) {
|
|
@@ -53152,34 +53350,39 @@ function unPublishEventSeeding({
|
|
|
53152
53350
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53153
53351
|
if (!event)
|
|
53154
53352
|
return { error: MISSING_EVENT };
|
|
53155
|
-
const
|
|
53156
|
-
|
|
53157
|
-
|
|
53158
|
-
|
|
53159
|
-
});
|
|
53160
|
-
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53161
|
-
if (itemValue[status]) {
|
|
53162
|
-
if (Array.isArray(stages) && itemValue[status].seeding?.stageSeedingScaleNames) {
|
|
53353
|
+
const eventPubStatus = getEventPublishStatus({ event });
|
|
53354
|
+
if (eventPubStatus) {
|
|
53355
|
+
const seeding = eventPubStatus.seeding;
|
|
53356
|
+
if (Array.isArray(stages) && seeding.stageSeedingScaleNames) {
|
|
53163
53357
|
for (const stage of stages) {
|
|
53164
|
-
if (
|
|
53165
|
-
delete
|
|
53358
|
+
if (seeding.stageSeedingScaleNames[stage]) {
|
|
53359
|
+
delete seeding.stageSeedingScaleNames[stage];
|
|
53166
53360
|
}
|
|
53167
53361
|
}
|
|
53168
53362
|
}
|
|
53169
|
-
if (Array.isArray(seedingScaleNames) &&
|
|
53170
|
-
|
|
53363
|
+
if (Array.isArray(seedingScaleNames) && seeding?.seedingScaleNames) {
|
|
53364
|
+
seeding.seedingScaleNames = seeding.seedingScaleNames.filter(
|
|
53171
53365
|
(scaleName) => !seedingScaleNames.includes(scaleName)
|
|
53172
53366
|
);
|
|
53173
53367
|
}
|
|
53174
|
-
if (
|
|
53175
|
-
|
|
53368
|
+
if (Array.isArray(drawIds) && seeding?.drawIds) {
|
|
53369
|
+
seeding.drawIds = seeding.drawIds.filter(
|
|
53370
|
+
(drawId) => !drawIds.includes(drawId)
|
|
53371
|
+
);
|
|
53176
53372
|
}
|
|
53373
|
+
if (!Object.values(seeding.stageSeedingScaleNames ?? {}).length && !seeding.seedingScaleNames?.length && !seeding.drawIds?.length || !stages && !seedingScaleNames && !drawIds?.length) {
|
|
53374
|
+
delete seeding.stageSeedingScaleNames;
|
|
53375
|
+
delete seeding.seedingScaleNames;
|
|
53376
|
+
delete seeding.drawIds;
|
|
53377
|
+
seeding.published = false;
|
|
53378
|
+
}
|
|
53379
|
+
modifyEventPublishStatus({
|
|
53380
|
+
statusObject: { seeding },
|
|
53381
|
+
removePriorValues,
|
|
53382
|
+
status,
|
|
53383
|
+
event
|
|
53384
|
+
});
|
|
53177
53385
|
}
|
|
53178
|
-
const updatedTimeItem = {
|
|
53179
|
-
itemValue,
|
|
53180
|
-
itemType
|
|
53181
|
-
};
|
|
53182
|
-
addEventTimeItem({ event, timeItem: updatedTimeItem, removePriorValues });
|
|
53183
53386
|
addNotice({
|
|
53184
53387
|
topic: UNPUBLISH_EVENT_SEEDING,
|
|
53185
53388
|
payload: {
|
|
@@ -53265,13 +53468,10 @@ function getAllEventData({ tournamentRecord, policyDefinitions }) {
|
|
|
53265
53468
|
}
|
|
53266
53469
|
};
|
|
53267
53470
|
});
|
|
53268
|
-
const
|
|
53269
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
53270
|
-
event
|
|
53271
|
-
});
|
|
53471
|
+
const publish = getEventPublishStatus({ event });
|
|
53272
53472
|
Object.assign(eventInfo, {
|
|
53273
|
-
|
|
53274
|
-
|
|
53473
|
+
drawsData,
|
|
53474
|
+
publish
|
|
53275
53475
|
});
|
|
53276
53476
|
return eventInfo;
|
|
53277
53477
|
});
|
|
@@ -53279,6 +53479,49 @@ function getAllEventData({ tournamentRecord, policyDefinitions }) {
|
|
|
53279
53479
|
return { allEventData };
|
|
53280
53480
|
}
|
|
53281
53481
|
|
|
53482
|
+
function setEventDisplay({
|
|
53483
|
+
removePriorValues,
|
|
53484
|
+
tournamentRecord,
|
|
53485
|
+
displaySettings,
|
|
53486
|
+
status = PUBLIC,
|
|
53487
|
+
event
|
|
53488
|
+
}) {
|
|
53489
|
+
if (!tournamentRecord)
|
|
53490
|
+
return decorateResult({ result: { error: MISSING_TOURNAMENT_RECORD } });
|
|
53491
|
+
if (!event)
|
|
53492
|
+
return decorateResult({ result: { error: MISSING_EVENT } });
|
|
53493
|
+
if (!isObject(displaySettings))
|
|
53494
|
+
return decorateResult({ result: { error: MISSING_VALUE } });
|
|
53495
|
+
if (isObject(displaySettings.draws)) {
|
|
53496
|
+
for (const key of Object.keys(displaySettings.draws)) {
|
|
53497
|
+
const details = displaySettings.draws[key].scheduleDetails ?? [];
|
|
53498
|
+
if (details.length) {
|
|
53499
|
+
const scheduleDetails = [];
|
|
53500
|
+
for (const detail of details) {
|
|
53501
|
+
const existingDetail = scheduleDetails.find(
|
|
53502
|
+
(sd) => objShallowEqual(sd.attributes, detail.attributes)
|
|
53503
|
+
);
|
|
53504
|
+
if (existingDetail?.dates && detail.dates) {
|
|
53505
|
+
existingDetail.dates.push(...detail.dates);
|
|
53506
|
+
} else {
|
|
53507
|
+
scheduleDetails.push(detail);
|
|
53508
|
+
}
|
|
53509
|
+
}
|
|
53510
|
+
displaySettings.draws[key].scheduleDetails = scheduleDetails;
|
|
53511
|
+
}
|
|
53512
|
+
}
|
|
53513
|
+
}
|
|
53514
|
+
const result = modifyEventPublishStatus({
|
|
53515
|
+
statusObject: { displaySettings },
|
|
53516
|
+
removePriorValues,
|
|
53517
|
+
status,
|
|
53518
|
+
event
|
|
53519
|
+
});
|
|
53520
|
+
if (result.error)
|
|
53521
|
+
return result;
|
|
53522
|
+
return { ...SUCCESS };
|
|
53523
|
+
}
|
|
53524
|
+
|
|
53282
53525
|
function unPublishEvent({
|
|
53283
53526
|
removePriorValues = true,
|
|
53284
53527
|
tournamentRecord,
|
|
@@ -53296,9 +53539,20 @@ function unPublishEvent({
|
|
|
53296
53539
|
});
|
|
53297
53540
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53298
53541
|
delete itemValue[status].structureIds;
|
|
53542
|
+
delete itemValue[status].drawDetails;
|
|
53299
53543
|
delete itemValue[status].drawIds;
|
|
53300
53544
|
const updatedTimeItem = { itemValue, itemType };
|
|
53301
53545
|
addEventTimeItem({ event, timeItem: updatedTimeItem, removePriorValues });
|
|
53546
|
+
modifyEventPublishStatus({
|
|
53547
|
+
statusObject: {
|
|
53548
|
+
structureIds: void 0,
|
|
53549
|
+
drawIds: void 0,
|
|
53550
|
+
seeding: void 0
|
|
53551
|
+
},
|
|
53552
|
+
removePriorValues,
|
|
53553
|
+
status,
|
|
53554
|
+
event
|
|
53555
|
+
});
|
|
53302
53556
|
addNotice({
|
|
53303
53557
|
topic: UNPUBLISH_EVENT,
|
|
53304
53558
|
payload: {
|
|
@@ -53310,7 +53564,6 @@ function unPublishEvent({
|
|
|
53310
53564
|
}
|
|
53311
53565
|
|
|
53312
53566
|
function publishEvent(params) {
|
|
53313
|
-
let { policyDefinitions, drawIds, structureIds, stages } = params;
|
|
53314
53567
|
const {
|
|
53315
53568
|
includePositionAssignments,
|
|
53316
53569
|
removePriorValues,
|
|
@@ -53318,67 +53571,128 @@ function publishEvent(params) {
|
|
|
53318
53571
|
status = PUBLIC,
|
|
53319
53572
|
event,
|
|
53320
53573
|
drawIdsToRemove,
|
|
53321
|
-
drawIdsToAdd
|
|
53322
|
-
stagesToRemove,
|
|
53323
|
-
stagesToAdd,
|
|
53324
|
-
structureIdsToRemove,
|
|
53325
|
-
structureIdsToAdd
|
|
53574
|
+
drawIdsToAdd
|
|
53326
53575
|
} = params;
|
|
53327
53576
|
if (!tournamentRecord)
|
|
53328
53577
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53329
53578
|
if (!event)
|
|
53330
53579
|
return { error: MISSING_EVENT };
|
|
53331
|
-
|
|
53332
|
-
|
|
53333
|
-
|
|
53334
|
-
|
|
53335
|
-
|
|
53580
|
+
const { appliedPolicies } = getAppliedPolicies({ tournamentRecord, event });
|
|
53581
|
+
const policyDefinitions = {
|
|
53582
|
+
...appliedPolicies,
|
|
53583
|
+
...params.policyDefinitions
|
|
53584
|
+
};
|
|
53336
53585
|
const eventDrawIds = event.drawDefinitions?.map(({ drawId }) => drawId) ?? [];
|
|
53337
|
-
const
|
|
53338
|
-
|
|
53339
|
-
|
|
53340
|
-
|
|
53341
|
-
|
|
53342
|
-
|
|
53343
|
-
} else if (!drawIds && (drawIdsToAdd?.length || drawIdsToRemove?.length)) {
|
|
53344
|
-
drawIds = timeItem?.itemValue?.PUBLIC?.drawIds || [];
|
|
53345
|
-
}
|
|
53346
|
-
drawIds = (drawIds ?? []).filter(
|
|
53347
|
-
(drawId) => !drawIdsToRemove?.length || !drawIdsToRemove.includes(drawId)
|
|
53586
|
+
const keyedDrawIds = params.drawDetails ? Object.keys(params.drawDetails) : [];
|
|
53587
|
+
const specifiedDrawIds = keyedDrawIds.length ? [] : params.drawIds;
|
|
53588
|
+
const drawIdsToValidate = (drawIdsToAdd ?? []).concat(
|
|
53589
|
+
...drawIdsToRemove ?? [],
|
|
53590
|
+
...specifiedDrawIds ?? [],
|
|
53591
|
+
...keyedDrawIds
|
|
53348
53592
|
);
|
|
53349
|
-
|
|
53350
|
-
|
|
53351
|
-
drawIds.concat(
|
|
53352
|
-
...drawIdsToAdd.filter((drawId) => eventDrawIds.includes(drawId))
|
|
53353
|
-
)
|
|
53354
|
-
);
|
|
53355
|
-
}
|
|
53356
|
-
if (!structureIds && (structureIdsToAdd?.length || structureIdsToRemove?.length)) {
|
|
53357
|
-
structureIds = timeItem?.itemValue?.PUBLIC?.structureIds || [];
|
|
53358
|
-
}
|
|
53359
|
-
structureIds = (structureIds ?? []).filter(
|
|
53360
|
-
(structureId) => !structureIdsToRemove?.length || !structureIdsToRemove.includes(structureId)
|
|
53593
|
+
const invalidDrawIds = drawIdsToValidate.filter(
|
|
53594
|
+
(drawId) => !eventDrawIds.includes(drawId)
|
|
53361
53595
|
);
|
|
53362
|
-
if (
|
|
53363
|
-
|
|
53364
|
-
|
|
53365
|
-
|
|
53366
|
-
|
|
53596
|
+
if (invalidDrawIds.length) {
|
|
53597
|
+
return decorateResult({
|
|
53598
|
+
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
53599
|
+
context: { invalidDrawIds }
|
|
53600
|
+
});
|
|
53367
53601
|
}
|
|
53368
|
-
|
|
53369
|
-
|
|
53370
|
-
)
|
|
53371
|
-
|
|
53372
|
-
|
|
53602
|
+
const pubStatus = getEventPublishStatus({ event, status });
|
|
53603
|
+
const drawDetails = pubStatus?.drawDetails || {};
|
|
53604
|
+
for (const drawId of eventDrawIds) {
|
|
53605
|
+
if (!drawIdsToValidate.length || drawIdsToValidate.includes(drawId)) {
|
|
53606
|
+
if (drawIdsToRemove?.includes(drawId) || specifiedDrawIds?.length && !specifiedDrawIds.includes(drawId)) {
|
|
53607
|
+
drawDetails[drawId] = {
|
|
53608
|
+
...drawDetails[drawId],
|
|
53609
|
+
publishingDetail: { published: false }
|
|
53610
|
+
};
|
|
53611
|
+
} else if (drawIdsToAdd?.includes(drawId) || specifiedDrawIds?.includes(drawId) || !specifiedDrawIds?.length) {
|
|
53612
|
+
drawDetails[drawId] = {
|
|
53613
|
+
...drawDetails[drawId],
|
|
53614
|
+
publishingDetail: { published: true }
|
|
53615
|
+
};
|
|
53616
|
+
}
|
|
53617
|
+
}
|
|
53618
|
+
if (params.drawDetails?.[drawId]) {
|
|
53619
|
+
const newDetail = params.drawDetails[drawId];
|
|
53620
|
+
let structureDetails = newDetail.structureDetails ?? drawDetails[drawId].structureDetails;
|
|
53621
|
+
const stageDetails = newDetail.stageDetails ?? drawDetails[drawId].stageDetails ?? {};
|
|
53622
|
+
const {
|
|
53623
|
+
structureIdsToRemove = [],
|
|
53624
|
+
structureIdsToAdd = [],
|
|
53625
|
+
publishingDetail = {},
|
|
53626
|
+
stagesToRemove = [],
|
|
53627
|
+
stagesToAdd = []
|
|
53628
|
+
} = newDetail;
|
|
53629
|
+
if (structureIdsToAdd || stagesToAdd)
|
|
53630
|
+
publishingDetail.published = true;
|
|
53631
|
+
drawDetails[drawId] = {
|
|
53632
|
+
publishingDetail,
|
|
53633
|
+
structureDetails,
|
|
53634
|
+
stageDetails
|
|
53635
|
+
};
|
|
53636
|
+
if (structureIdsToAdd.length || structureIdsToRemove.length) {
|
|
53637
|
+
const drawStructureIds = (event.drawDefinitions?.find(
|
|
53638
|
+
(drawDefinition) => drawDefinition.drawId === drawId
|
|
53639
|
+
)?.structures ?? []).map(({ structureId }) => structureId);
|
|
53640
|
+
const structureIdsToValidate = (structureIdsToAdd ?? []).concat(
|
|
53641
|
+
structureIdsToRemove ?? []
|
|
53642
|
+
);
|
|
53643
|
+
const invalidStructureIds = structureIdsToValidate.filter(
|
|
53644
|
+
(structureId) => !drawStructureIds.includes(structureId)
|
|
53645
|
+
);
|
|
53646
|
+
if (invalidStructureIds.length) {
|
|
53647
|
+
return decorateResult({
|
|
53648
|
+
result: { error: STRUCTURE_NOT_FOUND },
|
|
53649
|
+
context: { invalidStructureIds }
|
|
53650
|
+
});
|
|
53651
|
+
}
|
|
53652
|
+
structureDetails = structureDetails ?? {};
|
|
53653
|
+
for (const structureId of drawStructureIds) {
|
|
53654
|
+
if (structureIdsToRemove.includes(structureId)) {
|
|
53655
|
+
structureDetails[structureId] = { published: false };
|
|
53656
|
+
} else {
|
|
53657
|
+
structureDetails[structureId] = { published: true };
|
|
53658
|
+
}
|
|
53659
|
+
}
|
|
53660
|
+
drawDetails[drawId].structureDetails = structureDetails;
|
|
53661
|
+
}
|
|
53662
|
+
const drawStages = (event.drawDefinitions?.find(
|
|
53663
|
+
(drawDefinition) => drawDefinition.drawId === drawId
|
|
53664
|
+
)?.structures ?? []).map(({ stage }) => stage);
|
|
53665
|
+
if (stagesToAdd.length) {
|
|
53666
|
+
for (const stage of stagesToAdd) {
|
|
53667
|
+
stageDetails[stage] = { published: true };
|
|
53668
|
+
}
|
|
53669
|
+
for (const stage of drawStages) {
|
|
53670
|
+
if (!stageDetails[stage]) {
|
|
53671
|
+
stageDetails[stage] = { published: false };
|
|
53672
|
+
}
|
|
53673
|
+
}
|
|
53674
|
+
}
|
|
53675
|
+
if (stagesToAdd.length || stagesToRemove.length) {
|
|
53676
|
+
for (const stage of stagesToRemove) {
|
|
53677
|
+
stageDetails[stage] = { published: false };
|
|
53678
|
+
}
|
|
53679
|
+
for (const stage of drawStages) {
|
|
53680
|
+
if (!stageDetails[stage]) {
|
|
53681
|
+
stageDetails[stage] = { published: true };
|
|
53682
|
+
}
|
|
53683
|
+
}
|
|
53684
|
+
}
|
|
53685
|
+
if (stagesToAdd.length || stagesToRemove.length) {
|
|
53686
|
+
drawDetails[drawId].stageDetails = stageDetails;
|
|
53687
|
+
}
|
|
53688
|
+
}
|
|
53373
53689
|
}
|
|
53374
|
-
|
|
53375
|
-
|
|
53376
|
-
|
|
53377
|
-
|
|
53378
|
-
|
|
53379
|
-
|
|
53380
|
-
};
|
|
53381
|
-
addEventTimeItem({ event, timeItem: updatedTimeItem, removePriorValues });
|
|
53690
|
+
modifyEventPublishStatus({
|
|
53691
|
+
statusObject: { drawDetails },
|
|
53692
|
+
removePriorValues,
|
|
53693
|
+
status,
|
|
53694
|
+
event
|
|
53695
|
+
});
|
|
53382
53696
|
const { eventData } = getEventData({
|
|
53383
53697
|
includePositionAssignments,
|
|
53384
53698
|
usePublishState: true,
|
|
@@ -53386,10 +53700,6 @@ function publishEvent(params) {
|
|
|
53386
53700
|
policyDefinitions,
|
|
53387
53701
|
event
|
|
53388
53702
|
});
|
|
53389
|
-
const publishState = eventData?.eventInfo?.publish?.state;
|
|
53390
|
-
eventData.drawsData = eventData.drawsData.filter(
|
|
53391
|
-
({ drawId }) => publishState?.PUBLIC?.drawIds.includes(drawId)
|
|
53392
|
-
);
|
|
53393
53703
|
addNotice({
|
|
53394
53704
|
payload: { eventData, tournamentId: tournamentRecord.tournamentId },
|
|
53395
53705
|
topic: PUBLISH_EVENT
|
|
@@ -53406,6 +53716,7 @@ const publishingGovernor = {
|
|
|
53406
53716
|
getDrawData,
|
|
53407
53717
|
unPublishEventSeeding,
|
|
53408
53718
|
publishEventSeeding,
|
|
53719
|
+
setEventDisplay,
|
|
53409
53720
|
unPublishEvent,
|
|
53410
53721
|
publishEvent,
|
|
53411
53722
|
unPublishOrderOfPlay: unPublishOrderOfPlay$1,
|
|
@@ -53840,7 +54151,7 @@ function generateLineUps(params) {
|
|
|
53840
54151
|
if (!tieFormat && !drawDefinition)
|
|
53841
54152
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
53842
54153
|
tieFormat = tieFormat ?? resolveTieFormat({ drawDefinition, event })?.tieFormat;
|
|
53843
|
-
if (validateTieFormat({ tieFormat
|
|
54154
|
+
if (validateTieFormat({ tieFormat }).error)
|
|
53844
54155
|
return { error: INVALID_TIE_FORMAT };
|
|
53845
54156
|
if (typeof scaleAccessor !== "object" && !useDefaultEventRanking)
|
|
53846
54157
|
return { error: INVALID_VALUES, context: { scaleAccessor } };
|
|
@@ -56500,6 +56811,9 @@ function deleteDrawDefinitions(params) {
|
|
|
56500
56811
|
bye
|
|
56501
56812
|
}) => ({ bye, qualifier, drawPosition, participantId });
|
|
56502
56813
|
const allowDeletionWithScoresPresent = force || appliedPolicies?.[POLICY_TYPE_SCORING]?.allowDeletionWithScoresPresent?.drawDefinitions;
|
|
56814
|
+
const publishStatus = getEventPublishStatus({ event }) ?? {};
|
|
56815
|
+
let updatedDrawIds = publishStatus.drawIds ?? (publishStatus.drawDetails && Object.keys(publishStatus.drawDetails)) ?? [];
|
|
56816
|
+
let publishedDrawsDeleted;
|
|
56503
56817
|
const drawIdsWithScoresPresent = [];
|
|
56504
56818
|
const filteredDrawDefinitions = event.drawDefinitions.filter(
|
|
56505
56819
|
(drawDefinition) => {
|
|
@@ -56521,6 +56835,10 @@ function deleteDrawDefinitions(params) {
|
|
|
56521
56835
|
(entry) => STRUCTURE_ENTERED_TYPES.includes(entry.entryStatus)
|
|
56522
56836
|
);
|
|
56523
56837
|
}
|
|
56838
|
+
if (updatedDrawIds.includes(drawId2)) {
|
|
56839
|
+
updatedDrawIds = updatedDrawIds.filter((id) => id !== drawId2);
|
|
56840
|
+
publishedDrawsDeleted = true;
|
|
56841
|
+
}
|
|
56524
56842
|
const mainStructure = getDrawStructures({
|
|
56525
56843
|
stageSequence: 1,
|
|
56526
56844
|
drawDefinition,
|
|
@@ -56592,29 +56910,19 @@ function deleteDrawDefinitions(params) {
|
|
|
56592
56910
|
addEventExtension$1({ event, extension });
|
|
56593
56911
|
}
|
|
56594
56912
|
checkSchedulingProfile({ tournamentRecord });
|
|
56595
|
-
|
|
56596
|
-
|
|
56597
|
-
|
|
56598
|
-
|
|
56599
|
-
|
|
56600
|
-
const drawPublished = publishStatus?.drawIds?.includes(drawId2);
|
|
56601
|
-
if (drawPublished) {
|
|
56602
|
-
publishedDrawsDeleted = true;
|
|
56603
|
-
const updatedDrawIds = publishStatus.drawIds?.filter(
|
|
56604
|
-
(publishedDrawId) => publishedDrawId !== drawId2
|
|
56605
|
-
) || [];
|
|
56606
|
-
const timeItem2 = {
|
|
56607
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
56608
|
-
itemValue: {
|
|
56609
|
-
[PUBLIC]: {
|
|
56610
|
-
drawIds: updatedDrawIds
|
|
56611
|
-
}
|
|
56612
|
-
}
|
|
56913
|
+
if (publishedDrawsDeleted) {
|
|
56914
|
+
const drawDetails = {};
|
|
56915
|
+
for (const drawId2 of updatedDrawIds) {
|
|
56916
|
+
drawDetails[drawId2] = publishStatus.drawDetails?.[drawId2] ?? {
|
|
56917
|
+
published: true
|
|
56613
56918
|
};
|
|
56614
|
-
const result = addEventTimeItem({ event, timeItem: timeItem2 });
|
|
56615
|
-
if (result.error)
|
|
56616
|
-
return { error: result.error };
|
|
56617
56919
|
}
|
|
56920
|
+
const result = modifyEventPublishStatus({
|
|
56921
|
+
statusObject: { drawDetails },
|
|
56922
|
+
event
|
|
56923
|
+
});
|
|
56924
|
+
if (result.error)
|
|
56925
|
+
return { error: result.error };
|
|
56618
56926
|
}
|
|
56619
56927
|
if (auditTrail.length) {
|
|
56620
56928
|
addNotice({ topic: AUDIT, payload: auditTrail });
|
|
@@ -56630,9 +56938,14 @@ function deleteDrawDefinitions(params) {
|
|
|
56630
56938
|
});
|
|
56631
56939
|
addDrawDeletionTelemetry({ event, deletedDrawsDetail, auditData });
|
|
56632
56940
|
if (autoPublish && publishedDrawsDeleted) {
|
|
56633
|
-
const result = publishEvent({
|
|
56941
|
+
const result = publishEvent({
|
|
56942
|
+
drawIdsToRemove: drawIds,
|
|
56943
|
+
policyDefinitions,
|
|
56944
|
+
tournamentRecord,
|
|
56945
|
+
event
|
|
56946
|
+
});
|
|
56634
56947
|
if (result.error)
|
|
56635
|
-
|
|
56948
|
+
return { ...SUCCESS, info: result.error };
|
|
56636
56949
|
}
|
|
56637
56950
|
return { ...SUCCESS };
|
|
56638
56951
|
}
|
|
@@ -57267,10 +57580,7 @@ function addEvent({
|
|
|
57267
57580
|
};
|
|
57268
57581
|
if (event.eventType === TypeEnum.Team) {
|
|
57269
57582
|
if (event.tieFormat) {
|
|
57270
|
-
const result = validateTieFormat({
|
|
57271
|
-
tieFormat: event.tieFormat,
|
|
57272
|
-
eventType: event.eventType
|
|
57273
|
-
});
|
|
57583
|
+
const result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
57274
57584
|
if (result.error)
|
|
57275
57585
|
return result;
|
|
57276
57586
|
} else if (event.tieFormatName) {
|
|
@@ -59681,8 +59991,7 @@ function generateDrawDefinition(params) {
|
|
|
59681
59991
|
const result = validateTieFormat({
|
|
59682
59992
|
gender: event?.gender,
|
|
59683
59993
|
enforceGender,
|
|
59684
|
-
tieFormat
|
|
59685
|
-
event
|
|
59994
|
+
tieFormat
|
|
59686
59995
|
});
|
|
59687
59996
|
if (result.error)
|
|
59688
59997
|
return decorateResult({ result, stack });
|
|
@@ -59701,10 +60010,7 @@ function generateDrawDefinition(params) {
|
|
|
59701
60010
|
const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
|
|
59702
60011
|
if (!equivalentInScope) {
|
|
59703
60012
|
if (tieFormat) {
|
|
59704
|
-
const result = checkTieFormat({
|
|
59705
|
-
eventType: event.eventType,
|
|
59706
|
-
tieFormat
|
|
59707
|
-
});
|
|
60013
|
+
const result = checkTieFormat({ tieFormat });
|
|
59708
60014
|
if (result.error)
|
|
59709
60015
|
return decorateResult({ result, stack });
|
|
59710
60016
|
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|
|
@@ -60035,7 +60341,7 @@ function generateDrawDefinition(params) {
|
|
|
60035
60341
|
drawDefinition.links.push(link);
|
|
60036
60342
|
}
|
|
60037
60343
|
drawDefinition.drawName = params.drawName ?? (drawType && constantToString(drawType));
|
|
60038
|
-
if (typeof voluntaryConsolation === "object") {
|
|
60344
|
+
if (typeof voluntaryConsolation === "object" && drawSize >= 4) {
|
|
60039
60345
|
addVoluntaryConsolationStructure({
|
|
60040
60346
|
...voluntaryConsolation,
|
|
60041
60347
|
tournamentRecord,
|
|
@@ -60986,10 +61292,8 @@ function bulkUpdatePublishedEventIds({ tournamentRecord, outcomes }) {
|
|
|
60986
61292
|
if (eventId && drawId) {
|
|
60987
61293
|
if (!eventIdsMap2[eventId]) {
|
|
60988
61294
|
eventIdsMap2[eventId] = [drawId];
|
|
60989
|
-
} else {
|
|
60990
|
-
|
|
60991
|
-
eventIdsMap2[eventId].push(drawId);
|
|
60992
|
-
}
|
|
61295
|
+
} else if (!eventIdsMap2[eventId].includes(drawId)) {
|
|
61296
|
+
eventIdsMap2[eventId].push(drawId);
|
|
60993
61297
|
}
|
|
60994
61298
|
}
|
|
60995
61299
|
return eventIdsMap2;
|
|
@@ -60999,14 +61303,14 @@ function bulkUpdatePublishedEventIds({ tournamentRecord, outcomes }) {
|
|
|
60999
61303
|
(event) => relevantEventsIds.includes(event.eventId)
|
|
61000
61304
|
);
|
|
61001
61305
|
const publishedEventIds = relevantEvents.filter((event) => {
|
|
61002
|
-
const
|
|
61003
|
-
|
|
61004
|
-
event
|
|
61005
|
-
});
|
|
61006
|
-
const pubState = timeItem?.itemValue;
|
|
61306
|
+
const pubStatus = getEventPublishStatus({ event });
|
|
61307
|
+
const { drawDetails, drawIds } = pubStatus ?? {};
|
|
61007
61308
|
const { eventId } = event;
|
|
61008
61309
|
const publishedDrawIds = eventIdsMap[eventId].filter((drawId) => {
|
|
61009
|
-
|
|
61310
|
+
const keyedDrawIds = drawDetails ? Object.keys(pubStatus.drawDetails).filter(
|
|
61311
|
+
(drawId2) => getDrawPublishStatus({ drawId: drawId2, drawDetails })
|
|
61312
|
+
) : [];
|
|
61313
|
+
return drawIds?.includes(drawId) || keyedDrawIds.includes(drawId);
|
|
61010
61314
|
});
|
|
61011
61315
|
return publishedDrawIds.length;
|
|
61012
61316
|
}).map((event) => event.eventId);
|