tods-competition-factory 1.7.6 → 1.7.8
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 +158 -144
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +151 -142
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +153 -94
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.d.ts +1 -1
- package/dist/forge/utilities.mjs +126 -75
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +456 -217
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +564 -298
- 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 +5 -5
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.8";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -1727,116 +1727,6 @@ function handleCaughtError({
|
|
|
1727
1727
|
});
|
|
1728
1728
|
}
|
|
1729
1729
|
|
|
1730
|
-
function isObject(obj) {
|
|
1731
|
-
return typeof obj === "object";
|
|
1732
|
-
}
|
|
1733
|
-
const hasAttributeValues = (a) => (o) => Object.keys(a).every((key) => o[key] === a[key]);
|
|
1734
|
-
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);
|
|
1735
|
-
function getAttr(o, attr) {
|
|
1736
|
-
const attrs = attr.split(".");
|
|
1737
|
-
for (const a of attrs) {
|
|
1738
|
-
o = o?.[a];
|
|
1739
|
-
if (!o)
|
|
1740
|
-
return;
|
|
1741
|
-
}
|
|
1742
|
-
return o;
|
|
1743
|
-
}
|
|
1744
|
-
function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
|
|
1745
|
-
if (typeof obj !== "object" || obj === null)
|
|
1746
|
-
return obj;
|
|
1747
|
-
const deepCopy = deepCopyEnabled();
|
|
1748
|
-
if (!deepCopy?.enabled)
|
|
1749
|
-
shallow = true;
|
|
1750
|
-
const ignoreValues = ["", void 0, null];
|
|
1751
|
-
if (ignoreFalse)
|
|
1752
|
-
ignoreValues.push(false);
|
|
1753
|
-
const definedKeys = Object.keys(obj).filter(
|
|
1754
|
-
(key) => !ignoreValues.includes(obj[key]) && (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true))
|
|
1755
|
-
);
|
|
1756
|
-
return Object.assign(
|
|
1757
|
-
{},
|
|
1758
|
-
...definedKeys.map((key) => {
|
|
1759
|
-
return Array.isArray(obj[key]) ? {
|
|
1760
|
-
[key]: shallow ? obj[key] : obj[key].map((m) => definedAttributes(m))
|
|
1761
|
-
} : { [key]: shallow ? obj[key] : definedAttributes(obj[key]) };
|
|
1762
|
-
})
|
|
1763
|
-
);
|
|
1764
|
-
}
|
|
1765
|
-
function countKeys(o) {
|
|
1766
|
-
if (Array.isArray(o)) {
|
|
1767
|
-
return o.length + o.map(countKeys).reduce((a, b) => a + b, 0);
|
|
1768
|
-
} else if (typeof o === "object" && o !== null) {
|
|
1769
|
-
return Object.keys(o).length + Object.keys(o).map((k) => countKeys(o[k])).reduce((a, b) => a + b, 0);
|
|
1770
|
-
}
|
|
1771
|
-
return 0;
|
|
1772
|
-
}
|
|
1773
|
-
function generateHashCode(o) {
|
|
1774
|
-
if (o === null || typeof o !== "object")
|
|
1775
|
-
return void 0;
|
|
1776
|
-
const str = JSON.stringify(o);
|
|
1777
|
-
const keyCount = countKeys(o);
|
|
1778
|
-
const charSum = str.split("").reduce((a, b) => a + b.charCodeAt(0), 0);
|
|
1779
|
-
return [str.length, keyCount, charSum].map((e) => e.toString(36)).join("");
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
function attributeFilter(params) {
|
|
1783
|
-
if (params === null)
|
|
1784
|
-
return {};
|
|
1785
|
-
const { source, template } = params || {};
|
|
1786
|
-
if (!template)
|
|
1787
|
-
return source;
|
|
1788
|
-
const target = {};
|
|
1789
|
-
attributeCopy(source, template, target);
|
|
1790
|
-
return target;
|
|
1791
|
-
function attributeCopy(valuesObject, templateObject, outputObject) {
|
|
1792
|
-
if (!valuesObject || !templateObject)
|
|
1793
|
-
return void 0;
|
|
1794
|
-
const vKeys = Object.keys(valuesObject);
|
|
1795
|
-
const oKeys = Object.keys(templateObject);
|
|
1796
|
-
const orMap = Object.assign(
|
|
1797
|
-
{},
|
|
1798
|
-
...oKeys.filter((key) => key.indexOf("||")).map((key) => key.split("||").map((or) => ({ [or]: key }))).flat()
|
|
1799
|
-
);
|
|
1800
|
-
const allKeys = oKeys.concat(...Object.keys(orMap));
|
|
1801
|
-
const wildcard = allKeys.includes("*");
|
|
1802
|
-
for (const vKey of vKeys) {
|
|
1803
|
-
if (allKeys.indexOf(vKey) >= 0 || wildcard) {
|
|
1804
|
-
const templateKey = orMap[vKey] || vKey;
|
|
1805
|
-
const tobj = templateObject[templateKey] || wildcard;
|
|
1806
|
-
const vobj = valuesObject[vKey];
|
|
1807
|
-
if (typeof tobj === "object" && typeof vobj !== "function" && !Array.isArray(tobj)) {
|
|
1808
|
-
if (Array.isArray(vobj)) {
|
|
1809
|
-
const mappedElements = vobj.map((arrayMember) => {
|
|
1810
|
-
const target2 = {};
|
|
1811
|
-
const result = attributeCopy(arrayMember, tobj, target2);
|
|
1812
|
-
return result !== false ? target2 : void 0;
|
|
1813
|
-
}).filter(Boolean);
|
|
1814
|
-
outputObject[vKey] = mappedElements;
|
|
1815
|
-
} else if (vobj) {
|
|
1816
|
-
outputObject[vKey] = {};
|
|
1817
|
-
attributeCopy(vobj, tobj, outputObject[vKey]);
|
|
1818
|
-
}
|
|
1819
|
-
} else {
|
|
1820
|
-
const value = valuesObject[vKey];
|
|
1821
|
-
const exclude = Array.isArray(tobj) && !tobj.includes(value);
|
|
1822
|
-
if (exclude)
|
|
1823
|
-
return false;
|
|
1824
|
-
if (templateObject[vKey] || wildcard && templateObject[vKey] !== false) {
|
|
1825
|
-
outputObject[vKey] = value;
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
}
|
|
1830
|
-
return void 0;
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
|
|
1834
|
-
function generateTimeCode(index = 0) {
|
|
1835
|
-
const uidate = /* @__PURE__ */ new Date();
|
|
1836
|
-
uidate.setHours(uidate.getHours() + index);
|
|
1837
|
-
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
1730
|
const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
1841
1731
|
const validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
1842
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?$/;
|
|
@@ -2206,6 +2096,182 @@ function extensionsToAttributes(extensions) {
|
|
|
2206
2096
|
}).filter(Boolean);
|
|
2207
2097
|
}
|
|
2208
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
|
+
|
|
2209
2275
|
function numericSort(a, b) {
|
|
2210
2276
|
return a - b;
|
|
2211
2277
|
}
|
|
@@ -4217,7 +4283,8 @@ function getCollectionPositionMatchUps({ matchUps }) {
|
|
|
4217
4283
|
|
|
4218
4284
|
const add = (a, b) => (a || 0) + (b || 0);
|
|
4219
4285
|
function getBand(spread, bandProfiles) {
|
|
4220
|
-
|
|
4286
|
+
const spreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
4287
|
+
return isNaN(spreadValue) && WALKOVER$1 || spreadValue <= bandProfiles[DECISIVE] && DECISIVE || spreadValue <= bandProfiles[ROUTINE] && ROUTINE || COMPETITIVE;
|
|
4221
4288
|
}
|
|
4222
4289
|
function getScoreComponents({ score }) {
|
|
4223
4290
|
const sets = score?.sets || [];
|
|
@@ -4287,7 +4354,8 @@ function getMatchUpCompetitiveProfile({
|
|
|
4287
4354
|
const scoreComponents = getScoreComponents({ score });
|
|
4288
4355
|
const spread = pctSpread([scoreComponents]);
|
|
4289
4356
|
const competitiveness = getBand(spread, bandProfiles);
|
|
4290
|
-
|
|
4357
|
+
const pctSpreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
4358
|
+
return { ...SUCCESS, competitiveness, pctSpread: pctSpreadValue };
|
|
4291
4359
|
}
|
|
4292
4360
|
|
|
4293
4361
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -7600,12 +7668,15 @@ function isAdHoc({ drawDefinition, structure }) {
|
|
|
7600
7668
|
const hasDrawPosition = matchUps?.find(
|
|
7601
7669
|
(matchUp) => matchUp?.drawPositions?.length
|
|
7602
7670
|
);
|
|
7603
|
-
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;
|
|
7604
7672
|
}
|
|
7605
7673
|
|
|
7606
7674
|
const POLICY_ROUND_NAMING_DEFAULT = {
|
|
7607
7675
|
[POLICY_TYPE_ROUND_NAMING]: {
|
|
7608
7676
|
policyName: "Round Naming Default",
|
|
7677
|
+
namingConventions: {
|
|
7678
|
+
round: "Round"
|
|
7679
|
+
},
|
|
7609
7680
|
abbreviatedRoundNamingMap: {
|
|
7610
7681
|
// key is matchUpsCount for the round
|
|
7611
7682
|
1: "F",
|
|
@@ -7645,6 +7716,9 @@ function getRoundContextProfile({
|
|
|
7645
7716
|
const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
|
|
7646
7717
|
const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
|
|
7647
7718
|
const roundNamePrefix = roundNamingPolicy?.affixes || defaultRoundNamingPolicy.affixes;
|
|
7719
|
+
const roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
7720
|
+
const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
|
|
7721
|
+
const roundNameFallback = namingConventions.round;
|
|
7648
7722
|
const stageInitial = stage && stage !== MAIN && stage[0];
|
|
7649
7723
|
const stageConstants = roundNamingPolicy?.stageConstants;
|
|
7650
7724
|
const stageConstant = stage && stageConstants?.[stage] || stageInitial;
|
|
@@ -7653,8 +7727,8 @@ function getRoundContextProfile({
|
|
|
7653
7727
|
Object.assign(
|
|
7654
7728
|
roundNamingProfile,
|
|
7655
7729
|
...roundProfileKeys.map((key) => {
|
|
7656
|
-
const roundName =
|
|
7657
|
-
const abbreviatedRoundName =
|
|
7730
|
+
const roundName = `${roundNameFallback} ${key}`;
|
|
7731
|
+
const abbreviatedRoundName = `${roundNumberAffix}${key}`;
|
|
7658
7732
|
return { [key]: { roundName, abbreviatedRoundName } };
|
|
7659
7733
|
})
|
|
7660
7734
|
);
|
|
@@ -26130,56 +26204,6 @@ function getEventPublishStatuses({ event }) {
|
|
|
26130
26204
|
return void 0;
|
|
26131
26205
|
}
|
|
26132
26206
|
|
|
26133
|
-
function getAccessorValue({ element, accessor }) {
|
|
26134
|
-
if (typeof accessor !== "string")
|
|
26135
|
-
return { values: [] };
|
|
26136
|
-
const targetElement = makeDeepCopy(element);
|
|
26137
|
-
const attributes = accessor.split(".");
|
|
26138
|
-
const values = [];
|
|
26139
|
-
let value;
|
|
26140
|
-
processKeys({ targetElement, attributes });
|
|
26141
|
-
const result = { value };
|
|
26142
|
-
if (values.length)
|
|
26143
|
-
result.values = values;
|
|
26144
|
-
return result;
|
|
26145
|
-
function processKeys({
|
|
26146
|
-
targetElement: targetElement2,
|
|
26147
|
-
attributes: attributes2 = [],
|
|
26148
|
-
significantCharacters
|
|
26149
|
-
}) {
|
|
26150
|
-
for (const [index, attribute] of attributes2.entries()) {
|
|
26151
|
-
if (targetElement2?.[attribute]) {
|
|
26152
|
-
if (Array.isArray(targetElement2[attribute])) {
|
|
26153
|
-
const values2 = targetElement2[attribute];
|
|
26154
|
-
const remainingKeys = attributes2.slice(index);
|
|
26155
|
-
values2.forEach(
|
|
26156
|
-
(nestedTarget) => processKeys({
|
|
26157
|
-
targetElement: nestedTarget,
|
|
26158
|
-
attributes: remainingKeys
|
|
26159
|
-
})
|
|
26160
|
-
);
|
|
26161
|
-
} else {
|
|
26162
|
-
targetElement2 = targetElement2[attribute];
|
|
26163
|
-
checkValue({ targetElement: targetElement2, index });
|
|
26164
|
-
}
|
|
26165
|
-
}
|
|
26166
|
-
}
|
|
26167
|
-
function checkValue({ targetElement: targetElement3, index }) {
|
|
26168
|
-
if (targetElement3 && index === attributes2.length - 1 && ["string", "number"].includes(typeof targetElement3)) {
|
|
26169
|
-
const extractedValue = significantCharacters ? targetElement3.slice(0, significantCharacters) : targetElement3;
|
|
26170
|
-
if (value) {
|
|
26171
|
-
if (!values.includes(extractedValue)) {
|
|
26172
|
-
values.push(extractedValue);
|
|
26173
|
-
}
|
|
26174
|
-
} else {
|
|
26175
|
-
value = extractedValue;
|
|
26176
|
-
values.push(extractedValue);
|
|
26177
|
-
}
|
|
26178
|
-
}
|
|
26179
|
-
}
|
|
26180
|
-
}
|
|
26181
|
-
}
|
|
26182
|
-
|
|
26183
26207
|
function participantScaleItem({
|
|
26184
26208
|
requireTimeStamp,
|
|
26185
26209
|
scaleAttributes,
|
|
@@ -26381,8 +26405,8 @@ function modifyMatchUpFormatTiming$1({
|
|
|
26381
26405
|
recoveryTimes
|
|
26382
26406
|
});
|
|
26383
26407
|
addTournamentExtension({
|
|
26384
|
-
|
|
26385
|
-
|
|
26408
|
+
extension: { name, value },
|
|
26409
|
+
tournamentRecord
|
|
26386
26410
|
});
|
|
26387
26411
|
}
|
|
26388
26412
|
return { ...SUCCESS };
|
|
@@ -47470,7 +47494,10 @@ const matchUpGovernor = {
|
|
|
47470
47494
|
validateScore
|
|
47471
47495
|
};
|
|
47472
47496
|
|
|
47473
|
-
function attachPolicies({
|
|
47497
|
+
function attachPolicies({
|
|
47498
|
+
drawDefinition,
|
|
47499
|
+
policyDefinitions
|
|
47500
|
+
}) {
|
|
47474
47501
|
if (!drawDefinition) {
|
|
47475
47502
|
return { error: MISSING_DRAW_DEFINITION };
|
|
47476
47503
|
}
|
|
@@ -47480,8 +47507,9 @@ function attachPolicies({ drawDefinition, policyDefinitions }) {
|
|
|
47480
47507
|
if (!drawDefinition.extensions)
|
|
47481
47508
|
drawDefinition.extensions = [];
|
|
47482
47509
|
const appliedPolicies = getAppliedPolicies({ drawDefinition })?.appliedPolicies ?? {};
|
|
47510
|
+
const validReplacements = [POLICY_TYPE_ROUND_NAMING, POLICY_TYPE_DISPLAY];
|
|
47483
47511
|
const applied = Object.keys(policyDefinitions).every((policyType) => {
|
|
47484
|
-
if (!appliedPolicies[policyType]) {
|
|
47512
|
+
if (!appliedPolicies[policyType] || validReplacements.includes(policyType)) {
|
|
47485
47513
|
appliedPolicies[policyType] = policyDefinitions[policyType];
|
|
47486
47514
|
return true;
|
|
47487
47515
|
} else {
|
|
@@ -50589,6 +50617,93 @@ function modifyParticipantOtherName({
|
|
|
50589
50617
|
return { ...SUCCESS };
|
|
50590
50618
|
}
|
|
50591
50619
|
|
|
50620
|
+
function formatPersonName({
|
|
50621
|
+
personFormat,
|
|
50622
|
+
person
|
|
50623
|
+
}) {
|
|
50624
|
+
const alpha = (str) => str.replace(/\W/g, "");
|
|
50625
|
+
const allLowerCase = (str) => /^[a-z]*$/.test(alpha(str));
|
|
50626
|
+
const allUpperCase = (str) => /^[A-Z]*$/.test(alpha(str));
|
|
50627
|
+
const lastUpperCase = (str) => /^[LAST]{4}/.test(alpha(str));
|
|
50628
|
+
const lastFirst = (str) => str.toLowerCase().indexOf("l") < str.toLowerCase().indexOf("f");
|
|
50629
|
+
const commaSeparated = (str) => str.indexOf(",") >= 0;
|
|
50630
|
+
const firstInital = (str) => str.toLowerCase().indexOf("f.") >= 0;
|
|
50631
|
+
const lastNameOnly = (str) => str.toLowerCase().indexOf("f") < 0;
|
|
50632
|
+
const hasSpacing = (str) => str.indexOf(" ") > 0;
|
|
50633
|
+
if (!person)
|
|
50634
|
+
return;
|
|
50635
|
+
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
|
+
let firstName = capitalizeFirst(person?.standardGivenName ?? "");
|
|
50640
|
+
let lastName = capitalizeFirst(person?.standardFamilyName ?? "");
|
|
50641
|
+
if (!personFormat)
|
|
50642
|
+
return `${firstName}${spacer}${lastName}`;
|
|
50643
|
+
if (firstInital(personFormat) && !commaSeparated(personFormat) && !lastFirst(personFormat)) {
|
|
50644
|
+
firstName = `${firstName[0]}.`;
|
|
50645
|
+
}
|
|
50646
|
+
if (allLowerCase(personFormat)) {
|
|
50647
|
+
firstName = firstName.toLowerCase();
|
|
50648
|
+
lastName = lastName.toLowerCase();
|
|
50649
|
+
} else if (allUpperCase(personFormat)) {
|
|
50650
|
+
firstName = firstName.toUpperCase();
|
|
50651
|
+
lastName = lastName.toUpperCase();
|
|
50652
|
+
} else if (lastUpperCase(personFormat)) {
|
|
50653
|
+
lastName = lastName.toUpperCase();
|
|
50654
|
+
}
|
|
50655
|
+
let participantName = `${firstName}${spacer}${lastName}`;
|
|
50656
|
+
if (lastNameOnly(personFormat)) {
|
|
50657
|
+
participantName = lastName;
|
|
50658
|
+
} else if (lastFirst(personFormat)) {
|
|
50659
|
+
if (commaSeparated(personFormat)) {
|
|
50660
|
+
participantName = `${lastName},${spacer}${firstName}`;
|
|
50661
|
+
} else {
|
|
50662
|
+
participantName = `${lastName}${spacer}${firstName}`;
|
|
50663
|
+
}
|
|
50664
|
+
}
|
|
50665
|
+
return participantName;
|
|
50666
|
+
}
|
|
50667
|
+
|
|
50668
|
+
function formatParticipantName({
|
|
50669
|
+
participantMap,
|
|
50670
|
+
participant,
|
|
50671
|
+
formats
|
|
50672
|
+
}) {
|
|
50673
|
+
const { participantType, individualParticipantIds, person } = participant;
|
|
50674
|
+
const format = participantType && formats[participantType];
|
|
50675
|
+
if (participantType === TEAM_PARTICIPANT)
|
|
50676
|
+
return;
|
|
50677
|
+
if (format) {
|
|
50678
|
+
const { personFormat, doublesJoiner } = format;
|
|
50679
|
+
if (participantType === INDIVIDUAL) {
|
|
50680
|
+
participant.participantName = formatPersonName({ person, personFormat });
|
|
50681
|
+
}
|
|
50682
|
+
if (participantType === PAIR) {
|
|
50683
|
+
participant.participantName = individualParticipantIds?.map((id) => {
|
|
50684
|
+
const person2 = participantMap[id]?.person;
|
|
50685
|
+
return formatPersonName({ person: person2, personFormat });
|
|
50686
|
+
}).filter(Boolean).join(doublesJoiner ?? "/");
|
|
50687
|
+
}
|
|
50688
|
+
}
|
|
50689
|
+
}
|
|
50690
|
+
|
|
50691
|
+
function regenerateParticipantNames({
|
|
50692
|
+
tournamentRecord,
|
|
50693
|
+
formats
|
|
50694
|
+
}) {
|
|
50695
|
+
if (!tournamentRecord)
|
|
50696
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
50697
|
+
if (!isObject(formats))
|
|
50698
|
+
return { error: MISSING_VALUE };
|
|
50699
|
+
const participants = tournamentRecord.participants ?? [];
|
|
50700
|
+
const participantMap = createMap(participants, "participantId");
|
|
50701
|
+
for (const participant of participants) {
|
|
50702
|
+
formatParticipantName({ participant, participantMap, formats });
|
|
50703
|
+
}
|
|
50704
|
+
return { ...SUCCESS };
|
|
50705
|
+
}
|
|
50706
|
+
|
|
50592
50707
|
function getTournamentPersons({ tournamentRecord, participantFilters }) {
|
|
50593
50708
|
if (!tournamentRecord)
|
|
50594
50709
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -51082,6 +51197,7 @@ const participantGovernor = {
|
|
|
51082
51197
|
removeParticipantIdsFromAllTeams,
|
|
51083
51198
|
getParticipantMembership,
|
|
51084
51199
|
generateTeamsFromParticipantAttribute,
|
|
51200
|
+
regenerateParticipantNames,
|
|
51085
51201
|
getParticipantIdFinishingPositions,
|
|
51086
51202
|
modifyParticipant,
|
|
51087
51203
|
modifyParticipantName,
|
|
@@ -56423,13 +56539,6 @@ function deleteFlightAndFlightDraw({
|
|
|
56423
56539
|
return refreshEventDrawOrder({ tournamentRecord, event });
|
|
56424
56540
|
}
|
|
56425
56541
|
|
|
56426
|
-
function generateAdHocMatchUps(params) {
|
|
56427
|
-
return generateAdHocMatchUps$1(params);
|
|
56428
|
-
}
|
|
56429
|
-
function addAdHocMatchUps(params) {
|
|
56430
|
-
return addAdHocMatchUps$1(params);
|
|
56431
|
-
}
|
|
56432
|
-
|
|
56433
56542
|
function attachFlightProfile({ deleteExisting, event, flightProfile }) {
|
|
56434
56543
|
const stack = "attachFlightProfile";
|
|
56435
56544
|
if (!flightProfile)
|
|
@@ -56635,6 +56744,98 @@ function deleteAdHocMatchUps(params) {
|
|
|
56635
56744
|
return deleteAdHocMatchUps$1(params);
|
|
56636
56745
|
}
|
|
56637
56746
|
|
|
56747
|
+
function modifyDrawName({
|
|
56748
|
+
tournamentRecord,
|
|
56749
|
+
drawDefinition,
|
|
56750
|
+
flightProfile,
|
|
56751
|
+
drawName,
|
|
56752
|
+
drawId,
|
|
56753
|
+
event
|
|
56754
|
+
}) {
|
|
56755
|
+
if (!drawName || typeof drawName !== "string")
|
|
56756
|
+
return decorateResult({
|
|
56757
|
+
result: { error: INVALID_VALUES },
|
|
56758
|
+
context: { drawName }
|
|
56759
|
+
});
|
|
56760
|
+
if (!flightProfile) {
|
|
56761
|
+
flightProfile = getFlightProfile({ event }).flightProfile;
|
|
56762
|
+
}
|
|
56763
|
+
const flight = flightProfile?.flights?.find(
|
|
56764
|
+
(flight2) => flight2.drawId === drawId
|
|
56765
|
+
);
|
|
56766
|
+
if (flight) {
|
|
56767
|
+
flight.drawName = drawName;
|
|
56768
|
+
const extension = {
|
|
56769
|
+
name: FLIGHT_PROFILE,
|
|
56770
|
+
value: {
|
|
56771
|
+
...flightProfile,
|
|
56772
|
+
flights: flightProfile.flights
|
|
56773
|
+
}
|
|
56774
|
+
};
|
|
56775
|
+
addEventExtension$1({ event, extension });
|
|
56776
|
+
}
|
|
56777
|
+
if (drawDefinition) {
|
|
56778
|
+
drawDefinition.drawName = drawName;
|
|
56779
|
+
modifyDrawNotice({
|
|
56780
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
56781
|
+
drawDefinition
|
|
56782
|
+
});
|
|
56783
|
+
}
|
|
56784
|
+
if (!flight && !drawDefinition) {
|
|
56785
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
56786
|
+
}
|
|
56787
|
+
return { ...SUCCESS, flight };
|
|
56788
|
+
}
|
|
56789
|
+
|
|
56790
|
+
function modifyDrawDefinition({
|
|
56791
|
+
tournamentRecord,
|
|
56792
|
+
drawDefinition,
|
|
56793
|
+
drawUpdates,
|
|
56794
|
+
drawId,
|
|
56795
|
+
event
|
|
56796
|
+
}) {
|
|
56797
|
+
if (!isObject(drawUpdates))
|
|
56798
|
+
return { error: INVALID_END_TIME };
|
|
56799
|
+
const flightProfile = getFlightProfile({ event }).flightProfile;
|
|
56800
|
+
const nameResult = drawUpdates.drawName && modifyDrawName({
|
|
56801
|
+
drawName: drawUpdates.drawName,
|
|
56802
|
+
tournamentRecord,
|
|
56803
|
+
drawDefinition,
|
|
56804
|
+
flightProfile,
|
|
56805
|
+
drawId,
|
|
56806
|
+
event
|
|
56807
|
+
});
|
|
56808
|
+
if (nameResult?.error)
|
|
56809
|
+
return nameResult?.error;
|
|
56810
|
+
const flight = nameResult?.flight || flightProfile?.flights?.find((flight2) => flight2.drawId === drawId);
|
|
56811
|
+
if (!flight && !drawDefinition) {
|
|
56812
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
56813
|
+
}
|
|
56814
|
+
if (flight) {
|
|
56815
|
+
const extension = {
|
|
56816
|
+
name: FLIGHT_PROFILE,
|
|
56817
|
+
value: {
|
|
56818
|
+
...flightProfile,
|
|
56819
|
+
flights: flightProfile.flights
|
|
56820
|
+
}
|
|
56821
|
+
};
|
|
56822
|
+
addEventExtension$1({ event, extension });
|
|
56823
|
+
}
|
|
56824
|
+
if (drawDefinition) {
|
|
56825
|
+
if (drawUpdates.policyDefinitions) {
|
|
56826
|
+
attachPolicies({
|
|
56827
|
+
policyDefinitions: drawUpdates.policyDefinitions,
|
|
56828
|
+
drawDefinition
|
|
56829
|
+
});
|
|
56830
|
+
}
|
|
56831
|
+
modifyDrawNotice({
|
|
56832
|
+
tournamentId: tournamentRecord?.tournamentId,
|
|
56833
|
+
drawDefinition
|
|
56834
|
+
});
|
|
56835
|
+
}
|
|
56836
|
+
return { ...SUCCESS };
|
|
56837
|
+
}
|
|
56838
|
+
|
|
56638
56839
|
function resetDrawDefinition({
|
|
56639
56840
|
tournamentRecord,
|
|
56640
56841
|
removeScheduling,
|
|
@@ -56795,34 +56996,6 @@ function setOrderOfFinish(params) {
|
|
|
56795
56996
|
return setOrderOfFinish$1(params);
|
|
56796
56997
|
}
|
|
56797
56998
|
|
|
56798
|
-
function modifyDrawName({ event, drawId, drawDefinition, drawName }) {
|
|
56799
|
-
if (!drawName || typeof drawName !== "string")
|
|
56800
|
-
return { error: INVALID_VALUES, drawName };
|
|
56801
|
-
const { flightProfile } = getFlightProfile({ event });
|
|
56802
|
-
const flight = flightProfile?.flights?.find(
|
|
56803
|
-
(flight2) => flight2.drawId === drawId
|
|
56804
|
-
);
|
|
56805
|
-
if (flight) {
|
|
56806
|
-
flight.drawName = drawName;
|
|
56807
|
-
const extension = {
|
|
56808
|
-
name: FLIGHT_PROFILE,
|
|
56809
|
-
value: {
|
|
56810
|
-
...flightProfile,
|
|
56811
|
-
flights: flightProfile.flights
|
|
56812
|
-
}
|
|
56813
|
-
};
|
|
56814
|
-
addEventExtension$1({ event, extension });
|
|
56815
|
-
}
|
|
56816
|
-
if (drawDefinition) {
|
|
56817
|
-
drawDefinition.drawName = drawName;
|
|
56818
|
-
modifyDrawNotice({ drawDefinition });
|
|
56819
|
-
}
|
|
56820
|
-
if (!flight && !drawDefinition) {
|
|
56821
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
56822
|
-
}
|
|
56823
|
-
return { ...SUCCESS };
|
|
56824
|
-
}
|
|
56825
|
-
|
|
56826
56999
|
function modifyEventEntries({
|
|
56827
57000
|
entryStatus = DIRECT_ACCEPTANCE,
|
|
56828
57001
|
unpairedParticipantIds = [],
|
|
@@ -56958,6 +57131,13 @@ function addFlight({
|
|
|
56958
57131
|
return addEventExtension$1({ event, extension });
|
|
56959
57132
|
}
|
|
56960
57133
|
|
|
57134
|
+
function generateAdHocMatchUps(params) {
|
|
57135
|
+
return generateAdHocMatchUps$1(params);
|
|
57136
|
+
}
|
|
57137
|
+
function addAdHocMatchUps(params) {
|
|
57138
|
+
return addAdHocMatchUps$1(params);
|
|
57139
|
+
}
|
|
57140
|
+
|
|
56961
57141
|
function attachConsolationStructures(params) {
|
|
56962
57142
|
return attachStructures({
|
|
56963
57143
|
...params,
|
|
@@ -58119,6 +58299,61 @@ function enableTieAutoCalc(params) {
|
|
|
58119
58299
|
return enableTieAutoCalc$1(params);
|
|
58120
58300
|
}
|
|
58121
58301
|
|
|
58302
|
+
function modifyEvent({
|
|
58303
|
+
tournamentRecord,
|
|
58304
|
+
eventUpdates,
|
|
58305
|
+
eventId,
|
|
58306
|
+
event
|
|
58307
|
+
}) {
|
|
58308
|
+
if (!tournamentRecord)
|
|
58309
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
58310
|
+
if (!isString(eventId) || !isObject(eventUpdates))
|
|
58311
|
+
return { error: INVALID_VALUES };
|
|
58312
|
+
const enteredParticipantIds = event?.entries?.filter(({ entryStatus }) => {
|
|
58313
|
+
const status = entryStatus;
|
|
58314
|
+
return [...STRUCTURE_SELECTED_STATUSES, ALTERNATE].includes(status);
|
|
58315
|
+
}).map(({ participantId }) => participantId) || [];
|
|
58316
|
+
const enteredParticipants = enteredParticipantIds ? getParticipants$1({
|
|
58317
|
+
participantFilters: { participantIds: enteredParticipantIds },
|
|
58318
|
+
withIndividualParticipants: true,
|
|
58319
|
+
tournamentRecord
|
|
58320
|
+
}).participants || [] : [];
|
|
58321
|
+
const genderAccumulator = [];
|
|
58322
|
+
const enteredParticipantTypes = enteredParticipants.reduce(
|
|
58323
|
+
(types, participant) => {
|
|
58324
|
+
const genders = participant.person?.sex ? [participant.person.sex] : participant.individualParticpants?.map((p) => p.person?.sex) || [];
|
|
58325
|
+
genderAccumulator.push(...genders);
|
|
58326
|
+
return !types.includes(participant.participantType) ? types.concat(participant.participantType) : types;
|
|
58327
|
+
},
|
|
58328
|
+
[]
|
|
58329
|
+
);
|
|
58330
|
+
const enteredParticipantGenders = unique(genderAccumulator);
|
|
58331
|
+
const validGender = !enteredParticipantGenders.length || [MIXED, ANY].includes(eventUpdates.gender || "") || enteredParticipantGenders.length === 1 && enteredParticipantGenders[0] === eventUpdates.gender;
|
|
58332
|
+
if (eventUpdates.gender && !validGender)
|
|
58333
|
+
return decorateResult({
|
|
58334
|
+
context: { gender: eventUpdates.gender },
|
|
58335
|
+
result: { error: INVALID_VALUES }
|
|
58336
|
+
});
|
|
58337
|
+
const validEventTypes = enteredParticipantTypes.includes(TEAM$1) && [TEAM$1] || enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES] || enteredParticipantTypes.includes(PAIR) && [DOUBLES] || [
|
|
58338
|
+
DOUBLES,
|
|
58339
|
+
SINGLES,
|
|
58340
|
+
TEAM$1
|
|
58341
|
+
];
|
|
58342
|
+
const validEventType = validEventTypes.includes(eventUpdates.eventType || "");
|
|
58343
|
+
if (eventUpdates.eventType && !validEventType)
|
|
58344
|
+
return decorateResult({
|
|
58345
|
+
context: { participantType: eventUpdates.eventType },
|
|
58346
|
+
result: { error: INVALID_VALUES }
|
|
58347
|
+
});
|
|
58348
|
+
if (eventUpdates.eventType)
|
|
58349
|
+
event.eventType === eventUpdates.eventType;
|
|
58350
|
+
if (eventUpdates.eventName)
|
|
58351
|
+
event.eventName = eventUpdates.eventName;
|
|
58352
|
+
if (eventUpdates.gender)
|
|
58353
|
+
event.gender = eventUpdates.gender;
|
|
58354
|
+
return { ...SUCCESS };
|
|
58355
|
+
}
|
|
58356
|
+
|
|
58122
58357
|
const eventGovernor = {
|
|
58123
58358
|
generateQualifyingStructure,
|
|
58124
58359
|
attachQualifyingStructure,
|
|
@@ -58139,11 +58374,12 @@ const eventGovernor = {
|
|
|
58139
58374
|
modifyTieFormat: modifyTieFormat$1,
|
|
58140
58375
|
resetScorecard,
|
|
58141
58376
|
resetTieFormat: resetTieFormat$1,
|
|
58142
|
-
addEvent,
|
|
58143
|
-
deleteEvents,
|
|
58144
|
-
setEventDates,
|
|
58145
58377
|
setEventStartDate,
|
|
58146
58378
|
setEventEndDate,
|
|
58379
|
+
setEventDates,
|
|
58380
|
+
deleteEvents,
|
|
58381
|
+
modifyEvent,
|
|
58382
|
+
addEvent,
|
|
58147
58383
|
removeSeededParticipant,
|
|
58148
58384
|
removeScaleValues,
|
|
58149
58385
|
checkValidEntries,
|
|
@@ -58155,6 +58391,7 @@ const eventGovernor = {
|
|
|
58155
58391
|
getAvailablePlayoffProfiles,
|
|
58156
58392
|
deleteDrawDefinitions,
|
|
58157
58393
|
addPlayoffStructures,
|
|
58394
|
+
modifyDrawDefinition,
|
|
58158
58395
|
addDrawDefinition: addDrawDefinition$1,
|
|
58159
58396
|
removeStructure,
|
|
58160
58397
|
modifyDrawName,
|
|
@@ -58259,9 +58496,9 @@ function getPredictiveAccuracy(params) {
|
|
|
58259
58496
|
exclusionRule,
|
|
58260
58497
|
zoneDoubling,
|
|
58261
58498
|
matchUpType,
|
|
58262
|
-
zoneMargin,
|
|
58263
58499
|
scaleName,
|
|
58264
58500
|
eventId,
|
|
58501
|
+
zonePct,
|
|
58265
58502
|
drawId,
|
|
58266
58503
|
event
|
|
58267
58504
|
} = params;
|
|
@@ -58274,6 +58511,8 @@ function getPredictiveAccuracy(params) {
|
|
|
58274
58511
|
const scaleProfile = ratingsParameters[scaleName];
|
|
58275
58512
|
const ascending = scaleProfile?.ascending ?? params.ascending ?? false;
|
|
58276
58513
|
const valueAccessor = scaleProfile?.accessor ?? params.valueAccessor;
|
|
58514
|
+
const ratingsRangeDifference = Array.isArray(scaleProfile?.range) ? Math.abs(scaleProfile.range[0] - scaleProfile.range[1]) : 0;
|
|
58515
|
+
const zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference ? (zonePct || 0 / 100) * ratingsRangeDifference : params.zoneMargin || ratingsRangeDifference;
|
|
58277
58516
|
const contextProfile = { withScaleValues: true, withCompetitiveness: true };
|
|
58278
58517
|
const contextFilters = {
|
|
58279
58518
|
matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1]
|
|
@@ -58311,7 +58550,7 @@ function getPredictiveAccuracy(params) {
|
|
|
58311
58550
|
}
|
|
58312
58551
|
const relevantMatchUps = matchUps.filter(
|
|
58313
58552
|
({ winningSide, score, sides, matchUpStatus }) => ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(
|
|
58314
|
-
matchUpStatus
|
|
58553
|
+
matchUpStatus || ""
|
|
58315
58554
|
) && scoreHasValue({ score }) && sides?.length === 2 && winningSide
|
|
58316
58555
|
);
|
|
58317
58556
|
const accuracy = getGroupingAccuracy({
|
|
@@ -58322,8 +58561,8 @@ function getPredictiveAccuracy(params) {
|
|
|
58322
58561
|
ascending,
|
|
58323
58562
|
scaleName
|
|
58324
58563
|
});
|
|
58325
|
-
const marginCalc = !zoneDoubling || matchUpType === SINGLES$1 ? zoneMargin : zoneMargin * 2;
|
|
58326
|
-
const zoneData = zoneMargin
|
|
58564
|
+
const marginCalc = !zoneDoubling || matchUpType === SINGLES$1 ? zoneMargin : (zoneMargin || 0) * 2;
|
|
58565
|
+
const zoneData = zoneMargin ? relevantMatchUps.map(({ competitiveProfile, matchUpType: matchUpType2, score, sides }) => {
|
|
58327
58566
|
const sideValues = getSideValues({
|
|
58328
58567
|
valueAccessor,
|
|
58329
58568
|
matchUpType: matchUpType2,
|
|
@@ -58338,8 +58577,8 @@ function getPredictiveAccuracy(params) {
|
|
|
58338
58577
|
};
|
|
58339
58578
|
}).filter(({ valuesGap }) => {
|
|
58340
58579
|
return valuesGap <= marginCalc;
|
|
58341
|
-
});
|
|
58342
|
-
const zoneBands =
|
|
58580
|
+
}) : [];
|
|
58581
|
+
const zoneBands = getGroupingBands({ zoneData });
|
|
58343
58582
|
const totalZoneMatchUps = zoneBands && [].concat(Object.values(zoneBands)).flat().length;
|
|
58344
58583
|
const zoneDistribution = totalZoneMatchUps && Object.assign(
|
|
58345
58584
|
{},
|
|
@@ -58490,7 +58729,7 @@ function getGroupingAccuracy({
|
|
|
58490
58729
|
continue;
|
|
58491
58730
|
}
|
|
58492
58731
|
const valuesGap = sideValues[winningIndex].value - sideValues[1 - winningIndex].value;
|
|
58493
|
-
const floatMargin = parseFloat(excludeMargin);
|
|
58732
|
+
const floatMargin = parseFloat(excludeMargin || 0);
|
|
58494
58733
|
const excludeGap = floatMargin && Math.abs(valuesGap) < floatMargin;
|
|
58495
58734
|
if (excludeGap) {
|
|
58496
58735
|
accuracy.excluded.push({
|
|
@@ -60264,7 +60503,7 @@ function generatePersons(params) {
|
|
|
60264
60503
|
return false;
|
|
60265
60504
|
if (typeof person.lastName !== "string")
|
|
60266
60505
|
return false;
|
|
60267
|
-
if (![MALE, FEMALE].includes(person.sex))
|
|
60506
|
+
if (person.sex && ![MALE, FEMALE].includes(person.sex))
|
|
60268
60507
|
return false;
|
|
60269
60508
|
if (person.nationalityCode && (typeof person.nationalityCode !== "string" || person.nationalityCode.length > 3 || !countries.find(
|
|
60270
60509
|
({ iso, ioc }) => [iso, ioc].includes(person.nationalityCode)
|
|
@@ -60280,7 +60519,7 @@ function generatePersons(params) {
|
|
|
60280
60519
|
return { error: INVALID_VALUES };
|
|
60281
60520
|
}
|
|
60282
60521
|
}
|
|
60283
|
-
const shuffledPersons = shuffleArray(validPersonData);
|
|
60522
|
+
const shuffledPersons = personData ? validPersonData : shuffleArray(validPersonData);
|
|
60284
60523
|
if (shuffledPersons.length < count) {
|
|
60285
60524
|
const {
|
|
60286
60525
|
maleFirstNames,
|