tods-competition-factory 1.8.46 → 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 +136 -76
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +5 -2
- package/dist/forge/query.mjs +318 -157
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +85 -48
- 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 +602 -322
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +805 -453
- 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 || [];
|
|
@@ -9878,11 +9924,13 @@ function getStructureMatchUps({
|
|
|
9878
9924
|
afterRecoveryTimes,
|
|
9879
9925
|
policyDefinitions,
|
|
9880
9926
|
tournamentRecord,
|
|
9927
|
+
usePublishState,
|
|
9881
9928
|
matchUpFilters,
|
|
9882
9929
|
contextFilters,
|
|
9883
9930
|
contextContent,
|
|
9884
9931
|
participantMap,
|
|
9885
9932
|
scheduleTiming,
|
|
9933
|
+
publishStatus,
|
|
9886
9934
|
contextProfile,
|
|
9887
9935
|
drawDefinition,
|
|
9888
9936
|
exitProfiles,
|
|
@@ -9903,13 +9951,15 @@ function getStructureMatchUps({
|
|
|
9903
9951
|
afterRecoveryTimes,
|
|
9904
9952
|
policyDefinitions,
|
|
9905
9953
|
tournamentRecord,
|
|
9906
|
-
|
|
9954
|
+
usePublishState,
|
|
9907
9955
|
matchUpFilters,
|
|
9908
9956
|
contextFilters,
|
|
9909
|
-
contextProfile,
|
|
9910
9957
|
contextContent,
|
|
9911
9958
|
participantMap,
|
|
9912
9959
|
scheduleTiming,
|
|
9960
|
+
publishStatus,
|
|
9961
|
+
contextProfile,
|
|
9962
|
+
drawDefinition,
|
|
9913
9963
|
exitProfiles,
|
|
9914
9964
|
matchUpsMap,
|
|
9915
9965
|
structure,
|
|
@@ -10005,12 +10055,14 @@ function getDrawMatchUps(params) {
|
|
|
10005
10055
|
afterRecoveryTimes,
|
|
10006
10056
|
policyDefinitions,
|
|
10007
10057
|
tournamentRecord,
|
|
10058
|
+
usePublishState,
|
|
10008
10059
|
contextFilters,
|
|
10009
|
-
contextProfile,
|
|
10010
|
-
drawDefinition,
|
|
10011
10060
|
matchUpFilters,
|
|
10012
10061
|
scheduleTiming,
|
|
10013
10062
|
participantMap,
|
|
10063
|
+
publishStatus,
|
|
10064
|
+
contextProfile,
|
|
10065
|
+
drawDefinition,
|
|
10014
10066
|
nextMatchUps,
|
|
10015
10067
|
inContext,
|
|
10016
10068
|
context,
|
|
@@ -10065,9 +10117,11 @@ function getDrawMatchUps(params) {
|
|
|
10065
10117
|
afterRecoveryTimes,
|
|
10066
10118
|
policyDefinitions,
|
|
10067
10119
|
tournamentRecord,
|
|
10120
|
+
usePublishState,
|
|
10121
|
+
contextContent,
|
|
10068
10122
|
participantMap,
|
|
10069
10123
|
scheduleTiming,
|
|
10070
|
-
|
|
10124
|
+
publishStatus,
|
|
10071
10125
|
contextProfile,
|
|
10072
10126
|
drawDefinition,
|
|
10073
10127
|
exitProfiles,
|
|
@@ -15617,44 +15671,6 @@ const fixtures = {
|
|
|
15617
15671
|
flagIOC
|
|
15618
15672
|
};
|
|
15619
15673
|
|
|
15620
|
-
function addNationalityCode({
|
|
15621
|
-
participant,
|
|
15622
|
-
withISO2,
|
|
15623
|
-
withIOC
|
|
15624
|
-
}) {
|
|
15625
|
-
const { person, individualParticipants } = participant;
|
|
15626
|
-
const persons = [person, individualParticipants?.map(({ person: person2 }) => person2)].flat().filter(Boolean);
|
|
15627
|
-
function annotatePerson(person2) {
|
|
15628
|
-
const { nationalityCode } = person2 || {};
|
|
15629
|
-
if (nationalityCode) {
|
|
15630
|
-
const country = countries.find(({ iso }) => iso === nationalityCode);
|
|
15631
|
-
if (withIOC && country?.ioc && !person2.iocNationalityCode)
|
|
15632
|
-
person2.iocNationalityCode = country.ioc;
|
|
15633
|
-
if (withISO2 && country?.iso2 && !person2.iso2NationalityCode)
|
|
15634
|
-
person2.iso2NationalityCode = country.iso2;
|
|
15635
|
-
if (country?.label && !person2.countryName)
|
|
15636
|
-
person2.countryName = country.label;
|
|
15637
|
-
}
|
|
15638
|
-
}
|
|
15639
|
-
persons.forEach(annotatePerson);
|
|
15640
|
-
}
|
|
15641
|
-
|
|
15642
|
-
function addIndividualParticipants({ participantMap, template }) {
|
|
15643
|
-
const participantObjects = Object.values(participantMap);
|
|
15644
|
-
for (const participantObject of participantObjects) {
|
|
15645
|
-
const participant = participantObject.participant;
|
|
15646
|
-
if (participant.individualParticipantIds?.length) {
|
|
15647
|
-
participant.individualParticipants = [];
|
|
15648
|
-
for (const participantId of participant.individualParticipantIds) {
|
|
15649
|
-
const source = participantMap[participantId].participant;
|
|
15650
|
-
participant.individualParticipants.push(
|
|
15651
|
-
template ? attributeFilter({ template, source }) : source
|
|
15652
|
-
);
|
|
15653
|
-
}
|
|
15654
|
-
}
|
|
15655
|
-
}
|
|
15656
|
-
}
|
|
15657
|
-
|
|
15658
15674
|
function getTimeItem({
|
|
15659
15675
|
returnPreviousValues,
|
|
15660
15676
|
itemSubTypes,
|
|
@@ -15766,6 +15782,52 @@ function getParticipantTimeItem({
|
|
|
15766
15782
|
return timeItem && { timeItem, previousItems } || { info };
|
|
15767
15783
|
}
|
|
15768
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
|
+
|
|
15769
15831
|
const typeMap = {
|
|
15770
15832
|
[GROUP]: "groupParticipantIds",
|
|
15771
15833
|
[PAIR]: "pairParticipantIds",
|
|
@@ -16206,9 +16268,10 @@ function tournamentMatchUps(params) {
|
|
|
16206
16268
|
useParticipantMap,
|
|
16207
16269
|
tournamentRecord,
|
|
16208
16270
|
inContext = true,
|
|
16271
|
+
usePublishState,
|
|
16209
16272
|
contextFilters,
|
|
16210
|
-
contextProfile,
|
|
16211
16273
|
matchUpFilters,
|
|
16274
|
+
contextProfile,
|
|
16212
16275
|
nextMatchUps,
|
|
16213
16276
|
context
|
|
16214
16277
|
} = params;
|
|
@@ -16246,6 +16309,7 @@ function tournamentMatchUps(params) {
|
|
|
16246
16309
|
afterRecoveryTimes,
|
|
16247
16310
|
policyDefinitions,
|
|
16248
16311
|
tournamentRecord,
|
|
16312
|
+
usePublishState,
|
|
16249
16313
|
contextFilters,
|
|
16250
16314
|
contextProfile,
|
|
16251
16315
|
contextContent,
|
|
@@ -16291,9 +16355,10 @@ function eventMatchUps(params) {
|
|
|
16291
16355
|
policyDefinitions,
|
|
16292
16356
|
useParticipantMap,
|
|
16293
16357
|
tournamentRecord,
|
|
16358
|
+
usePublishState,
|
|
16294
16359
|
contextFilters,
|
|
16295
|
-
contextProfile,
|
|
16296
16360
|
matchUpFilters,
|
|
16361
|
+
contextProfile,
|
|
16297
16362
|
nextMatchUps,
|
|
16298
16363
|
tournamentId,
|
|
16299
16364
|
inContext,
|
|
@@ -16336,6 +16401,7 @@ function eventMatchUps(params) {
|
|
|
16336
16401
|
contextProfile,
|
|
16337
16402
|
event
|
|
16338
16403
|
});
|
|
16404
|
+
const publishStatus = getEventPublishStatus({ event });
|
|
16339
16405
|
const drawDefinitions = event.drawDefinitions ?? [];
|
|
16340
16406
|
const eventResult = drawDefinitions.reduce((results, drawDefinition) => {
|
|
16341
16407
|
const drawMatchUpsResult = getDrawMatchUps({
|
|
@@ -16347,12 +16413,14 @@ function eventMatchUps(params) {
|
|
|
16347
16413
|
afterRecoveryTimes,
|
|
16348
16414
|
policyDefinitions,
|
|
16349
16415
|
tournamentRecord,
|
|
16350
|
-
|
|
16416
|
+
usePublishState,
|
|
16351
16417
|
contextContent,
|
|
16352
16418
|
contextFilters,
|
|
16353
|
-
contextProfile,
|
|
16354
16419
|
matchUpFilters,
|
|
16355
16420
|
participantMap,
|
|
16421
|
+
publishStatus,
|
|
16422
|
+
contextProfile,
|
|
16423
|
+
drawDefinition,
|
|
16356
16424
|
nextMatchUps,
|
|
16357
16425
|
inContext,
|
|
16358
16426
|
event
|
|
@@ -16378,12 +16446,14 @@ function drawMatchUps$1({
|
|
|
16378
16446
|
policyDefinitions,
|
|
16379
16447
|
useParticipantMap,
|
|
16380
16448
|
tournamentRecord,
|
|
16449
|
+
usePublishState,
|
|
16381
16450
|
contextFilters,
|
|
16382
|
-
contextProfile,
|
|
16383
16451
|
contextContent,
|
|
16384
|
-
drawDefinition,
|
|
16385
16452
|
matchUpFilters,
|
|
16386
16453
|
participantMap,
|
|
16454
|
+
publishStatus,
|
|
16455
|
+
contextProfile,
|
|
16456
|
+
drawDefinition,
|
|
16387
16457
|
nextMatchUps,
|
|
16388
16458
|
tournamentId,
|
|
16389
16459
|
inContext,
|
|
@@ -16434,12 +16504,14 @@ function drawMatchUps$1({
|
|
|
16434
16504
|
afterRecoveryTimes,
|
|
16435
16505
|
policyDefinitions,
|
|
16436
16506
|
tournamentRecord,
|
|
16507
|
+
usePublishState,
|
|
16437
16508
|
participantMap,
|
|
16438
|
-
|
|
16439
|
-
matchUpFilters,
|
|
16509
|
+
contextContent,
|
|
16440
16510
|
contextFilters,
|
|
16511
|
+
matchUpFilters,
|
|
16512
|
+
publishStatus,
|
|
16441
16513
|
contextProfile,
|
|
16442
|
-
|
|
16514
|
+
drawDefinition,
|
|
16443
16515
|
nextMatchUps,
|
|
16444
16516
|
inContext,
|
|
16445
16517
|
event
|
|
@@ -17145,6 +17217,7 @@ function competitionMatchUps({
|
|
|
17145
17217
|
participantsProfile,
|
|
17146
17218
|
tournamentRecords,
|
|
17147
17219
|
policyDefinitions,
|
|
17220
|
+
usePublishState,
|
|
17148
17221
|
matchUpFilters,
|
|
17149
17222
|
contextFilters,
|
|
17150
17223
|
nextMatchUps,
|
|
@@ -17160,6 +17233,7 @@ function competitionMatchUps({
|
|
|
17160
17233
|
participantsProfile,
|
|
17161
17234
|
policyDefinitions,
|
|
17162
17235
|
tournamentRecord,
|
|
17236
|
+
usePublishState,
|
|
17163
17237
|
matchUpFilters,
|
|
17164
17238
|
contextFilters,
|
|
17165
17239
|
nextMatchUps,
|
|
@@ -22552,6 +22626,11 @@ function getMatchUpDailyLimits({
|
|
|
22552
22626
|
return { matchUpDailyLimits: dailyLimits };
|
|
22553
22627
|
}
|
|
22554
22628
|
|
|
22629
|
+
function getDrawPublishStatus({ drawDetails, drawId }) {
|
|
22630
|
+
const details = drawDetails?.[drawId]?.publishingDetail;
|
|
22631
|
+
return details?.published;
|
|
22632
|
+
}
|
|
22633
|
+
|
|
22555
22634
|
function scheduledSortedMatchUps({
|
|
22556
22635
|
schedulingProfile,
|
|
22557
22636
|
matchUps = []
|
|
@@ -22676,11 +22755,10 @@ function competitionScheduleMatchUps(params) {
|
|
|
22676
22755
|
status = PUBLIC,
|
|
22677
22756
|
sortCourtsData
|
|
22678
22757
|
} = params;
|
|
22679
|
-
const
|
|
22758
|
+
const tournamentPublishStatus = usePublishState ? getTournamentTimeItem({
|
|
22680
22759
|
tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId()],
|
|
22681
22760
|
itemType: `${PUBLISH}.${STATUS$1}`
|
|
22682
|
-
}).timeItem : void 0;
|
|
22683
|
-
const publishStatus = timeItem?.itemValue?.[status];
|
|
22761
|
+
}).timeItem?.itemValue?.[status] : void 0;
|
|
22684
22762
|
const allCompletedMatchUps = alwaysReturnCompleted ? competitionMatchUps({
|
|
22685
22763
|
...params,
|
|
22686
22764
|
matchUpFilters: {
|
|
@@ -22689,7 +22767,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
22689
22767
|
},
|
|
22690
22768
|
contextFilters: params.contextFilters
|
|
22691
22769
|
}).completedMatchUps : [];
|
|
22692
|
-
if (usePublishState && (!
|
|
22770
|
+
if (usePublishState && (!tournamentPublishStatus || !Object.keys(tournamentPublishStatus).length)) {
|
|
22693
22771
|
return {
|
|
22694
22772
|
completedMatchUps: allCompletedMatchUps,
|
|
22695
22773
|
dateMatchUps: [],
|
|
@@ -22697,7 +22775,12 @@ function competitionScheduleMatchUps(params) {
|
|
|
22697
22775
|
venues
|
|
22698
22776
|
};
|
|
22699
22777
|
}
|
|
22700
|
-
|
|
22778
|
+
let publishedDrawIds, detailsMap;
|
|
22779
|
+
if (usePublishState) {
|
|
22780
|
+
({ drawIds: publishedDrawIds, detailsMap } = getCompetitionPublishedDrawDetails({
|
|
22781
|
+
tournamentRecords
|
|
22782
|
+
}));
|
|
22783
|
+
}
|
|
22701
22784
|
if (publishedDrawIds?.length) {
|
|
22702
22785
|
if (!params.contextFilters)
|
|
22703
22786
|
params.contextFilters = {};
|
|
@@ -22709,34 +22792,34 @@ function competitionScheduleMatchUps(params) {
|
|
|
22709
22792
|
);
|
|
22710
22793
|
}
|
|
22711
22794
|
}
|
|
22712
|
-
if (
|
|
22795
|
+
if (tournamentPublishStatus?.eventIds?.length) {
|
|
22713
22796
|
if (!params.matchUpFilters)
|
|
22714
22797
|
params.matchUpFilters = {};
|
|
22715
22798
|
if (params.matchUpFilters?.eventIds) {
|
|
22716
22799
|
if (!params.matchUpFilters.eventIds.length) {
|
|
22717
|
-
params.matchUpFilters.eventIds =
|
|
22800
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
22718
22801
|
} else {
|
|
22719
22802
|
params.matchUpFilters.eventIds = params.matchUpFilters.eventIds.filter(
|
|
22720
|
-
(eventId) =>
|
|
22803
|
+
(eventId) => tournamentPublishStatus.eventIds.includes(eventId)
|
|
22721
22804
|
);
|
|
22722
22805
|
}
|
|
22723
22806
|
} else {
|
|
22724
|
-
params.matchUpFilters.eventIds =
|
|
22807
|
+
params.matchUpFilters.eventIds = tournamentPublishStatus.eventIds;
|
|
22725
22808
|
}
|
|
22726
22809
|
}
|
|
22727
|
-
if (
|
|
22810
|
+
if (tournamentPublishStatus?.scheduledDates?.length) {
|
|
22728
22811
|
if (!params.matchUpFilters)
|
|
22729
22812
|
params.matchUpFilters = {};
|
|
22730
22813
|
if (params.matchUpFilters.scheduledDates) {
|
|
22731
22814
|
if (!params.matchUpFilters.scheduledDates.length) {
|
|
22732
|
-
params.matchUpFilters.scheduledDates =
|
|
22815
|
+
params.matchUpFilters.scheduledDates = tournamentPublishStatus.scheduledDates;
|
|
22733
22816
|
} else {
|
|
22734
22817
|
params.matchUpFilters.scheduledDates = params.matchUpFilters.scheduledDates.filter(
|
|
22735
|
-
(scheduledDate) =>
|
|
22818
|
+
(scheduledDate) => tournamentPublishStatus.scheduledDates.includes(scheduledDate)
|
|
22736
22819
|
);
|
|
22737
22820
|
}
|
|
22738
22821
|
} else {
|
|
22739
|
-
params.matchUpFilters.scheduledDates =
|
|
22822
|
+
params.matchUpFilters.scheduledDates = tournamentPublishStatus.scheduledDates;
|
|
22740
22823
|
}
|
|
22741
22824
|
}
|
|
22742
22825
|
if (alwaysReturnCompleted) {
|
|
@@ -22755,10 +22838,48 @@ function competitionScheduleMatchUps(params) {
|
|
|
22755
22838
|
matchUpFilters: params.matchUpFilters,
|
|
22756
22839
|
contextFilters: params.contextFilters
|
|
22757
22840
|
});
|
|
22758
|
-
|
|
22841
|
+
let relevantMatchUps = [
|
|
22759
22842
|
...upcomingMatchUps ?? [],
|
|
22760
22843
|
...pendingMatchUps ?? []
|
|
22761
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
|
+
}
|
|
22762
22883
|
const dateMatchUps = sortDateMatchUps ? scheduledSortedMatchUps({ matchUps: relevantMatchUps, schedulingProfile }) : relevantMatchUps;
|
|
22763
22884
|
const courtsData = courts?.map((court) => {
|
|
22764
22885
|
const matchUps = getCourtMatchUps(court);
|
|
@@ -22769,11 +22890,11 @@ function competitionScheduleMatchUps(params) {
|
|
|
22769
22890
|
};
|
|
22770
22891
|
});
|
|
22771
22892
|
const result = {
|
|
22772
|
-
courtsData,
|
|
22773
22893
|
completedMatchUps: alwaysReturnCompleted ? allCompletedMatchUps : completedMatchUps,
|
|
22774
22894
|
// completed matchUps for the filter date
|
|
22775
22895
|
dateMatchUps,
|
|
22776
22896
|
// all incomplete matchUps for the filter date
|
|
22897
|
+
courtsData,
|
|
22777
22898
|
groupInfo,
|
|
22778
22899
|
venues
|
|
22779
22900
|
};
|
|
@@ -22797,26 +22918,28 @@ function competitionScheduleMatchUps(params) {
|
|
|
22797
22918
|
}) : courtMatchUps;
|
|
22798
22919
|
}
|
|
22799
22920
|
}
|
|
22800
|
-
function
|
|
22921
|
+
function getCompetitionPublishedDrawDetails({
|
|
22801
22922
|
tournamentRecords
|
|
22802
22923
|
}) {
|
|
22803
22924
|
const drawIds = [];
|
|
22925
|
+
const detailsMap = {};
|
|
22804
22926
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
22805
22927
|
for (const event of tournamentRecord.events ?? []) {
|
|
22806
|
-
const
|
|
22807
|
-
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
|
|
22815
|
-
|
|
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);
|
|
22816
22939
|
}
|
|
22817
22940
|
}
|
|
22818
22941
|
}
|
|
22819
|
-
return { drawIds };
|
|
22942
|
+
return { drawIds, detailsMap };
|
|
22820
22943
|
}
|
|
22821
22944
|
|
|
22822
22945
|
const { stageOrder } = drawDefinitionConstants;
|
|
@@ -23135,13 +23258,8 @@ function getEventEntries({ eventEntryStatuses, tournamentEvents }) {
|
|
|
23135
23258
|
}
|
|
23136
23259
|
|
|
23137
23260
|
function getEventPublishStatuses({ event }) {
|
|
23138
|
-
const
|
|
23139
|
-
|
|
23140
|
-
element: event,
|
|
23141
|
-
itemType
|
|
23142
|
-
});
|
|
23143
|
-
if (timeItem?.itemValue?.PUBLIC) {
|
|
23144
|
-
const { drawIds: publishedDrawIds = [], seeding } = timeItem.itemValue.PUBLIC || {};
|
|
23261
|
+
const eventPubStatus = getEventPublishStatus({ event });
|
|
23262
|
+
if (eventPubStatus) {
|
|
23145
23263
|
const publishedSeeding = {
|
|
23146
23264
|
published: void 0,
|
|
23147
23265
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
@@ -23149,9 +23267,13 @@ function getEventPublishStatuses({ event }) {
|
|
|
23149
23267
|
drawIds: []
|
|
23150
23268
|
// seeding can be specific to drawIds
|
|
23151
23269
|
};
|
|
23152
|
-
if (seeding) {
|
|
23153
|
-
Object.assign(publishedSeeding,
|
|
23270
|
+
if (eventPubStatus.seeding) {
|
|
23271
|
+
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
23154
23272
|
}
|
|
23273
|
+
const { drawDetails, drawIds } = eventPubStatus;
|
|
23274
|
+
const publishedDrawIds = drawDetails && Object.keys(drawDetails).filter(
|
|
23275
|
+
(drawId) => getDrawPublishStatus({ drawDetails, drawId })
|
|
23276
|
+
) || drawIds || [];
|
|
23155
23277
|
return {
|
|
23156
23278
|
publishedDrawIds,
|
|
23157
23279
|
publishedSeeding
|
|
@@ -24108,7 +24230,7 @@ function getParticipantEntries(params) {
|
|
|
24108
24230
|
const itemIsPrior = consideredMinutes >= scheduledMinutes;
|
|
24109
24231
|
const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
|
|
24110
24232
|
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
24111
|
-
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
|
|
24233
|
+
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join("|");
|
|
24112
24234
|
participantAggregator.scheduleConflicts[key] = {
|
|
24113
24235
|
priorScheduledMatchUpId: scheduleItem.matchUpId,
|
|
24114
24236
|
matchUpIdWithConflict: consideredItem.matchUpId
|
|
@@ -26074,7 +26196,9 @@ function getDrawData(params) {
|
|
|
26074
26196
|
policyDefinitions,
|
|
26075
26197
|
tournamentRecord,
|
|
26076
26198
|
inContext = true,
|
|
26199
|
+
usePublishState,
|
|
26077
26200
|
drawDefinition,
|
|
26201
|
+
publishStatus,
|
|
26078
26202
|
noDeepCopy,
|
|
26079
26203
|
sortConfig,
|
|
26080
26204
|
context,
|
|
@@ -26146,6 +26270,8 @@ function getDrawData(params) {
|
|
|
26146
26270
|
tournamentParticipants,
|
|
26147
26271
|
policyDefinitions,
|
|
26148
26272
|
tournamentRecord,
|
|
26273
|
+
usePublishState,
|
|
26274
|
+
publishStatus,
|
|
26149
26275
|
drawDefinition,
|
|
26150
26276
|
inContext,
|
|
26151
26277
|
structure,
|
|
@@ -26259,11 +26385,7 @@ function getEventData(params) {
|
|
|
26259
26385
|
return { error: MISSING_EVENT };
|
|
26260
26386
|
const { eventId } = event;
|
|
26261
26387
|
const { tournamentId, endDate } = tournamentRecord;
|
|
26262
|
-
const
|
|
26263
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
26264
|
-
event
|
|
26265
|
-
});
|
|
26266
|
-
const publishStatus = timeItem?.itemValue?.[status];
|
|
26388
|
+
const publishStatus = getEventPublishStatus({ event, status });
|
|
26267
26389
|
const { participants: tournamentParticipants } = getParticipants$1({
|
|
26268
26390
|
withGroupings: true,
|
|
26269
26391
|
withEvents: false,
|
|
@@ -26272,9 +26394,51 @@ function getEventData(params) {
|
|
|
26272
26394
|
// order is important!!
|
|
26273
26395
|
tournamentRecord
|
|
26274
26396
|
});
|
|
26275
|
-
const stageFilter = ({ stage }) =>
|
|
26276
|
-
|
|
26277
|
-
|
|
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
|
+
};
|
|
26278
26442
|
const drawDefinitions = event.drawDefinitions || [];
|
|
26279
26443
|
const drawsData = drawDefinitions.filter(drawFilter).map(
|
|
26280
26444
|
(drawDefinition) => (({ drawInfo, structures }) => ({
|
|
@@ -26288,15 +26452,24 @@ function getEventData(params) {
|
|
|
26288
26452
|
noDeepCopy: true,
|
|
26289
26453
|
policyDefinitions,
|
|
26290
26454
|
tournamentRecord,
|
|
26455
|
+
usePublishState,
|
|
26291
26456
|
drawDefinition,
|
|
26457
|
+
publishStatus,
|
|
26292
26458
|
sortConfig,
|
|
26293
26459
|
event
|
|
26294
26460
|
})
|
|
26295
26461
|
)
|
|
26296
|
-
).map(({ structures, ...drawData }) =>
|
|
26297
|
-
|
|
26298
|
-
|
|
26299
|
-
|
|
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);
|
|
26300
26473
|
const { tournamentInfo } = getTournamentInfo({ tournamentRecord });
|
|
26301
26474
|
const venues = tournamentRecord.venues || [];
|
|
26302
26475
|
const venuesData = venues.map(
|
|
@@ -26342,10 +26515,7 @@ function getEventData(params) {
|
|
|
26342
26515
|
eventInfo,
|
|
26343
26516
|
drawsData
|
|
26344
26517
|
};
|
|
26345
|
-
eventData.eventInfo.publish =
|
|
26346
|
-
createdAt: timeItem?.createdAt,
|
|
26347
|
-
state: timeItem?.itemValue
|
|
26348
|
-
};
|
|
26518
|
+
eventData.eventInfo.publish = publishStatus;
|
|
26349
26519
|
return { ...SUCCESS, eventData };
|
|
26350
26520
|
}
|
|
26351
26521
|
|
|
@@ -33348,10 +33518,7 @@ function modifyCollectionDefinition$1({
|
|
|
33348
33518
|
modifications.push({ collectionId, gender });
|
|
33349
33519
|
}
|
|
33350
33520
|
const modifiedTieFormat = definedAttributes(tieFormat);
|
|
33351
|
-
result = validateTieFormat({
|
|
33352
|
-
tieFormat: modifiedTieFormat,
|
|
33353
|
-
eventType: event?.eventType
|
|
33354
|
-
});
|
|
33521
|
+
result = validateTieFormat({ tieFormat: modifiedTieFormat });
|
|
33355
33522
|
if (result.error) {
|
|
33356
33523
|
return decorateResult({ result, stack });
|
|
33357
33524
|
}
|
|
@@ -33622,8 +33789,7 @@ function removeCollectionDefinition$1({
|
|
|
33622
33789
|
matchUp = matchUp ?? result?.matchUp;
|
|
33623
33790
|
const existingTieFormat = result?.tieFormat;
|
|
33624
33791
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33625
|
-
|
|
33626
|
-
result = validateTieFormat({ tieFormat, eventType });
|
|
33792
|
+
result = validateTieFormat({ tieFormat });
|
|
33627
33793
|
if (result.error)
|
|
33628
33794
|
return decorateResult({ result, stack });
|
|
33629
33795
|
const targetCollection = tieFormat?.collectionDefinitions?.find(
|
|
@@ -33760,7 +33926,7 @@ function removeCollectionDefinition$1({
|
|
|
33760
33926
|
});
|
|
33761
33927
|
}
|
|
33762
33928
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33763
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
33929
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33764
33930
|
if (result.error)
|
|
33765
33931
|
return decorateResult({ result, stack });
|
|
33766
33932
|
if (eventId && event) {
|
|
@@ -33852,8 +34018,7 @@ function addCollectionDefinition$1({
|
|
|
33852
34018
|
matchUp = matchUp ?? result?.matchUp;
|
|
33853
34019
|
const existingTieFormat = matchUp?.tieFormat ?? result?.tieFormat;
|
|
33854
34020
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33855
|
-
|
|
33856
|
-
result = validateTieFormat({ tieFormat, eventType });
|
|
34021
|
+
result = validateTieFormat({ tieFormat });
|
|
33857
34022
|
if (result?.error) {
|
|
33858
34023
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33859
34024
|
}
|
|
@@ -33888,7 +34053,7 @@ function addCollectionDefinition$1({
|
|
|
33888
34053
|
const addedMatchUps = [];
|
|
33889
34054
|
let targetMatchUps = [];
|
|
33890
34055
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33891
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat
|
|
34056
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33892
34057
|
if (result?.error) {
|
|
33893
34058
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33894
34059
|
}
|
|
@@ -34176,10 +34341,7 @@ function collectionGroupUpdate({
|
|
|
34176
34341
|
event
|
|
34177
34342
|
});
|
|
34178
34343
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
34179
|
-
const result = validateTieFormat({
|
|
34180
|
-
eventType: event?.eventType,
|
|
34181
|
-
tieFormat: prunedTieFormat
|
|
34182
|
-
});
|
|
34344
|
+
const result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
34183
34345
|
if (result.error)
|
|
34184
34346
|
return result;
|
|
34185
34347
|
if (eventId && event) {
|
|
@@ -34229,7 +34391,7 @@ function removeCollectionGroup$1({
|
|
|
34229
34391
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34230
34392
|
const wasAggregateValue = existingTieFormat?.winCriteria.aggregateValue;
|
|
34231
34393
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34232
|
-
result = validateTieFormat({ tieFormat
|
|
34394
|
+
result = validateTieFormat({ tieFormat });
|
|
34233
34395
|
if (result.error)
|
|
34234
34396
|
return decorateResult({ result, stack });
|
|
34235
34397
|
const modifiedCollectionIds = [];
|
|
@@ -34316,7 +34478,7 @@ function addCollectionGroup$1({
|
|
|
34316
34478
|
const existingTieFormat = result?.tieFormat;
|
|
34317
34479
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34318
34480
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34319
|
-
result = validateTieFormat({ tieFormat
|
|
34481
|
+
result = validateTieFormat({ tieFormat });
|
|
34320
34482
|
if (result.error)
|
|
34321
34483
|
return decorateResult({ result, stack });
|
|
34322
34484
|
for (const collectionDefinition of tieFormat.collectionDefinitions) {
|
|
@@ -34380,10 +34542,7 @@ function modifyTieFormat$1({
|
|
|
34380
34542
|
event
|
|
34381
34543
|
}) {
|
|
34382
34544
|
const stack = "modifyTieFormat";
|
|
34383
|
-
if (!validateTieFormat({
|
|
34384
|
-
tieFormat: modifiedTieFormat,
|
|
34385
|
-
eventType: event?.eventType
|
|
34386
|
-
}).valid) {
|
|
34545
|
+
if (!validateTieFormat({ tieFormat: modifiedTieFormat }).valid) {
|
|
34387
34546
|
return decorateResult({
|
|
34388
34547
|
result: { error: INVALID_TIE_FORMAT },
|
|
34389
34548
|
info: "falied validation",
|
|
@@ -42945,8 +43104,7 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
42945
43104
|
const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
|
|
42946
43105
|
let { tieFormat, matchUpType } = params;
|
|
42947
43106
|
if (tieFormat) {
|
|
42948
|
-
const
|
|
42949
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
43107
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
42950
43108
|
if (result2.error)
|
|
42951
43109
|
return result2;
|
|
42952
43110
|
}
|
|
@@ -45413,8 +45571,7 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
45413
45571
|
return { error: INVALID_DRAW_SIZE };
|
|
45414
45572
|
let { tieFormat, matchUpType } = params;
|
|
45415
45573
|
if (tieFormat) {
|
|
45416
|
-
const
|
|
45417
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
45574
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
45418
45575
|
if (result2.error)
|
|
45419
45576
|
return result2;
|
|
45420
45577
|
}
|
|
@@ -51416,13 +51573,12 @@ function addParticipantContext(params) {
|
|
|
51416
51573
|
(extensionKey) => eventInfo[extensionKey] = event[extensionKey]
|
|
51417
51574
|
);
|
|
51418
51575
|
const eventEntries = event.entries || [];
|
|
51419
|
-
const
|
|
51420
|
-
|
|
51421
|
-
|
|
51422
|
-
|
|
51423
|
-
|
|
51424
|
-
|
|
51425
|
-
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 ?? [];
|
|
51426
51582
|
const publishedSeeding = {
|
|
51427
51583
|
published: void 0,
|
|
51428
51584
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
@@ -51431,7 +51587,7 @@ function addParticipantContext(params) {
|
|
|
51431
51587
|
// seeding can be specific to drawIds
|
|
51432
51588
|
};
|
|
51433
51589
|
if (seeding)
|
|
51434
|
-
Object.assign(publishedSeeding,
|
|
51590
|
+
Object.assign(publishedSeeding, pubStatus.seeding);
|
|
51435
51591
|
eventsPublishStatuses[eventId] = {
|
|
51436
51592
|
publishedDrawIds,
|
|
51437
51593
|
publishedSeeding
|
|
@@ -53116,6 +53272,27 @@ const participantGovernor = {
|
|
|
53116
53272
|
getParticipants: getParticipants$1
|
|
53117
53273
|
};
|
|
53118
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
|
+
|
|
53119
53296
|
function publishEventSeeding({
|
|
53120
53297
|
removePriorValues = true,
|
|
53121
53298
|
stageSeedingScaleNames,
|
|
@@ -53129,31 +53306,27 @@ function publishEventSeeding({
|
|
|
53129
53306
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53130
53307
|
if (!event)
|
|
53131
53308
|
return { error: MISSING_EVENT };
|
|
53132
|
-
const
|
|
53133
|
-
const
|
|
53134
|
-
|
|
53135
|
-
event
|
|
53136
|
-
});
|
|
53137
|
-
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53138
|
-
const updatedSeedingScaleNames = (itemValue[status].seeding?.seedingScaleNames || seedingScaleNames) && {
|
|
53139
|
-
...itemValue[status].seeding?.seedingScaleNames,
|
|
53309
|
+
const eventPubStatus = getEventPublishStatus({ event, status });
|
|
53310
|
+
const updatedSeedingScaleNames = (eventPubStatus?.seeding?.seedingScaleNames || seedingScaleNames) && {
|
|
53311
|
+
...eventPubStatus?.seeding?.seedingScaleNames,
|
|
53140
53312
|
...seedingScaleNames
|
|
53141
53313
|
};
|
|
53142
|
-
const updatedStageSeedingScaleNames = (
|
|
53143
|
-
...
|
|
53314
|
+
const updatedStageSeedingScaleNames = (eventPubStatus?.seeding?.stageSeedingScaleNames || stageSeedingScaleNames) && {
|
|
53315
|
+
...eventPubStatus?.seeding?.stageSeedingScaleNames,
|
|
53144
53316
|
...stageSeedingScaleNames
|
|
53145
53317
|
};
|
|
53146
|
-
|
|
53318
|
+
const seeding = definedAttributes({
|
|
53147
53319
|
stageSeedingScaleNames: updatedStageSeedingScaleNames,
|
|
53148
53320
|
seedingScaleNames: updatedSeedingScaleNames,
|
|
53149
53321
|
published: true,
|
|
53150
53322
|
drawIds
|
|
53151
53323
|
});
|
|
53152
|
-
|
|
53153
|
-
|
|
53154
|
-
|
|
53155
|
-
|
|
53156
|
-
|
|
53324
|
+
modifyEventPublishStatus({
|
|
53325
|
+
statusObject: { seeding },
|
|
53326
|
+
removePriorValues,
|
|
53327
|
+
status,
|
|
53328
|
+
event
|
|
53329
|
+
});
|
|
53157
53330
|
addNotice({
|
|
53158
53331
|
topic: PUBLISH_EVENT_SEEDING,
|
|
53159
53332
|
payload: {
|
|
@@ -53169,6 +53342,7 @@ function unPublishEventSeeding({
|
|
|
53169
53342
|
seedingScaleNames,
|
|
53170
53343
|
tournamentRecord,
|
|
53171
53344
|
status = PUBLIC,
|
|
53345
|
+
drawIds,
|
|
53172
53346
|
stages,
|
|
53173
53347
|
event
|
|
53174
53348
|
}) {
|
|
@@ -53176,34 +53350,39 @@ function unPublishEventSeeding({
|
|
|
53176
53350
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53177
53351
|
if (!event)
|
|
53178
53352
|
return { error: MISSING_EVENT };
|
|
53179
|
-
const
|
|
53180
|
-
|
|
53181
|
-
|
|
53182
|
-
|
|
53183
|
-
});
|
|
53184
|
-
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53185
|
-
if (itemValue[status]) {
|
|
53186
|
-
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) {
|
|
53187
53357
|
for (const stage of stages) {
|
|
53188
|
-
if (
|
|
53189
|
-
delete
|
|
53358
|
+
if (seeding.stageSeedingScaleNames[stage]) {
|
|
53359
|
+
delete seeding.stageSeedingScaleNames[stage];
|
|
53190
53360
|
}
|
|
53191
53361
|
}
|
|
53192
53362
|
}
|
|
53193
|
-
if (Array.isArray(seedingScaleNames) &&
|
|
53194
|
-
|
|
53363
|
+
if (Array.isArray(seedingScaleNames) && seeding?.seedingScaleNames) {
|
|
53364
|
+
seeding.seedingScaleNames = seeding.seedingScaleNames.filter(
|
|
53195
53365
|
(scaleName) => !seedingScaleNames.includes(scaleName)
|
|
53196
53366
|
);
|
|
53197
53367
|
}
|
|
53198
|
-
if (
|
|
53199
|
-
|
|
53368
|
+
if (Array.isArray(drawIds) && seeding?.drawIds) {
|
|
53369
|
+
seeding.drawIds = seeding.drawIds.filter(
|
|
53370
|
+
(drawId) => !drawIds.includes(drawId)
|
|
53371
|
+
);
|
|
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;
|
|
53200
53378
|
}
|
|
53379
|
+
modifyEventPublishStatus({
|
|
53380
|
+
statusObject: { seeding },
|
|
53381
|
+
removePriorValues,
|
|
53382
|
+
status,
|
|
53383
|
+
event
|
|
53384
|
+
});
|
|
53201
53385
|
}
|
|
53202
|
-
const updatedTimeItem = {
|
|
53203
|
-
itemValue,
|
|
53204
|
-
itemType
|
|
53205
|
-
};
|
|
53206
|
-
addEventTimeItem({ event, timeItem: updatedTimeItem, removePriorValues });
|
|
53207
53386
|
addNotice({
|
|
53208
53387
|
topic: UNPUBLISH_EVENT_SEEDING,
|
|
53209
53388
|
payload: {
|
|
@@ -53289,13 +53468,10 @@ function getAllEventData({ tournamentRecord, policyDefinitions }) {
|
|
|
53289
53468
|
}
|
|
53290
53469
|
};
|
|
53291
53470
|
});
|
|
53292
|
-
const
|
|
53293
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
53294
|
-
event
|
|
53295
|
-
});
|
|
53471
|
+
const publish = getEventPublishStatus({ event });
|
|
53296
53472
|
Object.assign(eventInfo, {
|
|
53297
|
-
|
|
53298
|
-
|
|
53473
|
+
drawsData,
|
|
53474
|
+
publish
|
|
53299
53475
|
});
|
|
53300
53476
|
return eventInfo;
|
|
53301
53477
|
});
|
|
@@ -53303,6 +53479,49 @@ function getAllEventData({ tournamentRecord, policyDefinitions }) {
|
|
|
53303
53479
|
return { allEventData };
|
|
53304
53480
|
}
|
|
53305
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
|
+
|
|
53306
53525
|
function unPublishEvent({
|
|
53307
53526
|
removePriorValues = true,
|
|
53308
53527
|
tournamentRecord,
|
|
@@ -53320,9 +53539,20 @@ function unPublishEvent({
|
|
|
53320
53539
|
});
|
|
53321
53540
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
53322
53541
|
delete itemValue[status].structureIds;
|
|
53542
|
+
delete itemValue[status].drawDetails;
|
|
53323
53543
|
delete itemValue[status].drawIds;
|
|
53324
53544
|
const updatedTimeItem = { itemValue, itemType };
|
|
53325
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
|
+
});
|
|
53326
53556
|
addNotice({
|
|
53327
53557
|
topic: UNPUBLISH_EVENT,
|
|
53328
53558
|
payload: {
|
|
@@ -53334,7 +53564,6 @@ function unPublishEvent({
|
|
|
53334
53564
|
}
|
|
53335
53565
|
|
|
53336
53566
|
function publishEvent(params) {
|
|
53337
|
-
let { policyDefinitions, drawIds, structureIds, stages } = params;
|
|
53338
53567
|
const {
|
|
53339
53568
|
includePositionAssignments,
|
|
53340
53569
|
removePriorValues,
|
|
@@ -53342,67 +53571,128 @@ function publishEvent(params) {
|
|
|
53342
53571
|
status = PUBLIC,
|
|
53343
53572
|
event,
|
|
53344
53573
|
drawIdsToRemove,
|
|
53345
|
-
drawIdsToAdd
|
|
53346
|
-
stagesToRemove,
|
|
53347
|
-
stagesToAdd,
|
|
53348
|
-
structureIdsToRemove,
|
|
53349
|
-
structureIdsToAdd
|
|
53574
|
+
drawIdsToAdd
|
|
53350
53575
|
} = params;
|
|
53351
53576
|
if (!tournamentRecord)
|
|
53352
53577
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53353
53578
|
if (!event)
|
|
53354
53579
|
return { error: MISSING_EVENT };
|
|
53355
|
-
|
|
53356
|
-
|
|
53357
|
-
|
|
53358
|
-
|
|
53359
|
-
|
|
53580
|
+
const { appliedPolicies } = getAppliedPolicies({ tournamentRecord, event });
|
|
53581
|
+
const policyDefinitions = {
|
|
53582
|
+
...appliedPolicies,
|
|
53583
|
+
...params.policyDefinitions
|
|
53584
|
+
};
|
|
53360
53585
|
const eventDrawIds = event.drawDefinitions?.map(({ drawId }) => drawId) ?? [];
|
|
53361
|
-
const
|
|
53362
|
-
|
|
53363
|
-
|
|
53364
|
-
|
|
53365
|
-
|
|
53366
|
-
|
|
53367
|
-
} else if (!drawIds && (drawIdsToAdd?.length || drawIdsToRemove?.length)) {
|
|
53368
|
-
drawIds = timeItem?.itemValue?.PUBLIC?.drawIds || [];
|
|
53369
|
-
}
|
|
53370
|
-
drawIds = (drawIds ?? []).filter(
|
|
53371
|
-
(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
|
|
53372
53592
|
);
|
|
53373
|
-
|
|
53374
|
-
|
|
53375
|
-
drawIds.concat(
|
|
53376
|
-
...drawIdsToAdd.filter((drawId) => eventDrawIds.includes(drawId))
|
|
53377
|
-
)
|
|
53378
|
-
);
|
|
53379
|
-
}
|
|
53380
|
-
if (!structureIds && (structureIdsToAdd?.length || structureIdsToRemove?.length)) {
|
|
53381
|
-
structureIds = timeItem?.itemValue?.PUBLIC?.structureIds || [];
|
|
53382
|
-
}
|
|
53383
|
-
structureIds = (structureIds ?? []).filter(
|
|
53384
|
-
(structureId) => !structureIdsToRemove?.length || !structureIdsToRemove.includes(structureId)
|
|
53593
|
+
const invalidDrawIds = drawIdsToValidate.filter(
|
|
53594
|
+
(drawId) => !eventDrawIds.includes(drawId)
|
|
53385
53595
|
);
|
|
53386
|
-
if (
|
|
53387
|
-
|
|
53388
|
-
|
|
53389
|
-
|
|
53390
|
-
|
|
53596
|
+
if (invalidDrawIds.length) {
|
|
53597
|
+
return decorateResult({
|
|
53598
|
+
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
53599
|
+
context: { invalidDrawIds }
|
|
53600
|
+
});
|
|
53391
53601
|
}
|
|
53392
|
-
|
|
53393
|
-
|
|
53394
|
-
)
|
|
53395
|
-
|
|
53396
|
-
|
|
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
|
+
}
|
|
53397
53689
|
}
|
|
53398
|
-
|
|
53399
|
-
|
|
53400
|
-
|
|
53401
|
-
|
|
53402
|
-
|
|
53403
|
-
|
|
53404
|
-
};
|
|
53405
|
-
addEventTimeItem({ event, timeItem: updatedTimeItem, removePriorValues });
|
|
53690
|
+
modifyEventPublishStatus({
|
|
53691
|
+
statusObject: { drawDetails },
|
|
53692
|
+
removePriorValues,
|
|
53693
|
+
status,
|
|
53694
|
+
event
|
|
53695
|
+
});
|
|
53406
53696
|
const { eventData } = getEventData({
|
|
53407
53697
|
includePositionAssignments,
|
|
53408
53698
|
usePublishState: true,
|
|
@@ -53410,10 +53700,6 @@ function publishEvent(params) {
|
|
|
53410
53700
|
policyDefinitions,
|
|
53411
53701
|
event
|
|
53412
53702
|
});
|
|
53413
|
-
const publishState = eventData?.eventInfo?.publish?.state;
|
|
53414
|
-
eventData.drawsData = eventData.drawsData.filter(
|
|
53415
|
-
({ drawId }) => publishState?.PUBLIC?.drawIds.includes(drawId)
|
|
53416
|
-
);
|
|
53417
53703
|
addNotice({
|
|
53418
53704
|
payload: { eventData, tournamentId: tournamentRecord.tournamentId },
|
|
53419
53705
|
topic: PUBLISH_EVENT
|
|
@@ -53430,6 +53716,7 @@ const publishingGovernor = {
|
|
|
53430
53716
|
getDrawData,
|
|
53431
53717
|
unPublishEventSeeding,
|
|
53432
53718
|
publishEventSeeding,
|
|
53719
|
+
setEventDisplay,
|
|
53433
53720
|
unPublishEvent,
|
|
53434
53721
|
publishEvent,
|
|
53435
53722
|
unPublishOrderOfPlay: unPublishOrderOfPlay$1,
|
|
@@ -53864,7 +54151,7 @@ function generateLineUps(params) {
|
|
|
53864
54151
|
if (!tieFormat && !drawDefinition)
|
|
53865
54152
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
53866
54153
|
tieFormat = tieFormat ?? resolveTieFormat({ drawDefinition, event })?.tieFormat;
|
|
53867
|
-
if (validateTieFormat({ tieFormat
|
|
54154
|
+
if (validateTieFormat({ tieFormat }).error)
|
|
53868
54155
|
return { error: INVALID_TIE_FORMAT };
|
|
53869
54156
|
if (typeof scaleAccessor !== "object" && !useDefaultEventRanking)
|
|
53870
54157
|
return { error: INVALID_VALUES, context: { scaleAccessor } };
|
|
@@ -56524,6 +56811,9 @@ function deleteDrawDefinitions(params) {
|
|
|
56524
56811
|
bye
|
|
56525
56812
|
}) => ({ bye, qualifier, drawPosition, participantId });
|
|
56526
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;
|
|
56527
56817
|
const drawIdsWithScoresPresent = [];
|
|
56528
56818
|
const filteredDrawDefinitions = event.drawDefinitions.filter(
|
|
56529
56819
|
(drawDefinition) => {
|
|
@@ -56545,6 +56835,10 @@ function deleteDrawDefinitions(params) {
|
|
|
56545
56835
|
(entry) => STRUCTURE_ENTERED_TYPES.includes(entry.entryStatus)
|
|
56546
56836
|
);
|
|
56547
56837
|
}
|
|
56838
|
+
if (updatedDrawIds.includes(drawId2)) {
|
|
56839
|
+
updatedDrawIds = updatedDrawIds.filter((id) => id !== drawId2);
|
|
56840
|
+
publishedDrawsDeleted = true;
|
|
56841
|
+
}
|
|
56548
56842
|
const mainStructure = getDrawStructures({
|
|
56549
56843
|
stageSequence: 1,
|
|
56550
56844
|
drawDefinition,
|
|
@@ -56616,29 +56910,19 @@ function deleteDrawDefinitions(params) {
|
|
|
56616
56910
|
addEventExtension$1({ event, extension });
|
|
56617
56911
|
}
|
|
56618
56912
|
checkSchedulingProfile({ tournamentRecord });
|
|
56619
|
-
|
|
56620
|
-
|
|
56621
|
-
|
|
56622
|
-
|
|
56623
|
-
|
|
56624
|
-
const drawPublished = publishStatus?.drawIds?.includes(drawId2);
|
|
56625
|
-
if (drawPublished) {
|
|
56626
|
-
publishedDrawsDeleted = true;
|
|
56627
|
-
const updatedDrawIds = publishStatus.drawIds?.filter(
|
|
56628
|
-
(publishedDrawId) => publishedDrawId !== drawId2
|
|
56629
|
-
) || [];
|
|
56630
|
-
const timeItem2 = {
|
|
56631
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
56632
|
-
itemValue: {
|
|
56633
|
-
[PUBLIC]: {
|
|
56634
|
-
drawIds: updatedDrawIds
|
|
56635
|
-
}
|
|
56636
|
-
}
|
|
56913
|
+
if (publishedDrawsDeleted) {
|
|
56914
|
+
const drawDetails = {};
|
|
56915
|
+
for (const drawId2 of updatedDrawIds) {
|
|
56916
|
+
drawDetails[drawId2] = publishStatus.drawDetails?.[drawId2] ?? {
|
|
56917
|
+
published: true
|
|
56637
56918
|
};
|
|
56638
|
-
const result = addEventTimeItem({ event, timeItem: timeItem2 });
|
|
56639
|
-
if (result.error)
|
|
56640
|
-
return { error: result.error };
|
|
56641
56919
|
}
|
|
56920
|
+
const result = modifyEventPublishStatus({
|
|
56921
|
+
statusObject: { drawDetails },
|
|
56922
|
+
event
|
|
56923
|
+
});
|
|
56924
|
+
if (result.error)
|
|
56925
|
+
return { error: result.error };
|
|
56642
56926
|
}
|
|
56643
56927
|
if (auditTrail.length) {
|
|
56644
56928
|
addNotice({ topic: AUDIT, payload: auditTrail });
|
|
@@ -56654,9 +56938,14 @@ function deleteDrawDefinitions(params) {
|
|
|
56654
56938
|
});
|
|
56655
56939
|
addDrawDeletionTelemetry({ event, deletedDrawsDetail, auditData });
|
|
56656
56940
|
if (autoPublish && publishedDrawsDeleted) {
|
|
56657
|
-
const result = publishEvent({
|
|
56941
|
+
const result = publishEvent({
|
|
56942
|
+
drawIdsToRemove: drawIds,
|
|
56943
|
+
policyDefinitions,
|
|
56944
|
+
tournamentRecord,
|
|
56945
|
+
event
|
|
56946
|
+
});
|
|
56658
56947
|
if (result.error)
|
|
56659
|
-
|
|
56948
|
+
return { ...SUCCESS, info: result.error };
|
|
56660
56949
|
}
|
|
56661
56950
|
return { ...SUCCESS };
|
|
56662
56951
|
}
|
|
@@ -57291,10 +57580,7 @@ function addEvent({
|
|
|
57291
57580
|
};
|
|
57292
57581
|
if (event.eventType === TypeEnum.Team) {
|
|
57293
57582
|
if (event.tieFormat) {
|
|
57294
|
-
const result = validateTieFormat({
|
|
57295
|
-
tieFormat: event.tieFormat,
|
|
57296
|
-
eventType: event.eventType
|
|
57297
|
-
});
|
|
57583
|
+
const result = validateTieFormat({ tieFormat: event.tieFormat });
|
|
57298
57584
|
if (result.error)
|
|
57299
57585
|
return result;
|
|
57300
57586
|
} else if (event.tieFormatName) {
|
|
@@ -59705,8 +59991,7 @@ function generateDrawDefinition(params) {
|
|
|
59705
59991
|
const result = validateTieFormat({
|
|
59706
59992
|
gender: event?.gender,
|
|
59707
59993
|
enforceGender,
|
|
59708
|
-
tieFormat
|
|
59709
|
-
event
|
|
59994
|
+
tieFormat
|
|
59710
59995
|
});
|
|
59711
59996
|
if (result.error)
|
|
59712
59997
|
return decorateResult({ result, stack });
|
|
@@ -59725,10 +60010,7 @@ function generateDrawDefinition(params) {
|
|
|
59725
60010
|
const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
|
|
59726
60011
|
if (!equivalentInScope) {
|
|
59727
60012
|
if (tieFormat) {
|
|
59728
|
-
const result = checkTieFormat({
|
|
59729
|
-
eventType: event.eventType,
|
|
59730
|
-
tieFormat
|
|
59731
|
-
});
|
|
60013
|
+
const result = checkTieFormat({ tieFormat });
|
|
59732
60014
|
if (result.error)
|
|
59733
60015
|
return decorateResult({ result, stack });
|
|
59734
60016
|
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|
|
@@ -60059,7 +60341,7 @@ function generateDrawDefinition(params) {
|
|
|
60059
60341
|
drawDefinition.links.push(link);
|
|
60060
60342
|
}
|
|
60061
60343
|
drawDefinition.drawName = params.drawName ?? (drawType && constantToString(drawType));
|
|
60062
|
-
if (typeof voluntaryConsolation === "object") {
|
|
60344
|
+
if (typeof voluntaryConsolation === "object" && drawSize >= 4) {
|
|
60063
60345
|
addVoluntaryConsolationStructure({
|
|
60064
60346
|
...voluntaryConsolation,
|
|
60065
60347
|
tournamentRecord,
|
|
@@ -61010,10 +61292,8 @@ function bulkUpdatePublishedEventIds({ tournamentRecord, outcomes }) {
|
|
|
61010
61292
|
if (eventId && drawId) {
|
|
61011
61293
|
if (!eventIdsMap2[eventId]) {
|
|
61012
61294
|
eventIdsMap2[eventId] = [drawId];
|
|
61013
|
-
} else {
|
|
61014
|
-
|
|
61015
|
-
eventIdsMap2[eventId].push(drawId);
|
|
61016
|
-
}
|
|
61295
|
+
} else if (!eventIdsMap2[eventId].includes(drawId)) {
|
|
61296
|
+
eventIdsMap2[eventId].push(drawId);
|
|
61017
61297
|
}
|
|
61018
61298
|
}
|
|
61019
61299
|
return eventIdsMap2;
|
|
@@ -61023,14 +61303,14 @@ function bulkUpdatePublishedEventIds({ tournamentRecord, outcomes }) {
|
|
|
61023
61303
|
(event) => relevantEventsIds.includes(event.eventId)
|
|
61024
61304
|
);
|
|
61025
61305
|
const publishedEventIds = relevantEvents.filter((event) => {
|
|
61026
|
-
const
|
|
61027
|
-
|
|
61028
|
-
event
|
|
61029
|
-
});
|
|
61030
|
-
const pubState = timeItem?.itemValue;
|
|
61306
|
+
const pubStatus = getEventPublishStatus({ event });
|
|
61307
|
+
const { drawDetails, drawIds } = pubStatus ?? {};
|
|
61031
61308
|
const { eventId } = event;
|
|
61032
61309
|
const publishedDrawIds = eventIdsMap[eventId].filter((drawId) => {
|
|
61033
|
-
|
|
61310
|
+
const keyedDrawIds = drawDetails ? Object.keys(pubStatus.drawDetails).filter(
|
|
61311
|
+
(drawId2) => getDrawPublishStatus({ drawId: drawId2, drawDetails })
|
|
61312
|
+
) : [];
|
|
61313
|
+
return drawIds?.includes(drawId) || keyedDrawIds.includes(drawId);
|
|
61034
61314
|
});
|
|
61035
61315
|
return publishedDrawIds.length;
|
|
61036
61316
|
}).map((event) => event.eventId);
|