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/forge/generate.mjs
CHANGED
|
@@ -1214,7 +1214,7 @@ function isString(obj) {
|
|
|
1214
1214
|
return typeof obj === "string";
|
|
1215
1215
|
}
|
|
1216
1216
|
function isObject(obj) {
|
|
1217
|
-
return typeof obj === "object";
|
|
1217
|
+
return obj !== null && typeof obj === "object";
|
|
1218
1218
|
}
|
|
1219
1219
|
const extractAttributes = (accessor) => (element) => !accessor || typeof element !== "object" ? void 0 : Array.isArray(accessor) && accessor.map((a) => ({
|
|
1220
1220
|
[a]: getAccessorValue({ element, accessor: a })?.value
|
|
@@ -2214,6 +2214,7 @@ const RESUME_TIME = "SCHEDULE.TIME.RESUME";
|
|
|
2214
2214
|
const END_TIME = "SCHEDULE.TIME.END";
|
|
2215
2215
|
const TIME_MODIFIERS = "SCHEDULE.TIME.MODIFIERS";
|
|
2216
2216
|
const PUBLISH = "PUBLISH";
|
|
2217
|
+
const PUBLIC = "PUBLIC";
|
|
2217
2218
|
const STATUS = "STATUS";
|
|
2218
2219
|
|
|
2219
2220
|
function getTimeStamp(item) {
|
|
@@ -2436,8 +2437,10 @@ function getMatchUpScheduleDetails({
|
|
|
2436
2437
|
scheduleVisibilityFilters,
|
|
2437
2438
|
afterRecoveryTimes,
|
|
2438
2439
|
tournamentRecord,
|
|
2440
|
+
usePublishState,
|
|
2439
2441
|
scheduleTiming,
|
|
2440
2442
|
matchUpFormat,
|
|
2443
|
+
publishStatus,
|
|
2441
2444
|
matchUpType,
|
|
2442
2445
|
matchUp,
|
|
2443
2446
|
event
|
|
@@ -2554,15 +2557,36 @@ function getMatchUpScheduleDetails({
|
|
|
2554
2557
|
});
|
|
2555
2558
|
} else {
|
|
2556
2559
|
schedule = definedAttributes({
|
|
2557
|
-
|
|
2560
|
+
milliseconds,
|
|
2558
2561
|
startTime,
|
|
2559
2562
|
endTime,
|
|
2560
|
-
|
|
2563
|
+
time
|
|
2561
2564
|
});
|
|
2562
2565
|
}
|
|
2563
|
-
const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
2564
2566
|
const { scheduledDate } = scheduledMatchUpDate({ matchUp });
|
|
2565
2567
|
const { scheduledTime } = scheduledMatchUpTime({ matchUp });
|
|
2568
|
+
if (usePublishState && publishStatus?.displaySettings?.draws) {
|
|
2569
|
+
const drawSettings = publishStatus.displaySettings.draws;
|
|
2570
|
+
const scheduleDetails = (drawSettings?.[matchUp.drawId] ?? drawSettings?.default)?.scheduleDetails;
|
|
2571
|
+
if (scheduleDetails) {
|
|
2572
|
+
const scheduleAttributes = (scheduleDetails.find(
|
|
2573
|
+
(details) => scheduledDate && details.dates?.includes(scheduledDate)
|
|
2574
|
+
) ?? scheduleDetails.find((details) => !details.dates?.length))?.attributes;
|
|
2575
|
+
if (scheduleAttributes) {
|
|
2576
|
+
const template = Object.assign(
|
|
2577
|
+
{},
|
|
2578
|
+
...Object.keys(schedule).map((key) => ({ [key]: true })),
|
|
2579
|
+
// overwrite with publishStatus attributes
|
|
2580
|
+
scheduleAttributes
|
|
2581
|
+
);
|
|
2582
|
+
schedule = attributeFilter({
|
|
2583
|
+
source: schedule,
|
|
2584
|
+
template
|
|
2585
|
+
});
|
|
2586
|
+
}
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
const hasCompletedStatus = matchUp.matchUpStatus && completedMatchUpStatuses.includes(matchUp.matchUpStatus);
|
|
2566
2590
|
const endDate = hasCompletedStatus && (extractDate(endTime) || extractDate(scheduledDate) || extractDate(scheduledTime)) || void 0;
|
|
2567
2591
|
return { schedule, endDate };
|
|
2568
2592
|
}
|
|
@@ -4505,6 +4529,7 @@ function getAllStructureMatchUps({
|
|
|
4505
4529
|
policyDefinitions,
|
|
4506
4530
|
tournamentRecord,
|
|
4507
4531
|
seedAssignments,
|
|
4532
|
+
usePublishState,
|
|
4508
4533
|
contextFilters,
|
|
4509
4534
|
contextContent,
|
|
4510
4535
|
matchUpFilters,
|
|
@@ -4512,6 +4537,7 @@ function getAllStructureMatchUps({
|
|
|
4512
4537
|
scheduleTiming,
|
|
4513
4538
|
contextProfile,
|
|
4514
4539
|
drawDefinition,
|
|
4540
|
+
publishStatus,
|
|
4515
4541
|
context = {},
|
|
4516
4542
|
exitProfiles,
|
|
4517
4543
|
matchUpsMap,
|
|
@@ -4620,6 +4646,8 @@ function getAllStructureMatchUps({
|
|
|
4620
4646
|
roundNamingProfile,
|
|
4621
4647
|
initialRoundOfPlay,
|
|
4622
4648
|
appliedPolicies,
|
|
4649
|
+
usePublishState,
|
|
4650
|
+
publishStatus,
|
|
4623
4651
|
isRoundRobin,
|
|
4624
4652
|
roundProfile,
|
|
4625
4653
|
matchUp,
|
|
@@ -4689,6 +4717,8 @@ function getAllStructureMatchUps({
|
|
|
4689
4717
|
tieDrawPositions,
|
|
4690
4718
|
appliedPolicies: appliedPolicies2,
|
|
4691
4719
|
isCollectionBye,
|
|
4720
|
+
usePublishState: usePublishState2,
|
|
4721
|
+
publishStatus: publishStatus2,
|
|
4692
4722
|
matchUpTieId,
|
|
4693
4723
|
isRoundRobin: isRoundRobin2,
|
|
4694
4724
|
roundProfile: roundProfile2,
|
|
@@ -4714,8 +4744,10 @@ function getAllStructureMatchUps({
|
|
|
4714
4744
|
scheduleVisibilityFilters: scheduleVisibilityFilters2,
|
|
4715
4745
|
afterRecoveryTimes,
|
|
4716
4746
|
tournamentRecord,
|
|
4747
|
+
usePublishState: usePublishState2,
|
|
4717
4748
|
scheduleTiming,
|
|
4718
4749
|
matchUpFormat,
|
|
4750
|
+
publishStatus: publishStatus2,
|
|
4719
4751
|
matchUpType,
|
|
4720
4752
|
matchUp,
|
|
4721
4753
|
event: event2
|
|
@@ -4838,7 +4870,7 @@ function getAllStructureMatchUps({
|
|
|
4838
4870
|
Object.assign(matchUpWithContext, makeDeepCopy({ sides }, true, true));
|
|
4839
4871
|
}
|
|
4840
4872
|
if (tournamentParticipants && matchUpWithContext.sides) {
|
|
4841
|
-
const participantAttributes =
|
|
4873
|
+
const participantAttributes = appliedPolicies2?.[POLICY_TYPE_PARTICIPANT];
|
|
4842
4874
|
const getMappedParticipant = (participantId) => {
|
|
4843
4875
|
const participant = participantMap?.[participantId]?.participant;
|
|
4844
4876
|
return participant && attributeFilter({
|
|
@@ -4954,6 +4986,8 @@ function getAllStructureMatchUps({
|
|
|
4954
4986
|
additionalContext: additionalContext2,
|
|
4955
4987
|
appliedPolicies: appliedPolicies2,
|
|
4956
4988
|
isCollectionBye: isCollectionBye2,
|
|
4989
|
+
usePublishState: usePublishState2,
|
|
4990
|
+
publishStatus: publishStatus2,
|
|
4957
4991
|
matchUpTieId: matchUpTieId2,
|
|
4958
4992
|
isRoundRobin: isRoundRobin2,
|
|
4959
4993
|
roundProfile: roundProfile2,
|
|
@@ -5866,6 +5900,64 @@ function getSeedPattern(seedingProfile) {
|
|
|
5866
5900
|
return seedingProfile.positioning;
|
|
5867
5901
|
}
|
|
5868
5902
|
|
|
5903
|
+
function getTimeItem({
|
|
5904
|
+
returnPreviousValues,
|
|
5905
|
+
itemSubTypes,
|
|
5906
|
+
itemType,
|
|
5907
|
+
element
|
|
5908
|
+
}) {
|
|
5909
|
+
if (!element)
|
|
5910
|
+
return { error: MISSING_VALUE, info: ELEMENT_REQUIRED };
|
|
5911
|
+
if (itemSubTypes && !Array.isArray(itemSubTypes))
|
|
5912
|
+
return { error: INVALID_VALUES, context: { itemSubTypes } };
|
|
5913
|
+
if (!Array.isArray(element.timeItems))
|
|
5914
|
+
return { error: MISSING_TIME_ITEMS };
|
|
5915
|
+
const filteredSorted = element.timeItems.filter((timeItem2) => timeItem2?.itemType === itemType).filter(
|
|
5916
|
+
(timeItem2) => !itemSubTypes?.length || itemSubTypes.some(
|
|
5917
|
+
(subType) => timeItem2?.itemSubTypes?.includes(subType)
|
|
5918
|
+
)
|
|
5919
|
+
).sort((a, b) => {
|
|
5920
|
+
const aDate = new Date(a.createdAt || void 0).getTime();
|
|
5921
|
+
const bDate = new Date(b.createdAt || void 0).getTime();
|
|
5922
|
+
return aDate - bDate;
|
|
5923
|
+
});
|
|
5924
|
+
const timeItem = filteredSorted.pop();
|
|
5925
|
+
if (timeItem) {
|
|
5926
|
+
const result = { timeItem, ...SUCCESS };
|
|
5927
|
+
if (returnPreviousValues)
|
|
5928
|
+
Object.assign(result, { previousItems: filteredSorted });
|
|
5929
|
+
return result;
|
|
5930
|
+
} else {
|
|
5931
|
+
return { info: NOT_FOUND };
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
function getEventTimeItem({
|
|
5935
|
+
returnPreviousValues,
|
|
5936
|
+
itemSubTypes,
|
|
5937
|
+
itemType,
|
|
5938
|
+
event
|
|
5939
|
+
}) {
|
|
5940
|
+
if (!event)
|
|
5941
|
+
return { error: MISSING_EVENT };
|
|
5942
|
+
if (!event.timeItems)
|
|
5943
|
+
return { info: NOT_FOUND };
|
|
5944
|
+
const { timeItem, previousItems, info } = getTimeItem({
|
|
5945
|
+
returnPreviousValues,
|
|
5946
|
+
element: event,
|
|
5947
|
+
itemSubTypes,
|
|
5948
|
+
itemType
|
|
5949
|
+
});
|
|
5950
|
+
return timeItem && { timeItem, previousItems } || { info };
|
|
5951
|
+
}
|
|
5952
|
+
|
|
5953
|
+
function getEventPublishStatus({ event, status = PUBLIC }) {
|
|
5954
|
+
const itemType = `${PUBLISH}.${STATUS}`;
|
|
5955
|
+
return getEventTimeItem({
|
|
5956
|
+
itemType,
|
|
5957
|
+
event
|
|
5958
|
+
})?.timeItem?.itemValue?.[status];
|
|
5959
|
+
}
|
|
5960
|
+
|
|
5869
5961
|
function addParticipantGroupings({
|
|
5870
5962
|
participantsProfile,
|
|
5871
5963
|
participants = [],
|
|
@@ -7724,38 +7816,6 @@ function addIndividualParticipants({ participantMap, template }) {
|
|
|
7724
7816
|
}
|
|
7725
7817
|
}
|
|
7726
7818
|
|
|
7727
|
-
function getTimeItem({
|
|
7728
|
-
returnPreviousValues,
|
|
7729
|
-
itemSubTypes,
|
|
7730
|
-
itemType,
|
|
7731
|
-
element
|
|
7732
|
-
}) {
|
|
7733
|
-
if (!element)
|
|
7734
|
-
return { error: MISSING_VALUE, info: ELEMENT_REQUIRED };
|
|
7735
|
-
if (itemSubTypes && !Array.isArray(itemSubTypes))
|
|
7736
|
-
return { error: INVALID_VALUES, context: { itemSubTypes } };
|
|
7737
|
-
if (!Array.isArray(element.timeItems))
|
|
7738
|
-
return { error: MISSING_TIME_ITEMS };
|
|
7739
|
-
const filteredSorted = element.timeItems.filter((timeItem2) => timeItem2?.itemType === itemType).filter(
|
|
7740
|
-
(timeItem2) => !itemSubTypes?.length || itemSubTypes.some(
|
|
7741
|
-
(subType) => timeItem2?.itemSubTypes?.includes(subType)
|
|
7742
|
-
)
|
|
7743
|
-
).sort((a, b) => {
|
|
7744
|
-
const aDate = new Date(a.createdAt || void 0).getTime();
|
|
7745
|
-
const bDate = new Date(b.createdAt || void 0).getTime();
|
|
7746
|
-
return aDate - bDate;
|
|
7747
|
-
});
|
|
7748
|
-
const timeItem = filteredSorted.pop();
|
|
7749
|
-
if (timeItem) {
|
|
7750
|
-
const result = { timeItem, ...SUCCESS };
|
|
7751
|
-
if (returnPreviousValues)
|
|
7752
|
-
Object.assign(result, { previousItems: filteredSorted });
|
|
7753
|
-
return result;
|
|
7754
|
-
} else {
|
|
7755
|
-
return { info: NOT_FOUND };
|
|
7756
|
-
}
|
|
7757
|
-
}
|
|
7758
|
-
|
|
7759
7819
|
const typeMap = {
|
|
7760
7820
|
[GROUP]: "groupParticipantIds",
|
|
7761
7821
|
[PAIR]: "pairParticipantIds",
|
|
@@ -8483,11 +8543,13 @@ function getStructureMatchUps({
|
|
|
8483
8543
|
afterRecoveryTimes,
|
|
8484
8544
|
policyDefinitions,
|
|
8485
8545
|
tournamentRecord,
|
|
8546
|
+
usePublishState,
|
|
8486
8547
|
matchUpFilters,
|
|
8487
8548
|
contextFilters,
|
|
8488
8549
|
contextContent,
|
|
8489
8550
|
participantMap,
|
|
8490
8551
|
scheduleTiming,
|
|
8552
|
+
publishStatus,
|
|
8491
8553
|
contextProfile,
|
|
8492
8554
|
drawDefinition,
|
|
8493
8555
|
exitProfiles,
|
|
@@ -8508,13 +8570,15 @@ function getStructureMatchUps({
|
|
|
8508
8570
|
afterRecoveryTimes,
|
|
8509
8571
|
policyDefinitions,
|
|
8510
8572
|
tournamentRecord,
|
|
8511
|
-
|
|
8573
|
+
usePublishState,
|
|
8512
8574
|
matchUpFilters,
|
|
8513
8575
|
contextFilters,
|
|
8514
|
-
contextProfile,
|
|
8515
8576
|
contextContent,
|
|
8516
8577
|
participantMap,
|
|
8517
8578
|
scheduleTiming,
|
|
8579
|
+
publishStatus,
|
|
8580
|
+
contextProfile,
|
|
8581
|
+
drawDefinition,
|
|
8518
8582
|
exitProfiles,
|
|
8519
8583
|
matchUpsMap,
|
|
8520
8584
|
structure,
|
|
@@ -8610,12 +8674,14 @@ function getDrawMatchUps(params) {
|
|
|
8610
8674
|
afterRecoveryTimes,
|
|
8611
8675
|
policyDefinitions,
|
|
8612
8676
|
tournamentRecord,
|
|
8677
|
+
usePublishState,
|
|
8613
8678
|
contextFilters,
|
|
8614
|
-
contextProfile,
|
|
8615
|
-
drawDefinition,
|
|
8616
8679
|
matchUpFilters,
|
|
8617
8680
|
scheduleTiming,
|
|
8618
8681
|
participantMap,
|
|
8682
|
+
publishStatus,
|
|
8683
|
+
contextProfile,
|
|
8684
|
+
drawDefinition,
|
|
8619
8685
|
nextMatchUps,
|
|
8620
8686
|
inContext,
|
|
8621
8687
|
context,
|
|
@@ -8670,9 +8736,11 @@ function getDrawMatchUps(params) {
|
|
|
8670
8736
|
afterRecoveryTimes,
|
|
8671
8737
|
policyDefinitions,
|
|
8672
8738
|
tournamentRecord,
|
|
8739
|
+
usePublishState,
|
|
8740
|
+
contextContent,
|
|
8673
8741
|
participantMap,
|
|
8674
8742
|
scheduleTiming,
|
|
8675
|
-
|
|
8743
|
+
publishStatus,
|
|
8676
8744
|
contextProfile,
|
|
8677
8745
|
drawDefinition,
|
|
8678
8746
|
exitProfiles,
|
|
@@ -16444,7 +16512,7 @@ function ensureSideLineUps({
|
|
|
16444
16512
|
dualMatchUp,
|
|
16445
16513
|
eventId
|
|
16446
16514
|
}) {
|
|
16447
|
-
if (dualMatchUp
|
|
16515
|
+
if (dualMatchUp) {
|
|
16448
16516
|
if (!inContextDualMatchUp) {
|
|
16449
16517
|
inContextDualMatchUp = findDrawMatchUp({
|
|
16450
16518
|
matchUpId: dualMatchUp.matchUpId,
|
|
@@ -16462,11 +16530,17 @@ function ensureSideLineUps({
|
|
|
16462
16530
|
drawPosition,
|
|
16463
16531
|
sideNumber
|
|
16464
16532
|
}) => ({ drawPosition, sideNumber, displaySideNumber });
|
|
16465
|
-
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((
|
|
16466
|
-
const participantId =
|
|
16533
|
+
dualMatchUp.sides = inContextDualMatchUp?.sides?.map((contextSide) => {
|
|
16534
|
+
const participantId = contextSide.participantId;
|
|
16535
|
+
const referenceLineUp = participantId && lineUps[participantId] || void 0;
|
|
16536
|
+
const { lineUp: noContextLineUp, ...noContextSideDetail } = dualMatchUp.sides?.find(
|
|
16537
|
+
({ sideNumber }) => sideNumber === contextSide.sideNumber
|
|
16538
|
+
) ?? {};
|
|
16539
|
+
const lineUp = noContextLineUp?.length ? noContextLineUp : referenceLineUp;
|
|
16467
16540
|
return {
|
|
16468
|
-
...extractSideDetail(
|
|
16469
|
-
|
|
16541
|
+
...extractSideDetail(contextSide),
|
|
16542
|
+
...noContextSideDetail,
|
|
16543
|
+
lineUp
|
|
16470
16544
|
};
|
|
16471
16545
|
});
|
|
16472
16546
|
modifyMatchUpNotice({
|
|
@@ -16490,8 +16564,7 @@ function tieFormatGenderValidityCheck(params) {
|
|
|
16490
16564
|
context: { gender },
|
|
16491
16565
|
stack
|
|
16492
16566
|
});
|
|
16493
|
-
|
|
16494
|
-
if (referenceGender === MIXED && (eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
16567
|
+
if (referenceGender === MIXED && (gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
16495
16568
|
return decorateResult({
|
|
16496
16569
|
result: { error: INVALID_GENDER, valid: false },
|
|
16497
16570
|
info: mixedGenderError,
|
|
@@ -16882,7 +16955,6 @@ function validateTieFormat(params) {
|
|
|
16882
16955
|
const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
|
|
16883
16956
|
referenceCategory: params.category,
|
|
16884
16957
|
referenceGender: params.gender,
|
|
16885
|
-
eventType: params.eventType,
|
|
16886
16958
|
collectionDefinition,
|
|
16887
16959
|
checkCollectionIds,
|
|
16888
16960
|
checkCategory,
|
|
@@ -16934,7 +17006,6 @@ function validateCollectionDefinition({
|
|
|
16934
17006
|
checkGender = true,
|
|
16935
17007
|
referenceCategory,
|
|
16936
17008
|
referenceGender,
|
|
16937
|
-
eventType,
|
|
16938
17009
|
event
|
|
16939
17010
|
}) {
|
|
16940
17011
|
referenceGender = referenceGender ?? event?.gender;
|
|
@@ -17002,7 +17073,6 @@ function validateCollectionDefinition({
|
|
|
17002
17073
|
}
|
|
17003
17074
|
if (checkGender) {
|
|
17004
17075
|
const result = tieFormatGenderValidityCheck({
|
|
17005
|
-
eventType: eventType ?? event?.eventType,
|
|
17006
17076
|
referenceGender,
|
|
17007
17077
|
matchUpType,
|
|
17008
17078
|
gender
|
|
@@ -17035,12 +17105,10 @@ function validateCollectionDefinition({
|
|
|
17035
17105
|
return { valid: true };
|
|
17036
17106
|
}
|
|
17037
17107
|
function checkTieFormat({
|
|
17038
|
-
tieFormat
|
|
17039
|
-
eventType
|
|
17108
|
+
tieFormat
|
|
17040
17109
|
}) {
|
|
17041
17110
|
const result = validateTieFormat({
|
|
17042
17111
|
checkCollectionIds: false,
|
|
17043
|
-
eventType,
|
|
17044
17112
|
tieFormat
|
|
17045
17113
|
});
|
|
17046
17114
|
if (result.error)
|
|
@@ -17267,7 +17335,7 @@ function generateTieMatchUpScore(params) {
|
|
|
17267
17335
|
const tieFormat = resolveTieFormat({ matchUp, drawDefinition, structure, event })?.tieFormat || params?.tieFormat;
|
|
17268
17336
|
if (!tieFormat)
|
|
17269
17337
|
return { error: MISSING_TIE_FORMAT };
|
|
17270
|
-
const result = validateTieFormat({ tieFormat
|
|
17338
|
+
const result = validateTieFormat({ tieFormat });
|
|
17271
17339
|
if (result.error)
|
|
17272
17340
|
return result;
|
|
17273
17341
|
const collectionDefinitions = tieFormat?.collectionDefinitions || [];
|
|
@@ -18240,14 +18308,14 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
18240
18308
|
};
|
|
18241
18309
|
}
|
|
18242
18310
|
|
|
18311
|
+
function getDrawPublishStatus({ drawDetails, drawId }) {
|
|
18312
|
+
const details = drawDetails?.[drawId]?.publishingDetail;
|
|
18313
|
+
return details?.published;
|
|
18314
|
+
}
|
|
18315
|
+
|
|
18243
18316
|
function getEventPublishStatuses({ event }) {
|
|
18244
|
-
const
|
|
18245
|
-
|
|
18246
|
-
element: event,
|
|
18247
|
-
itemType
|
|
18248
|
-
});
|
|
18249
|
-
if (timeItem?.itemValue?.PUBLIC) {
|
|
18250
|
-
const { drawIds: publishedDrawIds = [], seeding } = timeItem.itemValue.PUBLIC || {};
|
|
18317
|
+
const eventPubStatus = getEventPublishStatus({ event });
|
|
18318
|
+
if (eventPubStatus) {
|
|
18251
18319
|
const publishedSeeding = {
|
|
18252
18320
|
published: void 0,
|
|
18253
18321
|
// seeding can be present for all entries in an event when no flights have been defined
|
|
@@ -18255,9 +18323,13 @@ function getEventPublishStatuses({ event }) {
|
|
|
18255
18323
|
drawIds: []
|
|
18256
18324
|
// seeding can be specific to drawIds
|
|
18257
18325
|
};
|
|
18258
|
-
if (seeding) {
|
|
18259
|
-
Object.assign(publishedSeeding,
|
|
18326
|
+
if (eventPubStatus.seeding) {
|
|
18327
|
+
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
18260
18328
|
}
|
|
18329
|
+
const { drawDetails, drawIds } = eventPubStatus;
|
|
18330
|
+
const publishedDrawIds = drawDetails && Object.keys(drawDetails).filter(
|
|
18331
|
+
(drawId) => getDrawPublishStatus({ drawDetails, drawId })
|
|
18332
|
+
) || drawIds || [];
|
|
18261
18333
|
return {
|
|
18262
18334
|
publishedDrawIds,
|
|
18263
18335
|
publishedSeeding
|
|
@@ -18380,6 +18452,10 @@ function getEventSeedAssignments({
|
|
|
18380
18452
|
return eventSeedAssignments;
|
|
18381
18453
|
}
|
|
18382
18454
|
|
|
18455
|
+
function stringSort(a, b) {
|
|
18456
|
+
return (a || "").localeCompare(b || "");
|
|
18457
|
+
}
|
|
18458
|
+
|
|
18383
18459
|
function processEventEntry({
|
|
18384
18460
|
convertExtensions,
|
|
18385
18461
|
seedAssignments,
|
|
@@ -19010,6 +19086,15 @@ function getParticipantEntries(params) {
|
|
|
19010
19086
|
individualParticipantIds?.forEach(addDrawEntry);
|
|
19011
19087
|
}
|
|
19012
19088
|
}
|
|
19089
|
+
const stages = (drawDefinition?.structures ?? []).reduce(
|
|
19090
|
+
(stages2, structure) => {
|
|
19091
|
+
if (!stages2.includes(structure.stage))
|
|
19092
|
+
stages2.push(structure.stage);
|
|
19093
|
+
return stages2;
|
|
19094
|
+
},
|
|
19095
|
+
[]
|
|
19096
|
+
);
|
|
19097
|
+
const linksCount = (drawDefinition?.links ?? []).length;
|
|
19013
19098
|
derivedDrawInfo[drawId] = {
|
|
19014
19099
|
qualifyingPositionAssignments,
|
|
19015
19100
|
qualifyingSeedAssignments,
|
|
@@ -19019,11 +19104,13 @@ function getParticipantEntries(params) {
|
|
|
19019
19104
|
orderedStructureIds,
|
|
19020
19105
|
mainSeedingMap,
|
|
19021
19106
|
flightNumber,
|
|
19107
|
+
linksCount,
|
|
19022
19108
|
drawOrder,
|
|
19023
19109
|
drawName,
|
|
19024
19110
|
drawType,
|
|
19025
19111
|
drawSize,
|
|
19026
|
-
drawId
|
|
19112
|
+
drawId,
|
|
19113
|
+
stages
|
|
19027
19114
|
// qualifyingDrawSize,
|
|
19028
19115
|
};
|
|
19029
19116
|
}
|
|
@@ -19240,7 +19327,7 @@ function getParticipantEntries(params) {
|
|
|
19240
19327
|
const itemIsPrior = consideredMinutes >= scheduledMinutes;
|
|
19241
19328
|
const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
|
|
19242
19329
|
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
19243
|
-
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
|
|
19330
|
+
const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join("|");
|
|
19244
19331
|
participantAggregator.scheduleConflicts[key] = {
|
|
19245
19332
|
priorScheduledMatchUpId: scheduleItem.matchUpId,
|
|
19246
19333
|
matchUpIdWithConflict: consideredItem.matchUpId
|
|
@@ -20138,8 +20225,7 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
20138
20225
|
return { error: INVALID_DRAW_SIZE };
|
|
20139
20226
|
let { tieFormat, matchUpType } = params;
|
|
20140
20227
|
if (tieFormat) {
|
|
20141
|
-
const
|
|
20142
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
20228
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
20143
20229
|
if (result2.error)
|
|
20144
20230
|
return result2;
|
|
20145
20231
|
}
|
|
@@ -20375,10 +20461,6 @@ function addAdHocMatchUps({
|
|
|
20375
20461
|
return { ...SUCCESS };
|
|
20376
20462
|
}
|
|
20377
20463
|
|
|
20378
|
-
function stringSort(a, b) {
|
|
20379
|
-
return (a || "").localeCompare(b || "");
|
|
20380
|
-
}
|
|
20381
|
-
|
|
20382
20464
|
function generateCandidate({
|
|
20383
20465
|
maxIterations = 4e3,
|
|
20384
20466
|
// cap the processing intensity of the candidate generator
|
|
@@ -21241,8 +21323,7 @@ function generateDrawTypeAndModifyDrawDefinition(params) {
|
|
|
21241
21323
|
const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
|
|
21242
21324
|
let { tieFormat, matchUpType } = params;
|
|
21243
21325
|
if (tieFormat) {
|
|
21244
|
-
const
|
|
21245
|
-
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
21326
|
+
const result2 = validateTieFormat({ tieFormat });
|
|
21246
21327
|
if (result2.error)
|
|
21247
21328
|
return result2;
|
|
21248
21329
|
}
|
|
@@ -23727,8 +23808,7 @@ function generateDrawDefinition(params) {
|
|
|
23727
23808
|
const result = validateTieFormat({
|
|
23728
23809
|
gender: event?.gender,
|
|
23729
23810
|
enforceGender,
|
|
23730
|
-
tieFormat
|
|
23731
|
-
event
|
|
23811
|
+
tieFormat
|
|
23732
23812
|
});
|
|
23733
23813
|
if (result.error)
|
|
23734
23814
|
return decorateResult({ result, stack });
|
|
@@ -23747,10 +23827,7 @@ function generateDrawDefinition(params) {
|
|
|
23747
23827
|
const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
|
|
23748
23828
|
if (!equivalentInScope) {
|
|
23749
23829
|
if (tieFormat) {
|
|
23750
|
-
const result = checkTieFormat({
|
|
23751
|
-
eventType: event.eventType,
|
|
23752
|
-
tieFormat
|
|
23753
|
-
});
|
|
23830
|
+
const result = checkTieFormat({ tieFormat });
|
|
23754
23831
|
if (result.error)
|
|
23755
23832
|
return decorateResult({ result, stack });
|
|
23756
23833
|
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|
|
@@ -24081,7 +24158,7 @@ function generateDrawDefinition(params) {
|
|
|
24081
24158
|
drawDefinition.links.push(link);
|
|
24082
24159
|
}
|
|
24083
24160
|
drawDefinition.drawName = params.drawName ?? (drawType && constantToString(drawType));
|
|
24084
|
-
if (typeof voluntaryConsolation === "object") {
|
|
24161
|
+
if (typeof voluntaryConsolation === "object" && drawSize >= 4) {
|
|
24085
24162
|
addVoluntaryConsolationStructure({
|
|
24086
24163
|
...voluntaryConsolation,
|
|
24087
24164
|
tournamentRecord,
|