tods-competition-factory 1.7.8 → 1.7.10
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.d.ts +26 -1
- package/dist/forge/generate.mjs +90 -39
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +14 -10
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +2 -1
- package/dist/forge/utilities.mjs +16 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +88 -50
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +100 -90
- 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
|
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
function factoryVersion() {
|
|
336
|
-
return "1.7.
|
|
336
|
+
return "1.7.10";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -3972,20 +3972,20 @@ function evaluateCollectionResult({
|
|
|
3972
3972
|
if (matchUp.winningSide)
|
|
3973
3973
|
sideWins[matchUp.winningSide - 1] += 1;
|
|
3974
3974
|
});
|
|
3975
|
-
if (matchUpValue) {
|
|
3975
|
+
if (isConvertableInteger(matchUpValue)) {
|
|
3976
3976
|
collectionMatchUps.forEach((matchUp) => {
|
|
3977
3977
|
if (matchUp.winningSide) {
|
|
3978
3978
|
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue;
|
|
3979
3979
|
}
|
|
3980
3980
|
});
|
|
3981
|
-
} else if (setValue) {
|
|
3981
|
+
} else if (isConvertableInteger(setValue)) {
|
|
3982
3982
|
collectionMatchUps.forEach((matchUp) => {
|
|
3983
3983
|
matchUp.score?.sets?.forEach((set) => {
|
|
3984
3984
|
if (set.winningSide)
|
|
3985
3985
|
sideMatchUpValues[set.winningSide - 1] += setValue;
|
|
3986
3986
|
});
|
|
3987
3987
|
});
|
|
3988
|
-
} else if (scoreValue) {
|
|
3988
|
+
} else if (isConvertableInteger(scoreValue)) {
|
|
3989
3989
|
collectionMatchUps.forEach((matchUp) => {
|
|
3990
3990
|
matchUp.score?.sets?.forEach((set) => {
|
|
3991
3991
|
const {
|
|
@@ -4012,15 +4012,17 @@ function evaluateCollectionResult({
|
|
|
4012
4012
|
collectionDefinition,
|
|
4013
4013
|
collectionPosition
|
|
4014
4014
|
});
|
|
4015
|
-
|
|
4015
|
+
if (isConvertableInteger(matchUpValue2)) {
|
|
4016
|
+
sideMatchUpValues[matchUp.winningSide - 1] += matchUpValue2;
|
|
4017
|
+
}
|
|
4016
4018
|
}
|
|
4017
4019
|
});
|
|
4018
4020
|
}
|
|
4019
|
-
if (collectionValue) {
|
|
4021
|
+
if (isConvertableInteger(collectionValue)) {
|
|
4020
4022
|
let collectionWinningSide;
|
|
4021
4023
|
if (winCriteria?.aggregateValue) {
|
|
4022
4024
|
if (allCollectionMatchUpsCompleted) {
|
|
4023
|
-
if ((matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
4025
|
+
if (isConvertableInteger(matchUpValue || setValue || scoreValue) && sideMatchUpValues[0] !== sideMatchUpValues[1]) {
|
|
4024
4026
|
collectionWinningSide = sideMatchUpValues[0] > sideMatchUpValues[1] ? 1 : 2;
|
|
4025
4027
|
} else if (sideWins[0] !== sideWins[1]) {
|
|
4026
4028
|
collectionWinningSide = sideWins[0] > sideWins[1] ? 1 : 2;
|
|
@@ -4056,7 +4058,7 @@ function evaluateCollectionResult({
|
|
|
4056
4058
|
}
|
|
4057
4059
|
if (!belongsToValueGroup) {
|
|
4058
4060
|
sideCollectionValues.forEach(
|
|
4059
|
-
(sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue
|
|
4061
|
+
(sideCollectionValue, i) => sideTieValues[i] += sideCollectionValue || 0
|
|
4060
4062
|
);
|
|
4061
4063
|
} else {
|
|
4062
4064
|
groupValueGroups[collectionGroupNumber].sideWins[0] += sideWins[0] || 0;
|
|
@@ -8372,7 +8374,9 @@ function getGroupValueGroups({
|
|
|
8372
8374
|
}) {
|
|
8373
8375
|
const groupValueGroups = Object.assign(
|
|
8374
8376
|
{},
|
|
8375
|
-
...collectionGroups.filter(
|
|
8377
|
+
...collectionGroups.filter(
|
|
8378
|
+
(group) => isConvertableInteger(group?.groupValue) && group?.groupNumber
|
|
8379
|
+
).map((group) => ({
|
|
8376
8380
|
[group.groupNumber]: {
|
|
8377
8381
|
...group,
|
|
8378
8382
|
allGroupMatchUpsCompleted: true,
|
|
@@ -8449,11 +8453,11 @@ function generateTieMatchUpScore(params) {
|
|
|
8449
8453
|
}, void 0);
|
|
8450
8454
|
}
|
|
8451
8455
|
if (groupWinningSide) {
|
|
8452
|
-
sideTieValues[groupWinningSide - 1] += groupValue;
|
|
8456
|
+
sideTieValues[groupWinningSide - 1] += groupValue || 0;
|
|
8453
8457
|
}
|
|
8454
8458
|
}
|
|
8455
8459
|
const sideScores = sideTieValues.map(
|
|
8456
|
-
(sideTieValue, i) => sideTieValue + sideAdjustments[i]
|
|
8460
|
+
(sideTieValue, i) => (sideTieValue || 0) + sideAdjustments[i]
|
|
8457
8461
|
);
|
|
8458
8462
|
const set = {
|
|
8459
8463
|
side1Score: sideScores[0],
|
|
@@ -15120,20 +15124,18 @@ function calculateWinCriteria({
|
|
|
15120
15124
|
setValue
|
|
15121
15125
|
} = collectionDefinition;
|
|
15122
15126
|
const belongsToValueGroup = collectionGroupNumber && groupValueNumbers.includes(collectionGroupNumber);
|
|
15123
|
-
if (setValue || scoreValue) {
|
|
15127
|
+
if (isConvertableInteger(setValue || scoreValue)) {
|
|
15124
15128
|
aggregateValueImperative = true;
|
|
15125
15129
|
} else if (belongsToValueGroup) {
|
|
15126
15130
|
continue;
|
|
15127
|
-
} else if (collectionValue) {
|
|
15131
|
+
} else if (typeof collectionValue === "number" && isConvertableInteger(collectionValue)) {
|
|
15128
15132
|
valueTotal += collectionValue;
|
|
15129
15133
|
} else if (collectionValueProfiles?.length) {
|
|
15130
15134
|
for (const collectionValueProfile of collectionValueProfiles) {
|
|
15131
15135
|
valueTotal += collectionValueProfile.matchUpValue;
|
|
15132
15136
|
}
|
|
15133
|
-
} else if (matchUpValue) {
|
|
15137
|
+
} else if (typeof matchUpValue === "number" && isConvertableInteger(matchUpValue)) {
|
|
15134
15138
|
valueTotal += (matchUpCount || 0) * matchUpValue;
|
|
15135
|
-
} else {
|
|
15136
|
-
valueTotal += matchUpCount || 0;
|
|
15137
15139
|
}
|
|
15138
15140
|
}
|
|
15139
15141
|
for (const collectionGroup of collectionGroups) {
|
|
@@ -22764,6 +22766,15 @@ function getNumericSeedValue(seedValue) {
|
|
|
22764
22766
|
return Infinity;
|
|
22765
22767
|
}
|
|
22766
22768
|
|
|
22769
|
+
function capitalizeFirst(str) {
|
|
22770
|
+
return !isString(str) ? str : str.split(" ").map(
|
|
22771
|
+
(name) => name.split("").map((c, i) => i ? c.toLowerCase() : c.toUpperCase()).join("")
|
|
22772
|
+
).join(" ");
|
|
22773
|
+
}
|
|
22774
|
+
function constantToString(str) {
|
|
22775
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, " "));
|
|
22776
|
+
}
|
|
22777
|
+
|
|
22767
22778
|
const structureTemplate = ({
|
|
22768
22779
|
finishingPosition = ROUND_OUTCOME,
|
|
22769
22780
|
qualifyingRoundNumber,
|
|
@@ -22827,7 +22838,7 @@ const structureTemplate = ({
|
|
|
22827
22838
|
};
|
|
22828
22839
|
|
|
22829
22840
|
function generateRoundRobin({
|
|
22830
|
-
structureName = MAIN,
|
|
22841
|
+
structureName = constantToString(MAIN),
|
|
22831
22842
|
stageSequence = 1,
|
|
22832
22843
|
structureOptions,
|
|
22833
22844
|
appliedPolicies,
|
|
@@ -28755,10 +28766,12 @@ function getParticipantEntries(params) {
|
|
|
28755
28766
|
seedAssignments[MAIN] = mainSeeding;
|
|
28756
28767
|
if (seedAssignments && qualifyingSeeding)
|
|
28757
28768
|
seedAssignments[QUALIFYING] = mainSeeding;
|
|
28758
|
-
if (withEvents || withRankingProfile) {
|
|
28769
|
+
if ((withEvents || withRankingProfile) && participantMap[id] && eventId) {
|
|
28770
|
+
if (!participantMap[id].events[eventId])
|
|
28771
|
+
participantMap[id].events[eventId] = {};
|
|
28759
28772
|
if (includeSeeding) {
|
|
28760
28773
|
participantMap[id].events[eventId].seedValue = mainSeeding || qualifyingSeeding;
|
|
28761
|
-
} else if (participantMap[id].events[eventId]
|
|
28774
|
+
} else if (participantMap[id].events[eventId].seedValue) {
|
|
28762
28775
|
participantMap[id].events[eventId].seedValue = void 0;
|
|
28763
28776
|
}
|
|
28764
28777
|
}
|
|
@@ -39597,8 +39610,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
39597
39610
|
};
|
|
39598
39611
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
39599
39612
|
const mainStructure = structureTemplate({
|
|
39613
|
+
structureName: structureName || constantToString(MAIN),
|
|
39600
39614
|
structureId: structureId || uuids?.pop(),
|
|
39601
|
-
structureName: structureName || MAIN,
|
|
39602
39615
|
stageSequence,
|
|
39603
39616
|
matchUpType,
|
|
39604
39617
|
matchUps,
|
|
@@ -39615,7 +39628,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
39615
39628
|
matchUpType,
|
|
39616
39629
|
isMock
|
|
39617
39630
|
});
|
|
39618
|
-
const
|
|
39631
|
+
const consolation = constantToString(CONSOLATION);
|
|
39632
|
+
const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${consolation}` : consolation);
|
|
39619
39633
|
const consolationStructure = structureTemplate({
|
|
39620
39634
|
structureName: consolationStructureName,
|
|
39621
39635
|
matchUps: consolationMatchUps,
|
|
@@ -39693,8 +39707,9 @@ function feedInLinks({
|
|
|
39693
39707
|
|
|
39694
39708
|
function generateCurtisConsolation(params) {
|
|
39695
39709
|
const {
|
|
39710
|
+
structureName = constantToString(MAIN),
|
|
39711
|
+
playoffStructureNameBase,
|
|
39696
39712
|
finishingPositionOffset,
|
|
39697
|
-
structureName = MAIN,
|
|
39698
39713
|
stageSequence = 1,
|
|
39699
39714
|
structureNameMap,
|
|
39700
39715
|
staggeredEntry,
|
|
@@ -39732,6 +39747,7 @@ function generateCurtisConsolation(params) {
|
|
|
39732
39747
|
const { consolationStructure } = consolationFeedStructure({
|
|
39733
39748
|
idPrefix: idPrefix && `${idPrefix}-c${index}`,
|
|
39734
39749
|
structureId: uuids?.pop(),
|
|
39750
|
+
playoffStructureNameBase,
|
|
39735
39751
|
structureNameMap,
|
|
39736
39752
|
stageSequence: stageSequence2,
|
|
39737
39753
|
roundOffset,
|
|
@@ -39760,12 +39776,15 @@ function generateCurtisConsolation(params) {
|
|
|
39760
39776
|
matchUpType,
|
|
39761
39777
|
isMock
|
|
39762
39778
|
});
|
|
39779
|
+
const defaultName = constantToString(PLAY_OFF);
|
|
39780
|
+
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
39781
|
+
const structureName2 = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
39763
39782
|
const playoffStructure = structureTemplate({
|
|
39764
|
-
structureName: structureNameMap?.[PLAY_OFF] || PLAY_OFF,
|
|
39765
39783
|
structureId: uuids?.pop(),
|
|
39766
39784
|
matchUps: playoffMatchUps,
|
|
39767
39785
|
stageSequence: 2,
|
|
39768
39786
|
stage: PLAY_OFF,
|
|
39787
|
+
structureName: structureName2,
|
|
39769
39788
|
matchUpType
|
|
39770
39789
|
});
|
|
39771
39790
|
const playoffLink = {
|
|
@@ -39787,6 +39806,7 @@ function generateCurtisConsolation(params) {
|
|
|
39787
39806
|
return { structures, links, ...SUCCESS };
|
|
39788
39807
|
}
|
|
39789
39808
|
function consolationFeedStructure({
|
|
39809
|
+
playoffStructureNameBase,
|
|
39790
39810
|
stageSequence = 1,
|
|
39791
39811
|
structureNameMap,
|
|
39792
39812
|
roundOffset = 0,
|
|
@@ -39809,8 +39829,9 @@ function consolationFeedStructure({
|
|
|
39809
39829
|
isMock,
|
|
39810
39830
|
uuids
|
|
39811
39831
|
});
|
|
39812
|
-
const defaultName = `${CONSOLATION} ${index + 1}`;
|
|
39813
|
-
const
|
|
39832
|
+
const defaultName = `${constantToString(CONSOLATION)} ${index + 1}`;
|
|
39833
|
+
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
39834
|
+
const structureName = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
39814
39835
|
const consolationStructure = structureTemplate({
|
|
39815
39836
|
matchUps: consolationMatchUps,
|
|
39816
39837
|
stage: CONSOLATION,
|
|
@@ -39823,7 +39844,6 @@ function consolationFeedStructure({
|
|
|
39823
39844
|
}
|
|
39824
39845
|
|
|
39825
39846
|
function generatePlayoffStructures(params) {
|
|
39826
|
-
let { matchUpType } = params;
|
|
39827
39847
|
const {
|
|
39828
39848
|
finishingPositionOffset = 0,
|
|
39829
39849
|
addNameBaseToAttributeName,
|
|
@@ -39853,7 +39873,7 @@ function generatePlayoffStructures(params) {
|
|
|
39853
39873
|
const allMatchUps = [];
|
|
39854
39874
|
const structures = [];
|
|
39855
39875
|
const links = [];
|
|
39856
|
-
matchUpType = matchUpType || drawDefinition?.matchUpType;
|
|
39876
|
+
const matchUpType = params.matchUpType || drawDefinition?.matchUpType;
|
|
39857
39877
|
const finishingPositionsFrom = finishingPositionOffset + 1;
|
|
39858
39878
|
const finishingPositionsTo = finishingPositionOffset + drawSize;
|
|
39859
39879
|
const finishingPositionRange = `${finishingPositionsFrom}-${finishingPositionsTo}`;
|
|
@@ -39903,7 +39923,7 @@ function generatePlayoffStructures(params) {
|
|
|
39903
39923
|
if (playoffDrawPositions < 2)
|
|
39904
39924
|
return;
|
|
39905
39925
|
const childFinishingPositionOffset = drawSize / Math.pow(2, roundNumber) + finishingPositionOffset;
|
|
39906
|
-
if (childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
39926
|
+
if (finishingPositionLimit && childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
39907
39927
|
return;
|
|
39908
39928
|
const {
|
|
39909
39929
|
structures: childStructures,
|
|
@@ -39991,8 +40011,8 @@ function feedInChampionship(params) {
|
|
|
39991
40011
|
};
|
|
39992
40012
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
39993
40013
|
const mainStructure = structureTemplate({
|
|
40014
|
+
structureName: structureName || constantToString(MAIN),
|
|
39994
40015
|
structureId: structureId || uuids?.pop(),
|
|
39995
|
-
structureName: structureName || MAIN,
|
|
39996
40016
|
stageSequence,
|
|
39997
40017
|
matchUpType,
|
|
39998
40018
|
matchUps,
|
|
@@ -40016,9 +40036,9 @@ function feedInChampionship(params) {
|
|
|
40016
40036
|
});
|
|
40017
40037
|
if (drawSize > 2) {
|
|
40018
40038
|
const consolationStructure = structureTemplate({
|
|
40039
|
+
structureName: constantToString(CONSOLATION),
|
|
40019
40040
|
matchUps: consolationMatchUps,
|
|
40020
40041
|
structureId: uuids?.pop(),
|
|
40021
|
-
structureName: CONSOLATION,
|
|
40022
40042
|
stage: CONSOLATION,
|
|
40023
40043
|
stageSequence: 1,
|
|
40024
40044
|
matchUpType
|
|
@@ -40093,10 +40113,19 @@ function processPlayoffGroups({
|
|
|
40093
40113
|
if (positionsPlayedOff) {
|
|
40094
40114
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
40095
40115
|
}
|
|
40096
|
-
const
|
|
40116
|
+
const playoffGroupParams = {
|
|
40117
|
+
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
40118
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
40119
|
+
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
40120
|
+
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
40097
40121
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40122
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
40098
40123
|
structureNameMap: playoffGroup.structureNameMap,
|
|
40099
40124
|
structureName: playoffGroup.structureName,
|
|
40125
|
+
sequenceLimit: playoffGroup.sequenceLimit
|
|
40126
|
+
};
|
|
40127
|
+
const params = {
|
|
40128
|
+
...playoffGroupParams,
|
|
40100
40129
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
40101
40130
|
appliedPolicies: policyDefinitions,
|
|
40102
40131
|
finishingPositionOffset,
|
|
@@ -40294,13 +40323,17 @@ function generatePlayoffLink({
|
|
|
40294
40323
|
|
|
40295
40324
|
function generateRoundRobinWithPlayOff(params) {
|
|
40296
40325
|
const { drawDefinition, structureOptions, requireSequential } = params;
|
|
40297
|
-
const mainDrawProperties = {
|
|
40326
|
+
const mainDrawProperties = {
|
|
40327
|
+
structureName: constantToString(MAIN),
|
|
40328
|
+
...params,
|
|
40329
|
+
stage: MAIN
|
|
40330
|
+
};
|
|
40298
40331
|
const { structures, groupCount, groupSize } = generateRoundRobin(mainDrawProperties);
|
|
40299
40332
|
if (groupCount < 1) {
|
|
40300
40333
|
console.log(INVALID_CONFIGURATION);
|
|
40301
40334
|
}
|
|
40302
40335
|
const playoffGroups = structureOptions?.playoffGroups || [
|
|
40303
|
-
{ finishingPositions: [1], structureName: PLAY_OFF }
|
|
40336
|
+
{ finishingPositions: [1], structureName: constantToString(PLAY_OFF) }
|
|
40304
40337
|
];
|
|
40305
40338
|
const [mainStructure] = structures;
|
|
40306
40339
|
const { structures: playoffStructures, links } = processPlayoffGroups({
|
|
@@ -40418,7 +40451,7 @@ function generateDoubleElimination({
|
|
|
40418
40451
|
isMock
|
|
40419
40452
|
});
|
|
40420
40453
|
const mainStructure = structureTemplate({
|
|
40421
|
-
structureName: structureName || MAIN,
|
|
40454
|
+
structureName: structureName || constantToString(MAIN),
|
|
40422
40455
|
structureId: uuids?.pop(),
|
|
40423
40456
|
stageSequence: 1,
|
|
40424
40457
|
stage: MAIN,
|
|
@@ -40437,9 +40470,9 @@ function generateDoubleElimination({
|
|
|
40437
40470
|
uuids
|
|
40438
40471
|
});
|
|
40439
40472
|
const consolationStructure = structureTemplate({
|
|
40473
|
+
structureName: constantToString(BACKDRAW),
|
|
40440
40474
|
matchUps: consolationMatchUps,
|
|
40441
40475
|
structureId: uuids?.pop(),
|
|
40442
|
-
structureName: BACKDRAW,
|
|
40443
40476
|
stage: CONSOLATION,
|
|
40444
40477
|
stageSequence: 2,
|
|
40445
40478
|
matchUpType
|
|
@@ -40452,9 +40485,9 @@ function generateDoubleElimination({
|
|
|
40452
40485
|
isMock
|
|
40453
40486
|
});
|
|
40454
40487
|
const deciderStructure = structureTemplate({
|
|
40488
|
+
structureName: constantToString(DECIDER),
|
|
40455
40489
|
matchUps: deciderMatchUps,
|
|
40456
40490
|
structureId: uuids?.pop(),
|
|
40457
|
-
structureName: DECIDER,
|
|
40458
40491
|
stageSequence: 3,
|
|
40459
40492
|
stage: PLAY_OFF,
|
|
40460
40493
|
matchUpType
|
|
@@ -40576,11 +40609,12 @@ function getGenerators(params) {
|
|
|
40576
40609
|
const { appliedPolicies } = getAppliedPolicies(params);
|
|
40577
40610
|
const feedPolicy = params.policyDefinitions?.[POLICY_TYPE_FEED_IN] || appliedPolicies?.[POLICY_TYPE_FEED_IN];
|
|
40578
40611
|
params.skipRounds = params.skipRounds || drawSize <= 4 && (feedPolicy?.feedMainFinal ? 0 : 1) || 0;
|
|
40612
|
+
const main = constantToString(MAIN);
|
|
40579
40613
|
const singleElimination = () => {
|
|
40580
40614
|
const { matchUps } = treeMatchUps(params);
|
|
40581
40615
|
const structure = structureTemplate({
|
|
40582
|
-
structureName: structureName || MAIN,
|
|
40583
40616
|
structureId: structureId || uuids?.pop(),
|
|
40617
|
+
structureName: structureName || main,
|
|
40584
40618
|
stageSequence,
|
|
40585
40619
|
matchUpType,
|
|
40586
40620
|
matchUps,
|
|
@@ -40591,8 +40625,8 @@ function getGenerators(params) {
|
|
|
40591
40625
|
const generators = {
|
|
40592
40626
|
[AD_HOC]: () => {
|
|
40593
40627
|
const structure = structureTemplate({
|
|
40594
|
-
structureName: structureName || MAIN,
|
|
40595
40628
|
structureId: structureId || uuids?.pop(),
|
|
40629
|
+
structureName: structureName || main,
|
|
40596
40630
|
finishingPosition: WIN_RATIO,
|
|
40597
40631
|
stageSequence,
|
|
40598
40632
|
matchUps: [],
|
|
@@ -40604,8 +40638,8 @@ function getGenerators(params) {
|
|
|
40604
40638
|
[LUCKY_DRAW]: () => {
|
|
40605
40639
|
const { matchUps } = luckyDraw(params);
|
|
40606
40640
|
const structure = structureTemplate({
|
|
40607
|
-
structureName: structureName || MAIN,
|
|
40608
40641
|
structureId: structureId || uuids?.pop(),
|
|
40642
|
+
structureName: structureName || main,
|
|
40609
40643
|
stageSequence,
|
|
40610
40644
|
matchUpType,
|
|
40611
40645
|
matchUps,
|
|
@@ -40631,8 +40665,8 @@ function getGenerators(params) {
|
|
|
40631
40665
|
[FEED_IN$1]: () => {
|
|
40632
40666
|
const { matchUps } = feedInMatchUps({ drawSize, uuids, matchUpType });
|
|
40633
40667
|
const structure = structureTemplate({
|
|
40634
|
-
structureName: structureName || MAIN,
|
|
40635
40668
|
structureId: structureId || uuids?.pop(),
|
|
40669
|
+
structureName: structureName || main,
|
|
40636
40670
|
stageSequence,
|
|
40637
40671
|
matchUpType,
|
|
40638
40672
|
stage: MAIN,
|
|
@@ -43189,8 +43223,11 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
43189
43223
|
structureId: sourceStructureId,
|
|
43190
43224
|
addNameBaseToAttributeName,
|
|
43191
43225
|
playoffStructureNameBase,
|
|
43226
|
+
finishingPositionNaming,
|
|
43227
|
+
finishingPositionLimit,
|
|
43192
43228
|
playoffAttributes,
|
|
43193
43229
|
playoffPositions,
|
|
43230
|
+
roundOffsetLimit,
|
|
43194
43231
|
tournamentRecord,
|
|
43195
43232
|
exitProfileLimit,
|
|
43196
43233
|
roundProfiles,
|
|
@@ -43295,7 +43332,10 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
43295
43332
|
drawSize,
|
|
43296
43333
|
idPrefix,
|
|
43297
43334
|
isMock,
|
|
43298
|
-
uuids
|
|
43335
|
+
uuids,
|
|
43336
|
+
finishingPositionNaming,
|
|
43337
|
+
finishingPositionLimit,
|
|
43338
|
+
roundOffsetLimit
|
|
43299
43339
|
});
|
|
43300
43340
|
if (result.error)
|
|
43301
43341
|
return decorateResult({ result, stack });
|
|
@@ -43503,9 +43543,9 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
43503
43543
|
return result2;
|
|
43504
43544
|
}
|
|
43505
43545
|
tieFormat = copyTieFormat(
|
|
43506
|
-
tieFormat
|
|
43546
|
+
tieFormat ?? resolveTieFormat({ drawDefinition })?.tieFormat
|
|
43507
43547
|
);
|
|
43508
|
-
matchUpType = matchUpType
|
|
43548
|
+
matchUpType = matchUpType ?? drawDefinition.matchUpType ?? TypeEnum.Singles;
|
|
43509
43549
|
const { structures: stageStructures } = getDrawStructures({
|
|
43510
43550
|
stageSequence: 1,
|
|
43511
43551
|
drawDefinition,
|
|
@@ -43513,14 +43553,14 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
43513
43553
|
});
|
|
43514
43554
|
const structureCount = stageStructures.length;
|
|
43515
43555
|
if (structureCount > 1)
|
|
43516
|
-
return { error:
|
|
43556
|
+
return { error: STAGE_SEQUENCE_LIMIT };
|
|
43517
43557
|
if (stageStructures?.[0]?.matchUps?.length)
|
|
43518
|
-
return { error:
|
|
43558
|
+
return { error: EXISTING_STRUCTURE };
|
|
43519
43559
|
const structureId = stageStructures?.[0]?.structureId;
|
|
43520
43560
|
Object.assign(
|
|
43521
43561
|
params,
|
|
43522
43562
|
definedAttributes({
|
|
43523
|
-
structureName: params.structureName
|
|
43563
|
+
structureName: params.structureName ?? constantToString(VOLUNTARY_CONSOLATION),
|
|
43524
43564
|
structureId,
|
|
43525
43565
|
matchUpType,
|
|
43526
43566
|
tieFormat,
|
|
@@ -50633,9 +50673,6 @@ function formatPersonName({
|
|
|
50633
50673
|
if (!person)
|
|
50634
50674
|
return;
|
|
50635
50675
|
const spacer = hasSpacing(personFormat) ? " " : "";
|
|
50636
|
-
const capitalizeFirst = (str) => str.split(" ").map(
|
|
50637
|
-
(name) => name.split("").map((c, i) => i ? c.toLowerCase() : c.toUpperCase()).join("")
|
|
50638
|
-
).join(" ");
|
|
50639
50676
|
let firstName = capitalizeFirst(person?.standardGivenName ?? "");
|
|
50640
50677
|
let lastName = capitalizeFirst(person?.standardFamilyName ?? "");
|
|
50641
50678
|
if (!personFormat)
|
|
@@ -58138,7 +58175,7 @@ function generateDrawDefinition(params) {
|
|
|
58138
58175
|
}
|
|
58139
58176
|
} else if (structureId && generateQualifyingPlaceholder) {
|
|
58140
58177
|
const qualifyingStructure = structureTemplate({
|
|
58141
|
-
structureName: QUALIFYING,
|
|
58178
|
+
structureName: constantToString(QUALIFYING),
|
|
58142
58179
|
stage: QUALIFYING
|
|
58143
58180
|
});
|
|
58144
58181
|
const { link } = generateQualifyingLink({
|
|
@@ -63392,6 +63429,7 @@ const utilities = {
|
|
|
63392
63429
|
structureSort,
|
|
63393
63430
|
matchUpSort,
|
|
63394
63431
|
tidyScore,
|
|
63432
|
+
createMap,
|
|
63395
63433
|
generateScoreString,
|
|
63396
63434
|
calculateWinCriteria,
|
|
63397
63435
|
compareTieFormats,
|