tods-competition-factory 1.7.7 → 1.7.9
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 +215 -167
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +139 -138
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +139 -88
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +3 -2
- package/dist/forge/utilities.mjs +142 -76
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +335 -198
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +441 -311
- 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 +6 -6
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.9";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -1727,119 +1727,6 @@ function handleCaughtError({
|
|
|
1727
1727
|
});
|
|
1728
1728
|
}
|
|
1729
1729
|
|
|
1730
|
-
function isString(obj) {
|
|
1731
|
-
return typeof obj === "string";
|
|
1732
|
-
}
|
|
1733
|
-
function isObject(obj) {
|
|
1734
|
-
return typeof obj === "object";
|
|
1735
|
-
}
|
|
1736
|
-
const hasAttributeValues = (a) => (o) => Object.keys(a).every((key) => o[key] === a[key]);
|
|
1737
|
-
const extractAttributes = (atz) => (o) => !atz || typeof o !== "object" ? void 0 : Array.isArray(atz) && atz.map((a) => ({ [a]: o[a] })) || typeof atz === "object" && Object.keys(atz).map((key) => ({ [key]: o[key] })) || typeof atz === "string" && getAttr(o, atz);
|
|
1738
|
-
function getAttr(o, attr) {
|
|
1739
|
-
const attrs = attr.split(".");
|
|
1740
|
-
for (const a of attrs) {
|
|
1741
|
-
o = o?.[a];
|
|
1742
|
-
if (!o)
|
|
1743
|
-
return;
|
|
1744
|
-
}
|
|
1745
|
-
return o;
|
|
1746
|
-
}
|
|
1747
|
-
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
1748
|
-
if (typeof obj !== "object" || obj === null)
|
|
1749
|
-
return obj;
|
|
1750
|
-
const deepCopy = deepCopyEnabled();
|
|
1751
|
-
if (!deepCopy?.enabled)
|
|
1752
|
-
shallow = true;
|
|
1753
|
-
const ignoreValues = ["", void 0, null];
|
|
1754
|
-
if (ignoreFalse)
|
|
1755
|
-
ignoreValues.push(false);
|
|
1756
|
-
const definedKeys = Object.keys(obj).filter(
|
|
1757
|
-
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
1758
|
-
);
|
|
1759
|
-
return Object.assign(
|
|
1760
|
-
{},
|
|
1761
|
-
...definedKeys.map((key) => {
|
|
1762
|
-
return Array.isArray(obj[key]) ? {
|
|
1763
|
-
[key]: shallow ? obj[key] : obj[key].map((m) => definedAttributes(m))
|
|
1764
|
-
} : { [key]: shallow ? obj[key] : definedAttributes(obj[key]) };
|
|
1765
|
-
})
|
|
1766
|
-
);
|
|
1767
|
-
}
|
|
1768
|
-
function countKeys(o) {
|
|
1769
|
-
if (Array.isArray(o)) {
|
|
1770
|
-
return o.length + o.map(countKeys).reduce((a, b) => a + b, 0);
|
|
1771
|
-
} else if (typeof o === "object" && o !== null) {
|
|
1772
|
-
return Object.keys(o).length + Object.keys(o).map((k) => countKeys(o[k])).reduce((a, b) => a + b, 0);
|
|
1773
|
-
}
|
|
1774
|
-
return 0;
|
|
1775
|
-
}
|
|
1776
|
-
function generateHashCode(o) {
|
|
1777
|
-
if (o === null || typeof o !== "object")
|
|
1778
|
-
return void 0;
|
|
1779
|
-
const str = JSON.stringify(o);
|
|
1780
|
-
const keyCount = countKeys(o);
|
|
1781
|
-
const charSum = str.split("").reduce((a, b) => a + b.charCodeAt(0), 0);
|
|
1782
|
-
return [str.length, keyCount, charSum].map((e) => e.toString(36)).join("");
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
function attributeFilter(params) {
|
|
1786
|
-
if (params === null)
|
|
1787
|
-
return {};
|
|
1788
|
-
const { source, template } = params || {};
|
|
1789
|
-
if (!template)
|
|
1790
|
-
return source;
|
|
1791
|
-
const target = {};
|
|
1792
|
-
attributeCopy(source, template, target);
|
|
1793
|
-
return target;
|
|
1794
|
-
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
1795
|
-
if (!valuesObject || !templateObject)
|
|
1796
|
-
return void 0;
|
|
1797
|
-
const vKeys = Object.keys(valuesObject);
|
|
1798
|
-
const oKeys = Object.keys(templateObject);
|
|
1799
|
-
const orMap = Object.assign(
|
|
1800
|
-
{},
|
|
1801
|
-
...oKeys.filter((key) => key.indexOf("||")).map((key) => key.split("||").map((or) => ({ [or]: key }))).flat()
|
|
1802
|
-
);
|
|
1803
|
-
const allKeys = oKeys.concat(...Object.keys(orMap));
|
|
1804
|
-
const wildcard = allKeys.includes("*");
|
|
1805
|
-
for (const vKey of vKeys) {
|
|
1806
|
-
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
1807
|
-
const templateKey = orMap[vKey] || vKey;
|
|
1808
|
-
const tobj = templateObject[templateKey] || wildcard;
|
|
1809
|
-
const vobj = valuesObject[vKey];
|
|
1810
|
-
if (typeof tobj === "object" && typeof vobj !== "function" && !Array.isArray(tobj)) {
|
|
1811
|
-
if (Array.isArray(vobj)) {
|
|
1812
|
-
const mappedElements = vobj.map((arrayMember) => {
|
|
1813
|
-
const target2 = {};
|
|
1814
|
-
const result = attributeCopy(arrayMember, tobj, target2);
|
|
1815
|
-
return result !== false ? target2 : void 0;
|
|
1816
|
-
}).filter(Boolean);
|
|
1817
|
-
outputObject[vKey] = mappedElements;
|
|
1818
|
-
} else if (vobj) {
|
|
1819
|
-
outputObject[vKey] = {};
|
|
1820
|
-
attributeCopy(vobj, tobj, outputObject[vKey]);
|
|
1821
|
-
}
|
|
1822
|
-
} else {
|
|
1823
|
-
const value = valuesObject[vKey];
|
|
1824
|
-
const exclude = Array.isArray(tobj) && !tobj.includes(value);
|
|
1825
|
-
if (exclude)
|
|
1826
|
-
return false;
|
|
1827
|
-
if (templateObject[vKey] || wildcard && templateObject[vKey] !== false) {
|
|
1828
|
-
outputObject[vKey] = value;
|
|
1829
|
-
}
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
return void 0;
|
|
1834
|
-
}
|
|
1835
|
-
}
|
|
1836
|
-
|
|
1837
|
-
function generateTimeCode(index = 0) {
|
|
1838
|
-
const uidate = /* @__PURE__ */ new Date();
|
|
1839
|
-
uidate.setHours(uidate.getHours() + index);
|
|
1840
|
-
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
1841
|
-
}
|
|
1842
|
-
|
|
1843
1730
|
const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
1844
1731
|
const validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
1845
1732
|
const dateValidation = /^([\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1]))([ T](0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)?([.,][\d]{3})?Z?$/;
|
|
@@ -2209,6 +2096,182 @@ function extensionsToAttributes(extensions) {
|
|
|
2209
2096
|
}).filter(Boolean);
|
|
2210
2097
|
}
|
|
2211
2098
|
|
|
2099
|
+
function getAccessorValue({ element, accessor }) {
|
|
2100
|
+
if (typeof accessor !== "string")
|
|
2101
|
+
return { values: [] };
|
|
2102
|
+
const targetElement = makeDeepCopy(element);
|
|
2103
|
+
const attributes = accessor.split(".");
|
|
2104
|
+
const values = [];
|
|
2105
|
+
let value;
|
|
2106
|
+
processKeys({ targetElement, attributes });
|
|
2107
|
+
const result = { value };
|
|
2108
|
+
if (values.length)
|
|
2109
|
+
result.values = values;
|
|
2110
|
+
return result;
|
|
2111
|
+
function processKeys({
|
|
2112
|
+
targetElement: targetElement2,
|
|
2113
|
+
attributes: attributes2 = [],
|
|
2114
|
+
significantCharacters
|
|
2115
|
+
}) {
|
|
2116
|
+
for (const [index, attribute] of attributes2.entries()) {
|
|
2117
|
+
if (targetElement2?.[attribute]) {
|
|
2118
|
+
const remainingKeys = attributes2.slice(index + 1);
|
|
2119
|
+
if (!remainingKeys.length) {
|
|
2120
|
+
if (!value)
|
|
2121
|
+
value = targetElement2[attribute];
|
|
2122
|
+
if (!values.includes(targetElement2[attribute])) {
|
|
2123
|
+
values.push(targetElement2[attribute]);
|
|
2124
|
+
}
|
|
2125
|
+
} else if (Array.isArray(targetElement2[attribute])) {
|
|
2126
|
+
const values2 = targetElement2[attribute];
|
|
2127
|
+
values2.forEach(
|
|
2128
|
+
(nestedTarget) => processKeys({
|
|
2129
|
+
targetElement: nestedTarget,
|
|
2130
|
+
attributes: remainingKeys
|
|
2131
|
+
})
|
|
2132
|
+
);
|
|
2133
|
+
} else {
|
|
2134
|
+
targetElement2 = targetElement2[attribute];
|
|
2135
|
+
checkValue({ targetElement: targetElement2, index });
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2138
|
+
}
|
|
2139
|
+
function checkValue({ targetElement: targetElement3, index }) {
|
|
2140
|
+
if (targetElement3 && index === attributes2.length - 1 && ["string", "number"].includes(typeof targetElement3)) {
|
|
2141
|
+
const extractedValue = significantCharacters ? targetElement3.slice(0, significantCharacters) : targetElement3;
|
|
2142
|
+
if (value) {
|
|
2143
|
+
if (!values.includes(extractedValue)) {
|
|
2144
|
+
values.push(extractedValue);
|
|
2145
|
+
}
|
|
2146
|
+
} else {
|
|
2147
|
+
value = extractedValue;
|
|
2148
|
+
values.push(extractedValue);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
|
|
2155
|
+
function isString(obj) {
|
|
2156
|
+
return typeof obj === "string";
|
|
2157
|
+
}
|
|
2158
|
+
function isObject(obj) {
|
|
2159
|
+
return typeof obj === "object";
|
|
2160
|
+
}
|
|
2161
|
+
function createMap(objectArray, attribute) {
|
|
2162
|
+
if (!Array.isArray(objectArray))
|
|
2163
|
+
return {};
|
|
2164
|
+
return Object.assign(
|
|
2165
|
+
{},
|
|
2166
|
+
...(objectArray ?? []).filter(isObject).map((obj) => {
|
|
2167
|
+
return obj[attribute] && {
|
|
2168
|
+
[obj[attribute]]: obj
|
|
2169
|
+
};
|
|
2170
|
+
}).filter(Boolean)
|
|
2171
|
+
);
|
|
2172
|
+
}
|
|
2173
|
+
const hasAttributeValues = (a) => (o) => Object.keys(a).every((key) => o[key] === a[key]);
|
|
2174
|
+
const extractAttributes = (accessor) => (element) => !accessor || typeof element !== "object" ? void 0 : Array.isArray(accessor) && accessor.map((a) => ({
|
|
2175
|
+
[a]: getAccessorValue({ element, accessor: a })?.value
|
|
2176
|
+
})) || typeof accessor === "object" && Object.keys(accessor).map((key) => ({
|
|
2177
|
+
[key]: getAccessorValue({ element, accessor: key })?.value
|
|
2178
|
+
})) || (typeof accessor === "string" && getAccessorValue({ element, accessor }))?.value;
|
|
2179
|
+
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
2180
|
+
if (typeof obj !== "object" || obj === null)
|
|
2181
|
+
return obj;
|
|
2182
|
+
const deepCopy = deepCopyEnabled();
|
|
2183
|
+
if (!deepCopy?.enabled)
|
|
2184
|
+
shallow = true;
|
|
2185
|
+
const ignoreValues = ["", void 0, null];
|
|
2186
|
+
if (ignoreFalse)
|
|
2187
|
+
ignoreValues.push(false);
|
|
2188
|
+
const definedKeys = Object.keys(obj).filter(
|
|
2189
|
+
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
2190
|
+
);
|
|
2191
|
+
return Object.assign(
|
|
2192
|
+
{},
|
|
2193
|
+
...definedKeys.map((key) => {
|
|
2194
|
+
return Array.isArray(obj[key]) ? {
|
|
2195
|
+
[key]: shallow ? obj[key] : obj[key].map((m) => definedAttributes(m))
|
|
2196
|
+
} : { [key]: shallow ? obj[key] : definedAttributes(obj[key]) };
|
|
2197
|
+
})
|
|
2198
|
+
);
|
|
2199
|
+
}
|
|
2200
|
+
function countKeys(o) {
|
|
2201
|
+
if (Array.isArray(o)) {
|
|
2202
|
+
return o.length + o.map(countKeys).reduce((a, b) => a + b, 0);
|
|
2203
|
+
} else if (typeof o === "object" && o !== null) {
|
|
2204
|
+
return Object.keys(o).length + Object.keys(o).map((k) => countKeys(o[k])).reduce((a, b) => a + b, 0);
|
|
2205
|
+
}
|
|
2206
|
+
return 0;
|
|
2207
|
+
}
|
|
2208
|
+
function generateHashCode(o) {
|
|
2209
|
+
if (o === null || typeof o !== "object")
|
|
2210
|
+
return void 0;
|
|
2211
|
+
const str = JSON.stringify(o);
|
|
2212
|
+
const keyCount = countKeys(o);
|
|
2213
|
+
const charSum = str.split("").reduce((a, b) => a + b.charCodeAt(0), 0);
|
|
2214
|
+
return [str.length, keyCount, charSum].map((e) => e.toString(36)).join("");
|
|
2215
|
+
}
|
|
2216
|
+
|
|
2217
|
+
function attributeFilter(params) {
|
|
2218
|
+
if (params === null)
|
|
2219
|
+
return {};
|
|
2220
|
+
const { source, template } = params || {};
|
|
2221
|
+
if (!template)
|
|
2222
|
+
return source;
|
|
2223
|
+
const target = {};
|
|
2224
|
+
attributeCopy(source, template, target);
|
|
2225
|
+
return target;
|
|
2226
|
+
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
2227
|
+
if (!valuesObject || !templateObject)
|
|
2228
|
+
return void 0;
|
|
2229
|
+
const vKeys = Object.keys(valuesObject);
|
|
2230
|
+
const oKeys = Object.keys(templateObject);
|
|
2231
|
+
const orMap = Object.assign(
|
|
2232
|
+
{},
|
|
2233
|
+
...oKeys.filter((key) => key.indexOf("||")).map((key) => key.split("||").map((or) => ({ [or]: key }))).flat()
|
|
2234
|
+
);
|
|
2235
|
+
const allKeys = oKeys.concat(...Object.keys(orMap));
|
|
2236
|
+
const wildcard = allKeys.includes("*");
|
|
2237
|
+
for (const vKey of vKeys) {
|
|
2238
|
+
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
2239
|
+
const templateKey = orMap[vKey] || vKey;
|
|
2240
|
+
const tobj = templateObject[templateKey] || wildcard;
|
|
2241
|
+
const vobj = valuesObject[vKey];
|
|
2242
|
+
if (typeof tobj === "object" && typeof vobj !== "function" && !Array.isArray(tobj)) {
|
|
2243
|
+
if (Array.isArray(vobj)) {
|
|
2244
|
+
const mappedElements = vobj.map((arrayMember) => {
|
|
2245
|
+
const target2 = {};
|
|
2246
|
+
const result = attributeCopy(arrayMember, tobj, target2);
|
|
2247
|
+
return result !== false ? target2 : void 0;
|
|
2248
|
+
}).filter(Boolean);
|
|
2249
|
+
outputObject[vKey] = mappedElements;
|
|
2250
|
+
} else if (vobj) {
|
|
2251
|
+
outputObject[vKey] = {};
|
|
2252
|
+
attributeCopy(vobj, tobj, outputObject[vKey]);
|
|
2253
|
+
}
|
|
2254
|
+
} else {
|
|
2255
|
+
const value = valuesObject[vKey];
|
|
2256
|
+
const exclude = Array.isArray(tobj) && !tobj.includes(value);
|
|
2257
|
+
if (exclude)
|
|
2258
|
+
return false;
|
|
2259
|
+
if (templateObject[vKey] || wildcard && templateObject[vKey] !== false) {
|
|
2260
|
+
outputObject[vKey] = value;
|
|
2261
|
+
}
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
return void 0;
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
function generateTimeCode(index = 0) {
|
|
2270
|
+
const uidate = /* @__PURE__ */ new Date();
|
|
2271
|
+
uidate.setHours(uidate.getHours() + index);
|
|
2272
|
+
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2212
2275
|
function numericSort(a, b) {
|
|
2213
2276
|
return a - b;
|
|
2214
2277
|
}
|
|
@@ -7605,7 +7668,7 @@ function isAdHoc({ drawDefinition, structure }) {
|
|
|
7605
7668
|
const hasDrawPosition = matchUps?.find(
|
|
7606
7669
|
(matchUp) => matchUp?.drawPositions?.length
|
|
7607
7670
|
);
|
|
7608
|
-
return !structure?.structures && !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) && !hasRoundPosition && !hasDrawPosition;
|
|
7671
|
+
return !structure?.structures && structure?.stage !== VOLUNTARY_CONSOLATION && !(drawDefinition?.drawType && drawDefinition.drawType !== AD_HOC) && !hasRoundPosition && !hasDrawPosition;
|
|
7609
7672
|
}
|
|
7610
7673
|
|
|
7611
7674
|
const POLICY_ROUND_NAMING_DEFAULT = {
|
|
@@ -22701,6 +22764,15 @@ function getNumericSeedValue(seedValue) {
|
|
|
22701
22764
|
return Infinity;
|
|
22702
22765
|
}
|
|
22703
22766
|
|
|
22767
|
+
function capitalizeFirst(str) {
|
|
22768
|
+
return !isString(str) ? str : str.split(" ").map(
|
|
22769
|
+
(name) => name.split("").map((c, i) => i ? c.toLowerCase() : c.toUpperCase()).join("")
|
|
22770
|
+
).join(" ");
|
|
22771
|
+
}
|
|
22772
|
+
function constantToString(str) {
|
|
22773
|
+
return !isString(str) ? str : capitalizeFirst(str.replace(/_/g, " "));
|
|
22774
|
+
}
|
|
22775
|
+
|
|
22704
22776
|
const structureTemplate = ({
|
|
22705
22777
|
finishingPosition = ROUND_OUTCOME,
|
|
22706
22778
|
qualifyingRoundNumber,
|
|
@@ -22764,7 +22836,7 @@ const structureTemplate = ({
|
|
|
22764
22836
|
};
|
|
22765
22837
|
|
|
22766
22838
|
function generateRoundRobin({
|
|
22767
|
-
structureName = MAIN,
|
|
22839
|
+
structureName = constantToString(MAIN),
|
|
22768
22840
|
stageSequence = 1,
|
|
22769
22841
|
structureOptions,
|
|
22770
22842
|
appliedPolicies,
|
|
@@ -26141,56 +26213,6 @@ function getEventPublishStatuses({ event }) {
|
|
|
26141
26213
|
return void 0;
|
|
26142
26214
|
}
|
|
26143
26215
|
|
|
26144
|
-
function getAccessorValue({ element, accessor }) {
|
|
26145
|
-
if (typeof accessor !== "string")
|
|
26146
|
-
return { values: [] };
|
|
26147
|
-
const targetElement = makeDeepCopy(element);
|
|
26148
|
-
const attributes = accessor.split(".");
|
|
26149
|
-
const values = [];
|
|
26150
|
-
let value;
|
|
26151
|
-
processKeys({ targetElement, attributes });
|
|
26152
|
-
const result = { value };
|
|
26153
|
-
if (values.length)
|
|
26154
|
-
result.values = values;
|
|
26155
|
-
return result;
|
|
26156
|
-
function processKeys({
|
|
26157
|
-
targetElement: targetElement2,
|
|
26158
|
-
attributes: attributes2 = [],
|
|
26159
|
-
significantCharacters
|
|
26160
|
-
}) {
|
|
26161
|
-
for (const [index, attribute] of attributes2.entries()) {
|
|
26162
|
-
if (targetElement2?.[attribute]) {
|
|
26163
|
-
if (Array.isArray(targetElement2[attribute])) {
|
|
26164
|
-
const values2 = targetElement2[attribute];
|
|
26165
|
-
const remainingKeys = attributes2.slice(index);
|
|
26166
|
-
values2.forEach(
|
|
26167
|
-
(nestedTarget) => processKeys({
|
|
26168
|
-
targetElement: nestedTarget,
|
|
26169
|
-
attributes: remainingKeys
|
|
26170
|
-
})
|
|
26171
|
-
);
|
|
26172
|
-
} else {
|
|
26173
|
-
targetElement2 = targetElement2[attribute];
|
|
26174
|
-
checkValue({ targetElement: targetElement2, index });
|
|
26175
|
-
}
|
|
26176
|
-
}
|
|
26177
|
-
}
|
|
26178
|
-
function checkValue({ targetElement: targetElement3, index }) {
|
|
26179
|
-
if (targetElement3 && index === attributes2.length - 1 && ["string", "number"].includes(typeof targetElement3)) {
|
|
26180
|
-
const extractedValue = significantCharacters ? targetElement3.slice(0, significantCharacters) : targetElement3;
|
|
26181
|
-
if (value) {
|
|
26182
|
-
if (!values.includes(extractedValue)) {
|
|
26183
|
-
values.push(extractedValue);
|
|
26184
|
-
}
|
|
26185
|
-
} else {
|
|
26186
|
-
value = extractedValue;
|
|
26187
|
-
values.push(extractedValue);
|
|
26188
|
-
}
|
|
26189
|
-
}
|
|
26190
|
-
}
|
|
26191
|
-
}
|
|
26192
|
-
}
|
|
26193
|
-
|
|
26194
26216
|
function participantScaleItem({
|
|
26195
26217
|
requireTimeStamp,
|
|
26196
26218
|
scaleAttributes,
|
|
@@ -28742,10 +28764,12 @@ function getParticipantEntries(params) {
|
|
|
28742
28764
|
seedAssignments[MAIN] = mainSeeding;
|
|
28743
28765
|
if (seedAssignments && qualifyingSeeding)
|
|
28744
28766
|
seedAssignments[QUALIFYING] = mainSeeding;
|
|
28745
|
-
if (withEvents || withRankingProfile) {
|
|
28767
|
+
if ((withEvents || withRankingProfile) && participantMap[id] && eventId) {
|
|
28768
|
+
if (!participantMap[id].events[eventId])
|
|
28769
|
+
participantMap[id].events[eventId] = {};
|
|
28746
28770
|
if (includeSeeding) {
|
|
28747
28771
|
participantMap[id].events[eventId].seedValue = mainSeeding || qualifyingSeeding;
|
|
28748
|
-
} else if (participantMap[id].events[eventId]
|
|
28772
|
+
} else if (participantMap[id].events[eventId].seedValue) {
|
|
28749
28773
|
participantMap[id].events[eventId].seedValue = void 0;
|
|
28750
28774
|
}
|
|
28751
28775
|
}
|
|
@@ -39584,8 +39608,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
39584
39608
|
};
|
|
39585
39609
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
39586
39610
|
const mainStructure = structureTemplate({
|
|
39611
|
+
structureName: structureName || constantToString(MAIN),
|
|
39587
39612
|
structureId: structureId || uuids?.pop(),
|
|
39588
|
-
structureName: structureName || MAIN,
|
|
39589
39613
|
stageSequence,
|
|
39590
39614
|
matchUpType,
|
|
39591
39615
|
matchUps,
|
|
@@ -39602,7 +39626,8 @@ function firstRoundLoserConsolation(params) {
|
|
|
39602
39626
|
matchUpType,
|
|
39603
39627
|
isMock
|
|
39604
39628
|
});
|
|
39605
|
-
const
|
|
39629
|
+
const consolation = constantToString(CONSOLATION);
|
|
39630
|
+
const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${consolation}` : consolation);
|
|
39606
39631
|
const consolationStructure = structureTemplate({
|
|
39607
39632
|
structureName: consolationStructureName,
|
|
39608
39633
|
matchUps: consolationMatchUps,
|
|
@@ -39680,8 +39705,9 @@ function feedInLinks({
|
|
|
39680
39705
|
|
|
39681
39706
|
function generateCurtisConsolation(params) {
|
|
39682
39707
|
const {
|
|
39708
|
+
structureName = constantToString(MAIN),
|
|
39709
|
+
playoffStructureNameBase,
|
|
39683
39710
|
finishingPositionOffset,
|
|
39684
|
-
structureName = MAIN,
|
|
39685
39711
|
stageSequence = 1,
|
|
39686
39712
|
structureNameMap,
|
|
39687
39713
|
staggeredEntry,
|
|
@@ -39719,6 +39745,7 @@ function generateCurtisConsolation(params) {
|
|
|
39719
39745
|
const { consolationStructure } = consolationFeedStructure({
|
|
39720
39746
|
idPrefix: idPrefix && `${idPrefix}-c${index}`,
|
|
39721
39747
|
structureId: uuids?.pop(),
|
|
39748
|
+
playoffStructureNameBase,
|
|
39722
39749
|
structureNameMap,
|
|
39723
39750
|
stageSequence: stageSequence2,
|
|
39724
39751
|
roundOffset,
|
|
@@ -39747,12 +39774,15 @@ function generateCurtisConsolation(params) {
|
|
|
39747
39774
|
matchUpType,
|
|
39748
39775
|
isMock
|
|
39749
39776
|
});
|
|
39777
|
+
const defaultName = constantToString(PLAY_OFF);
|
|
39778
|
+
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
39779
|
+
const structureName2 = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
39750
39780
|
const playoffStructure = structureTemplate({
|
|
39751
|
-
structureName: structureNameMap?.[PLAY_OFF] || PLAY_OFF,
|
|
39752
39781
|
structureId: uuids?.pop(),
|
|
39753
39782
|
matchUps: playoffMatchUps,
|
|
39754
39783
|
stageSequence: 2,
|
|
39755
39784
|
stage: PLAY_OFF,
|
|
39785
|
+
structureName: structureName2,
|
|
39756
39786
|
matchUpType
|
|
39757
39787
|
});
|
|
39758
39788
|
const playoffLink = {
|
|
@@ -39774,6 +39804,7 @@ function generateCurtisConsolation(params) {
|
|
|
39774
39804
|
return { structures, links, ...SUCCESS };
|
|
39775
39805
|
}
|
|
39776
39806
|
function consolationFeedStructure({
|
|
39807
|
+
playoffStructureNameBase,
|
|
39777
39808
|
stageSequence = 1,
|
|
39778
39809
|
structureNameMap,
|
|
39779
39810
|
roundOffset = 0,
|
|
@@ -39796,8 +39827,9 @@ function consolationFeedStructure({
|
|
|
39796
39827
|
isMock,
|
|
39797
39828
|
uuids
|
|
39798
39829
|
});
|
|
39799
|
-
const defaultName = `${CONSOLATION} ${index + 1}`;
|
|
39800
|
-
const
|
|
39830
|
+
const defaultName = `${constantToString(CONSOLATION)} ${index + 1}`;
|
|
39831
|
+
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
39832
|
+
const structureName = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
39801
39833
|
const consolationStructure = structureTemplate({
|
|
39802
39834
|
matchUps: consolationMatchUps,
|
|
39803
39835
|
stage: CONSOLATION,
|
|
@@ -39810,7 +39842,6 @@ function consolationFeedStructure({
|
|
|
39810
39842
|
}
|
|
39811
39843
|
|
|
39812
39844
|
function generatePlayoffStructures(params) {
|
|
39813
|
-
let { matchUpType } = params;
|
|
39814
39845
|
const {
|
|
39815
39846
|
finishingPositionOffset = 0,
|
|
39816
39847
|
addNameBaseToAttributeName,
|
|
@@ -39840,7 +39871,7 @@ function generatePlayoffStructures(params) {
|
|
|
39840
39871
|
const allMatchUps = [];
|
|
39841
39872
|
const structures = [];
|
|
39842
39873
|
const links = [];
|
|
39843
|
-
matchUpType = matchUpType || drawDefinition?.matchUpType;
|
|
39874
|
+
const matchUpType = params.matchUpType || drawDefinition?.matchUpType;
|
|
39844
39875
|
const finishingPositionsFrom = finishingPositionOffset + 1;
|
|
39845
39876
|
const finishingPositionsTo = finishingPositionOffset + drawSize;
|
|
39846
39877
|
const finishingPositionRange = `${finishingPositionsFrom}-${finishingPositionsTo}`;
|
|
@@ -39890,7 +39921,7 @@ function generatePlayoffStructures(params) {
|
|
|
39890
39921
|
if (playoffDrawPositions < 2)
|
|
39891
39922
|
return;
|
|
39892
39923
|
const childFinishingPositionOffset = drawSize / Math.pow(2, roundNumber) + finishingPositionOffset;
|
|
39893
|
-
if (childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
39924
|
+
if (finishingPositionLimit && childFinishingPositionOffset + 1 > finishingPositionLimit)
|
|
39894
39925
|
return;
|
|
39895
39926
|
const {
|
|
39896
39927
|
structures: childStructures,
|
|
@@ -39978,8 +40009,8 @@ function feedInChampionship(params) {
|
|
|
39978
40009
|
};
|
|
39979
40010
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
39980
40011
|
const mainStructure = structureTemplate({
|
|
40012
|
+
structureName: structureName || constantToString(MAIN),
|
|
39981
40013
|
structureId: structureId || uuids?.pop(),
|
|
39982
|
-
structureName: structureName || MAIN,
|
|
39983
40014
|
stageSequence,
|
|
39984
40015
|
matchUpType,
|
|
39985
40016
|
matchUps,
|
|
@@ -40003,9 +40034,9 @@ function feedInChampionship(params) {
|
|
|
40003
40034
|
});
|
|
40004
40035
|
if (drawSize > 2) {
|
|
40005
40036
|
const consolationStructure = structureTemplate({
|
|
40037
|
+
structureName: constantToString(CONSOLATION),
|
|
40006
40038
|
matchUps: consolationMatchUps,
|
|
40007
40039
|
structureId: uuids?.pop(),
|
|
40008
|
-
structureName: CONSOLATION,
|
|
40009
40040
|
stage: CONSOLATION,
|
|
40010
40041
|
stageSequence: 1,
|
|
40011
40042
|
matchUpType
|
|
@@ -40080,10 +40111,19 @@ function processPlayoffGroups({
|
|
|
40080
40111
|
if (positionsPlayedOff) {
|
|
40081
40112
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
40082
40113
|
}
|
|
40083
|
-
const
|
|
40114
|
+
const playoffGroupParams = {
|
|
40115
|
+
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
40116
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
40117
|
+
finishingPositionNaming: playoffGroup.finishingPositionNaming,
|
|
40118
|
+
finishingPositionLimit: playoffGroup.finishingPositionLimit,
|
|
40084
40119
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40120
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
40085
40121
|
structureNameMap: playoffGroup.structureNameMap,
|
|
40086
40122
|
structureName: playoffGroup.structureName,
|
|
40123
|
+
sequenceLimit: playoffGroup.sequenceLimit
|
|
40124
|
+
};
|
|
40125
|
+
const params = {
|
|
40126
|
+
...playoffGroupParams,
|
|
40087
40127
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
40088
40128
|
appliedPolicies: policyDefinitions,
|
|
40089
40129
|
finishingPositionOffset,
|
|
@@ -40281,13 +40321,17 @@ function generatePlayoffLink({
|
|
|
40281
40321
|
|
|
40282
40322
|
function generateRoundRobinWithPlayOff(params) {
|
|
40283
40323
|
const { drawDefinition, structureOptions, requireSequential } = params;
|
|
40284
|
-
const mainDrawProperties = {
|
|
40324
|
+
const mainDrawProperties = {
|
|
40325
|
+
structureName: constantToString(MAIN),
|
|
40326
|
+
...params,
|
|
40327
|
+
stage: MAIN
|
|
40328
|
+
};
|
|
40285
40329
|
const { structures, groupCount, groupSize } = generateRoundRobin(mainDrawProperties);
|
|
40286
40330
|
if (groupCount < 1) {
|
|
40287
40331
|
console.log(INVALID_CONFIGURATION);
|
|
40288
40332
|
}
|
|
40289
40333
|
const playoffGroups = structureOptions?.playoffGroups || [
|
|
40290
|
-
{ finishingPositions: [1], structureName: PLAY_OFF }
|
|
40334
|
+
{ finishingPositions: [1], structureName: constantToString(PLAY_OFF) }
|
|
40291
40335
|
];
|
|
40292
40336
|
const [mainStructure] = structures;
|
|
40293
40337
|
const { structures: playoffStructures, links } = processPlayoffGroups({
|
|
@@ -40405,7 +40449,7 @@ function generateDoubleElimination({
|
|
|
40405
40449
|
isMock
|
|
40406
40450
|
});
|
|
40407
40451
|
const mainStructure = structureTemplate({
|
|
40408
|
-
structureName: structureName || MAIN,
|
|
40452
|
+
structureName: structureName || constantToString(MAIN),
|
|
40409
40453
|
structureId: uuids?.pop(),
|
|
40410
40454
|
stageSequence: 1,
|
|
40411
40455
|
stage: MAIN,
|
|
@@ -40424,9 +40468,9 @@ function generateDoubleElimination({
|
|
|
40424
40468
|
uuids
|
|
40425
40469
|
});
|
|
40426
40470
|
const consolationStructure = structureTemplate({
|
|
40471
|
+
structureName: constantToString(BACKDRAW),
|
|
40427
40472
|
matchUps: consolationMatchUps,
|
|
40428
40473
|
structureId: uuids?.pop(),
|
|
40429
|
-
structureName: BACKDRAW,
|
|
40430
40474
|
stage: CONSOLATION,
|
|
40431
40475
|
stageSequence: 2,
|
|
40432
40476
|
matchUpType
|
|
@@ -40439,9 +40483,9 @@ function generateDoubleElimination({
|
|
|
40439
40483
|
isMock
|
|
40440
40484
|
});
|
|
40441
40485
|
const deciderStructure = structureTemplate({
|
|
40486
|
+
structureName: constantToString(DECIDER),
|
|
40442
40487
|
matchUps: deciderMatchUps,
|
|
40443
40488
|
structureId: uuids?.pop(),
|
|
40444
|
-
structureName: DECIDER,
|
|
40445
40489
|
stageSequence: 3,
|
|
40446
40490
|
stage: PLAY_OFF,
|
|
40447
40491
|
matchUpType
|
|
@@ -40563,11 +40607,12 @@ function getGenerators(params) {
|
|
|
40563
40607
|
const { appliedPolicies } = getAppliedPolicies(params);
|
|
40564
40608
|
const feedPolicy = params.policyDefinitions?.[POLICY_TYPE_FEED_IN] || appliedPolicies?.[POLICY_TYPE_FEED_IN];
|
|
40565
40609
|
params.skipRounds = params.skipRounds || drawSize <= 4 && (feedPolicy?.feedMainFinal ? 0 : 1) || 0;
|
|
40610
|
+
const main = constantToString(MAIN);
|
|
40566
40611
|
const singleElimination = () => {
|
|
40567
40612
|
const { matchUps } = treeMatchUps(params);
|
|
40568
40613
|
const structure = structureTemplate({
|
|
40569
|
-
structureName: structureName || MAIN,
|
|
40570
40614
|
structureId: structureId || uuids?.pop(),
|
|
40615
|
+
structureName: structureName || main,
|
|
40571
40616
|
stageSequence,
|
|
40572
40617
|
matchUpType,
|
|
40573
40618
|
matchUps,
|
|
@@ -40578,8 +40623,8 @@ function getGenerators(params) {
|
|
|
40578
40623
|
const generators = {
|
|
40579
40624
|
[AD_HOC]: () => {
|
|
40580
40625
|
const structure = structureTemplate({
|
|
40581
|
-
structureName: structureName || MAIN,
|
|
40582
40626
|
structureId: structureId || uuids?.pop(),
|
|
40627
|
+
structureName: structureName || main,
|
|
40583
40628
|
finishingPosition: WIN_RATIO,
|
|
40584
40629
|
stageSequence,
|
|
40585
40630
|
matchUps: [],
|
|
@@ -40591,8 +40636,8 @@ function getGenerators(params) {
|
|
|
40591
40636
|
[LUCKY_DRAW]: () => {
|
|
40592
40637
|
const { matchUps } = luckyDraw(params);
|
|
40593
40638
|
const structure = structureTemplate({
|
|
40594
|
-
structureName: structureName || MAIN,
|
|
40595
40639
|
structureId: structureId || uuids?.pop(),
|
|
40640
|
+
structureName: structureName || main,
|
|
40596
40641
|
stageSequence,
|
|
40597
40642
|
matchUpType,
|
|
40598
40643
|
matchUps,
|
|
@@ -40618,8 +40663,8 @@ function getGenerators(params) {
|
|
|
40618
40663
|
[FEED_IN$1]: () => {
|
|
40619
40664
|
const { matchUps } = feedInMatchUps({ drawSize, uuids, matchUpType });
|
|
40620
40665
|
const structure = structureTemplate({
|
|
40621
|
-
structureName: structureName || MAIN,
|
|
40622
40666
|
structureId: structureId || uuids?.pop(),
|
|
40667
|
+
structureName: structureName || main,
|
|
40623
40668
|
stageSequence,
|
|
40624
40669
|
matchUpType,
|
|
40625
40670
|
stage: MAIN,
|
|
@@ -43176,8 +43221,11 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
43176
43221
|
structureId: sourceStructureId,
|
|
43177
43222
|
addNameBaseToAttributeName,
|
|
43178
43223
|
playoffStructureNameBase,
|
|
43224
|
+
finishingPositionNaming,
|
|
43225
|
+
finishingPositionLimit,
|
|
43179
43226
|
playoffAttributes,
|
|
43180
43227
|
playoffPositions,
|
|
43228
|
+
roundOffsetLimit,
|
|
43181
43229
|
tournamentRecord,
|
|
43182
43230
|
exitProfileLimit,
|
|
43183
43231
|
roundProfiles,
|
|
@@ -43282,7 +43330,10 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
43282
43330
|
drawSize,
|
|
43283
43331
|
idPrefix,
|
|
43284
43332
|
isMock,
|
|
43285
|
-
uuids
|
|
43333
|
+
uuids,
|
|
43334
|
+
finishingPositionNaming,
|
|
43335
|
+
finishingPositionLimit,
|
|
43336
|
+
roundOffsetLimit
|
|
43286
43337
|
});
|
|
43287
43338
|
if (result.error)
|
|
43288
43339
|
return decorateResult({ result, stack });
|
|
@@ -43490,9 +43541,9 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
43490
43541
|
return result2;
|
|
43491
43542
|
}
|
|
43492
43543
|
tieFormat = copyTieFormat(
|
|
43493
|
-
tieFormat
|
|
43544
|
+
tieFormat ?? resolveTieFormat({ drawDefinition })?.tieFormat
|
|
43494
43545
|
);
|
|
43495
|
-
matchUpType = matchUpType
|
|
43546
|
+
matchUpType = matchUpType ?? drawDefinition.matchUpType ?? TypeEnum.Singles;
|
|
43496
43547
|
const { structures: stageStructures } = getDrawStructures({
|
|
43497
43548
|
stageSequence: 1,
|
|
43498
43549
|
drawDefinition,
|
|
@@ -43500,14 +43551,14 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
43500
43551
|
});
|
|
43501
43552
|
const structureCount = stageStructures.length;
|
|
43502
43553
|
if (structureCount > 1)
|
|
43503
|
-
return { error:
|
|
43554
|
+
return { error: STAGE_SEQUENCE_LIMIT };
|
|
43504
43555
|
if (stageStructures?.[0]?.matchUps?.length)
|
|
43505
|
-
return { error:
|
|
43556
|
+
return { error: EXISTING_STRUCTURE };
|
|
43506
43557
|
const structureId = stageStructures?.[0]?.structureId;
|
|
43507
43558
|
Object.assign(
|
|
43508
43559
|
params,
|
|
43509
43560
|
definedAttributes({
|
|
43510
|
-
structureName: params.structureName
|
|
43561
|
+
structureName: params.structureName ?? constantToString(VOLUNTARY_CONSOLATION),
|
|
43511
43562
|
structureId,
|
|
43512
43563
|
matchUpType,
|
|
43513
43564
|
tieFormat,
|
|
@@ -50604,6 +50655,90 @@ function modifyParticipantOtherName({
|
|
|
50604
50655
|
return { ...SUCCESS };
|
|
50605
50656
|
}
|
|
50606
50657
|
|
|
50658
|
+
function formatPersonName({
|
|
50659
|
+
personFormat,
|
|
50660
|
+
person
|
|
50661
|
+
}) {
|
|
50662
|
+
const alpha = (str) => str.replace(/\W/g, "");
|
|
50663
|
+
const allLowerCase = (str) => /^[a-z]*$/.test(alpha(str));
|
|
50664
|
+
const allUpperCase = (str) => /^[A-Z]*$/.test(alpha(str));
|
|
50665
|
+
const lastUpperCase = (str) => /^[LAST]{4}/.test(alpha(str));
|
|
50666
|
+
const lastFirst = (str) => str.toLowerCase().indexOf("l") < str.toLowerCase().indexOf("f");
|
|
50667
|
+
const commaSeparated = (str) => str.indexOf(",") >= 0;
|
|
50668
|
+
const firstInital = (str) => str.toLowerCase().indexOf("f.") >= 0;
|
|
50669
|
+
const lastNameOnly = (str) => str.toLowerCase().indexOf("f") < 0;
|
|
50670
|
+
const hasSpacing = (str) => str.indexOf(" ") > 0;
|
|
50671
|
+
if (!person)
|
|
50672
|
+
return;
|
|
50673
|
+
const spacer = hasSpacing(personFormat) ? " " : "";
|
|
50674
|
+
let firstName = capitalizeFirst(person?.standardGivenName ?? "");
|
|
50675
|
+
let lastName = capitalizeFirst(person?.standardFamilyName ?? "");
|
|
50676
|
+
if (!personFormat)
|
|
50677
|
+
return `${firstName}${spacer}${lastName}`;
|
|
50678
|
+
if (firstInital(personFormat) && !commaSeparated(personFormat) && !lastFirst(personFormat)) {
|
|
50679
|
+
firstName = `${firstName[0]}.`;
|
|
50680
|
+
}
|
|
50681
|
+
if (allLowerCase(personFormat)) {
|
|
50682
|
+
firstName = firstName.toLowerCase();
|
|
50683
|
+
lastName = lastName.toLowerCase();
|
|
50684
|
+
} else if (allUpperCase(personFormat)) {
|
|
50685
|
+
firstName = firstName.toUpperCase();
|
|
50686
|
+
lastName = lastName.toUpperCase();
|
|
50687
|
+
} else if (lastUpperCase(personFormat)) {
|
|
50688
|
+
lastName = lastName.toUpperCase();
|
|
50689
|
+
}
|
|
50690
|
+
let participantName = `${firstName}${spacer}${lastName}`;
|
|
50691
|
+
if (lastNameOnly(personFormat)) {
|
|
50692
|
+
participantName = lastName;
|
|
50693
|
+
} else if (lastFirst(personFormat)) {
|
|
50694
|
+
if (commaSeparated(personFormat)) {
|
|
50695
|
+
participantName = `${lastName},${spacer}${firstName}`;
|
|
50696
|
+
} else {
|
|
50697
|
+
participantName = `${lastName}${spacer}${firstName}`;
|
|
50698
|
+
}
|
|
50699
|
+
}
|
|
50700
|
+
return participantName;
|
|
50701
|
+
}
|
|
50702
|
+
|
|
50703
|
+
function formatParticipantName({
|
|
50704
|
+
participantMap,
|
|
50705
|
+
participant,
|
|
50706
|
+
formats
|
|
50707
|
+
}) {
|
|
50708
|
+
const { participantType, individualParticipantIds, person } = participant;
|
|
50709
|
+
const format = participantType && formats[participantType];
|
|
50710
|
+
if (participantType === TEAM_PARTICIPANT)
|
|
50711
|
+
return;
|
|
50712
|
+
if (format) {
|
|
50713
|
+
const { personFormat, doublesJoiner } = format;
|
|
50714
|
+
if (participantType === INDIVIDUAL) {
|
|
50715
|
+
participant.participantName = formatPersonName({ person, personFormat });
|
|
50716
|
+
}
|
|
50717
|
+
if (participantType === PAIR) {
|
|
50718
|
+
participant.participantName = individualParticipantIds?.map((id) => {
|
|
50719
|
+
const person2 = participantMap[id]?.person;
|
|
50720
|
+
return formatPersonName({ person: person2, personFormat });
|
|
50721
|
+
}).filter(Boolean).join(doublesJoiner ?? "/");
|
|
50722
|
+
}
|
|
50723
|
+
}
|
|
50724
|
+
}
|
|
50725
|
+
|
|
50726
|
+
function regenerateParticipantNames({
|
|
50727
|
+
tournamentRecord,
|
|
50728
|
+
formats
|
|
50729
|
+
}) {
|
|
50730
|
+
if (!tournamentRecord)
|
|
50731
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
50732
|
+
if (!isObject(formats))
|
|
50733
|
+
return { error: MISSING_VALUE };
|
|
50734
|
+
const participants = tournamentRecord.participants ?? [];
|
|
50735
|
+
const participantMap = createMap(participants, "participantId");
|
|
50736
|
+
for (const participant of participants) {
|
|
50737
|
+
formatParticipantName({ participant, participantMap, formats });
|
|
50738
|
+
}
|
|
50739
|
+
return { ...SUCCESS };
|
|
50740
|
+
}
|
|
50741
|
+
|
|
50607
50742
|
function getTournamentPersons({ tournamentRecord, participantFilters }) {
|
|
50608
50743
|
if (!tournamentRecord)
|
|
50609
50744
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -51097,6 +51232,7 @@ const participantGovernor = {
|
|
|
51097
51232
|
removeParticipantIdsFromAllTeams,
|
|
51098
51233
|
getParticipantMembership,
|
|
51099
51234
|
generateTeamsFromParticipantAttribute,
|
|
51235
|
+
regenerateParticipantNames,
|
|
51100
51236
|
getParticipantIdFinishingPositions,
|
|
51101
51237
|
modifyParticipant,
|
|
51102
51238
|
modifyParticipantName,
|
|
@@ -58037,7 +58173,7 @@ function generateDrawDefinition(params) {
|
|
|
58037
58173
|
}
|
|
58038
58174
|
} else if (structureId && generateQualifyingPlaceholder) {
|
|
58039
58175
|
const qualifyingStructure = structureTemplate({
|
|
58040
|
-
structureName: QUALIFYING,
|
|
58176
|
+
structureName: constantToString(QUALIFYING),
|
|
58041
58177
|
stage: QUALIFYING
|
|
58042
58178
|
});
|
|
58043
58179
|
const { link } = generateQualifyingLink({
|
|
@@ -60402,7 +60538,7 @@ function generatePersons(params) {
|
|
|
60402
60538
|
return false;
|
|
60403
60539
|
if (typeof person.lastName !== "string")
|
|
60404
60540
|
return false;
|
|
60405
|
-
if (![MALE, FEMALE].includes(person.sex))
|
|
60541
|
+
if (person.sex && ![MALE, FEMALE].includes(person.sex))
|
|
60406
60542
|
return false;
|
|
60407
60543
|
if (person.nationalityCode && (typeof person.nationalityCode !== "string" || person.nationalityCode.length > 3 || !countries.find(
|
|
60408
60544
|
({ iso, ioc }) => [iso, ioc].includes(person.nationalityCode)
|
|
@@ -60418,7 +60554,7 @@ function generatePersons(params) {
|
|
|
60418
60554
|
return { error: INVALID_VALUES };
|
|
60419
60555
|
}
|
|
60420
60556
|
}
|
|
60421
|
-
const shuffledPersons = shuffleArray(validPersonData);
|
|
60557
|
+
const shuffledPersons = personData ? validPersonData : shuffleArray(validPersonData);
|
|
60422
60558
|
if (shuffledPersons.length < count) {
|
|
60423
60559
|
const {
|
|
60424
60560
|
maleFirstNames,
|
|
@@ -63291,6 +63427,7 @@ const utilities = {
|
|
|
63291
63427
|
structureSort,
|
|
63292
63428
|
matchUpSort,
|
|
63293
63429
|
tidyScore,
|
|
63430
|
+
createMap,
|
|
63294
63431
|
generateScoreString,
|
|
63295
63432
|
calculateWinCriteria,
|
|
63296
63433
|
compareTieFormats,
|