tods-competition-factory 1.8.2 → 1.8.4
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 +11 -3
- package/dist/forge/generate.mjs +337 -65
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +24 -12
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +250 -4
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +175 -0
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +347 -173
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +422 -225
- 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 +1 -1
package/dist/index.mjs
CHANGED
|
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
|
|
|
333
333
|
};
|
|
334
334
|
|
|
335
335
|
function factoryVersion() {
|
|
336
|
-
return "1.8.
|
|
336
|
+
return "1.8.4";
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
function getObjectTieFormat(obj) {
|
|
@@ -396,10 +396,6 @@ function resolveTieFormat({
|
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
|
|
399
|
-
function mustBeAnArray(value) {
|
|
400
|
-
return `${value} must be an array`;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
399
|
function unique(arr) {
|
|
404
400
|
return arr.filter((item, i, s) => s.lastIndexOf(item) === i);
|
|
405
401
|
}
|
|
@@ -1166,10 +1162,18 @@ const INVALID_CONFIGURATION = {
|
|
|
1166
1162
|
message: "Invalid configuration",
|
|
1167
1163
|
code: "ERR_INVALID_CONFIG"
|
|
1168
1164
|
};
|
|
1165
|
+
const INVALID_COLLECTION_DEFINITION = {
|
|
1166
|
+
message: "Invalid collectionDefinition",
|
|
1167
|
+
code: "ERR_INVALID_COLLECTION_DEFINITION"
|
|
1168
|
+
};
|
|
1169
1169
|
const INVALID_OBJECT = {
|
|
1170
1170
|
message: "Invalid object",
|
|
1171
1171
|
code: "ERR_INVALID_OBJECT"
|
|
1172
1172
|
};
|
|
1173
|
+
const INVALID_CATEGORY = {
|
|
1174
|
+
message: "Invalid category",
|
|
1175
|
+
code: "ERR_INVALID_CATEGORY"
|
|
1176
|
+
};
|
|
1173
1177
|
const INVALID_VALUES = {
|
|
1174
1178
|
message: "Invalid values",
|
|
1175
1179
|
code: "ERR_INVALID_VALUES"
|
|
@@ -1270,6 +1274,8 @@ const errorConditionConstants = {
|
|
|
1270
1274
|
INVALID_ACTION,
|
|
1271
1275
|
INVALID_ASSIGNMENT,
|
|
1272
1276
|
INVALID_BOOKINGS,
|
|
1277
|
+
INVALID_CATEGORY,
|
|
1278
|
+
INVALID_COLLECTION_DEFINITION,
|
|
1273
1279
|
INVALID_CONFIGURATION,
|
|
1274
1280
|
INVALID_DATE_AVAILABILITY,
|
|
1275
1281
|
INVALID_DATE,
|
|
@@ -1712,6 +1718,9 @@ function setTournamentId(tournamentId) {
|
|
|
1712
1718
|
function removeTournamentRecord(tournamentId) {
|
|
1713
1719
|
return _globalStateProvider.removeTournamentRecord(tournamentId);
|
|
1714
1720
|
}
|
|
1721
|
+
function getProvider() {
|
|
1722
|
+
return _globalStateProvider;
|
|
1723
|
+
}
|
|
1715
1724
|
function handleCaughtError({
|
|
1716
1725
|
engineName,
|
|
1717
1726
|
methodName,
|
|
@@ -2040,6 +2049,13 @@ const dateTime = {
|
|
|
2040
2049
|
};
|
|
2041
2050
|
|
|
2042
2051
|
function makeDeepCopy(sourceObject, convertExtensions, internalUse, removeExtensions, iteration = 0) {
|
|
2052
|
+
if (getProvider().makeDeepCopy)
|
|
2053
|
+
return getProvider().makeDeepCopy(
|
|
2054
|
+
sourceObject,
|
|
2055
|
+
convertExtensions,
|
|
2056
|
+
internalUse,
|
|
2057
|
+
removeExtensions
|
|
2058
|
+
);
|
|
2043
2059
|
const deepCopy = deepCopyEnabled();
|
|
2044
2060
|
const { stringify, toJSON, ignore, modulate } = deepCopy || {};
|
|
2045
2061
|
if (!deepCopy?.enabled && !internalUse || typeof sourceObject !== "object" || typeof sourceObject === "function" || sourceObject === null || typeof deepCopy?.threshold === "number" && iteration >= deepCopy.threshold) {
|
|
@@ -2214,6 +2230,177 @@ function generateHashCode(o) {
|
|
|
2214
2230
|
return [str.length, keyCount, charSum].map((e) => e.toString(36)).join("");
|
|
2215
2231
|
}
|
|
2216
2232
|
|
|
2233
|
+
const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
|
|
2234
|
+
const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
|
|
2235
|
+
function getCategoryAgeDetails(params) {
|
|
2236
|
+
const category = params.category;
|
|
2237
|
+
if (typeof category !== "object")
|
|
2238
|
+
return { error: INVALID_CATEGORY };
|
|
2239
|
+
let { ageCategoryCode, ageMaxDate, ageMinDate, ageMax, ageMin } = category;
|
|
2240
|
+
const categoryName = category.categoryName;
|
|
2241
|
+
let combinedAge;
|
|
2242
|
+
if (!typeMatch(
|
|
2243
|
+
[ageCategoryCode, ageMaxDate, ageMinDate, categoryName],
|
|
2244
|
+
"string"
|
|
2245
|
+
) || !allNumeric(
|
|
2246
|
+
[ageMax, ageMin]
|
|
2247
|
+
))
|
|
2248
|
+
return { error: INVALID_CATEGORY };
|
|
2249
|
+
const consideredDate = params.consideredDate ?? extractDate((/* @__PURE__ */ new Date()).toLocaleDateString("sv"));
|
|
2250
|
+
if (!isValidDateString(consideredDate))
|
|
2251
|
+
return { error: INVALID_DATE };
|
|
2252
|
+
const [consideredYear] = consideredDate.split("-").slice(0, 3).map((n) => parseInt(n));
|
|
2253
|
+
const previousDayDate = dateStringDaysChange(consideredDate, -1);
|
|
2254
|
+
const [previousDayMonth, previousDay] = previousDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2255
|
+
const previousMonthDay = `${zeroPad(previousDayMonth)}-${zeroPad(
|
|
2256
|
+
previousDay
|
|
2257
|
+
)}`;
|
|
2258
|
+
const nextDayDate = dateStringDaysChange(consideredDate, 1);
|
|
2259
|
+
const [nextDayMonth, nextDay] = nextDayDate.split("-").slice(1, 3).map((n) => parseInt(n));
|
|
2260
|
+
const nextMonthDay = `${zeroPad(nextDayMonth)}-${zeroPad(nextDay)}`;
|
|
2261
|
+
let calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
|
|
2262
|
+
let calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
|
|
2263
|
+
const errors = [];
|
|
2264
|
+
const addError = (errorString) => !errors.includes(errorString) && errors.push(errorString);
|
|
2265
|
+
ageCategoryCode = ageCategoryCode ?? categoryName;
|
|
2266
|
+
const prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
2267
|
+
const extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
2268
|
+
const isBetween = ageCategoryCode?.includes("-");
|
|
2269
|
+
const isCombined = isBetween && ageCategoryCode?.match(extractCombined);
|
|
2270
|
+
const isCoded = ageCategoryCode?.match(prePost);
|
|
2271
|
+
const constructedDate = (y, df) => `${y}-${df}`;
|
|
2272
|
+
const uPre = (ageInt) => {
|
|
2273
|
+
const ageMinYear = consideredYear - ageInt;
|
|
2274
|
+
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2275
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2276
|
+
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2277
|
+
ageMinDate = newMinDate;
|
|
2278
|
+
if (ageCategoryCode) {
|
|
2279
|
+
if (category.ageMax && category.ageMax !== ageInt - 1) {
|
|
2280
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2281
|
+
calculatedAgeMinDate = void 0;
|
|
2282
|
+
}
|
|
2283
|
+
ageMax = ageInt - 1;
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
const uPost = (ageInt) => {
|
|
2287
|
+
const ageMinYear = consideredYear - ageInt - 1;
|
|
2288
|
+
const newMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2289
|
+
if (category.ageMin && category.ageMin > ageInt) {
|
|
2290
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2291
|
+
}
|
|
2292
|
+
if (category.ageMax && category.ageMax > ageInt) {
|
|
2293
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2294
|
+
}
|
|
2295
|
+
if (category.ageMinDate && category.ageMinDate !== newMinDate)
|
|
2296
|
+
addError(`Invalid submitted ageMinDate: ${ageMinDate}`);
|
|
2297
|
+
ageMinDate = newMinDate;
|
|
2298
|
+
if (ageCategoryCode) {
|
|
2299
|
+
if (category.ageMax && category.ageMax !== ageInt) {
|
|
2300
|
+
addError(`Invalid submitted ageMax: ${ageMax}`);
|
|
2301
|
+
calculatedAgeMaxDate = void 0;
|
|
2302
|
+
}
|
|
2303
|
+
ageMax = ageInt;
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
const oPre = (ageInt) => {
|
|
2307
|
+
const ageMaxYear = consideredYear - ageInt;
|
|
2308
|
+
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2309
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2310
|
+
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2311
|
+
ageMaxDate = newMaxDate;
|
|
2312
|
+
if (ageCategoryCode) {
|
|
2313
|
+
if (category.ageMin && category.ageMin !== ageInt + 1) {
|
|
2314
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2315
|
+
calculatedAgeMaxDate = void 0;
|
|
2316
|
+
}
|
|
2317
|
+
ageMin = ageInt + 1;
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
const oPost = (ageInt) => {
|
|
2321
|
+
const ageMaxYear = consideredYear - ageInt - 1;
|
|
2322
|
+
const newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2323
|
+
if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
|
|
2324
|
+
addError(`Invalid submitted ageMaxDate: ${ageMaxDate}`);
|
|
2325
|
+
ageMaxDate = newMaxDate;
|
|
2326
|
+
if (ageCategoryCode) {
|
|
2327
|
+
if (category.ageMin && category.ageMin !== ageInt) {
|
|
2328
|
+
addError(`Invalid submitted ageMin: ${ageMin}`);
|
|
2329
|
+
calculatedAgeMaxDate = void 0;
|
|
2330
|
+
}
|
|
2331
|
+
ageMin = ageInt;
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
const processCode = (code) => {
|
|
2335
|
+
const [pre, age, post] = (code.match(prePost) || []).slice(1);
|
|
2336
|
+
const ageInt = parseInt(age);
|
|
2337
|
+
if (pre === "U") {
|
|
2338
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2339
|
+
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2340
|
+
}
|
|
2341
|
+
uPre(ageInt);
|
|
2342
|
+
} else if (pre === "O") {
|
|
2343
|
+
oPre(ageInt);
|
|
2344
|
+
}
|
|
2345
|
+
if (post === "U") {
|
|
2346
|
+
if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
|
|
2347
|
+
addError(`Invalid submitted ageMaxDate: ${category.ageMaxDate}`);
|
|
2348
|
+
}
|
|
2349
|
+
uPost(ageInt);
|
|
2350
|
+
} else if (post === "O") {
|
|
2351
|
+
oPost(ageInt);
|
|
2352
|
+
}
|
|
2353
|
+
ageMaxDate = ageMaxDate ?? calculatedAgeMaxDate;
|
|
2354
|
+
ageMinDate = ageMinDate ?? calculatedAgeMinDate;
|
|
2355
|
+
};
|
|
2356
|
+
if (isCombined) {
|
|
2357
|
+
ageMaxDate = void 0;
|
|
2358
|
+
ageMinDate = void 0;
|
|
2359
|
+
ageMax = void 0;
|
|
2360
|
+
ageMin = void 0;
|
|
2361
|
+
if (category.ageMin) {
|
|
2362
|
+
const ageMaxYear = consideredYear - category.ageMin;
|
|
2363
|
+
ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
|
|
2364
|
+
}
|
|
2365
|
+
if (category.ageMax) {
|
|
2366
|
+
const ageMinYear = consideredYear - category.ageMax - 1;
|
|
2367
|
+
ageMinDate = constructedDate(ageMinYear, nextMonthDay);
|
|
2368
|
+
}
|
|
2369
|
+
const [lowAge, highAge] = (ageCategoryCode?.match(extractCombined) ?? []).slice(1).map((n) => parseInt(n));
|
|
2370
|
+
if (lowAge <= highAge) {
|
|
2371
|
+
ageMin = lowAge;
|
|
2372
|
+
ageMax = highAge;
|
|
2373
|
+
combinedAge = true;
|
|
2374
|
+
} else {
|
|
2375
|
+
addError(`Invalid combined age range ${ageCategoryCode}`);
|
|
2376
|
+
}
|
|
2377
|
+
} else if (isBetween) {
|
|
2378
|
+
ageCategoryCode?.split("-").forEach(processCode);
|
|
2379
|
+
} else if (isCoded) {
|
|
2380
|
+
processCode(ageCategoryCode);
|
|
2381
|
+
} else {
|
|
2382
|
+
if (ageMin)
|
|
2383
|
+
oPre(ageMin);
|
|
2384
|
+
if (ageMax)
|
|
2385
|
+
uPost(ageMax);
|
|
2386
|
+
}
|
|
2387
|
+
if (ageMax && category.ageMin && category.ageMin > ageMax) {
|
|
2388
|
+
addError(`Invalid submitted ageMin: ${category.ageMin}`);
|
|
2389
|
+
ageMin = void 0;
|
|
2390
|
+
}
|
|
2391
|
+
const result = definedAttributes({
|
|
2392
|
+
consideredDate,
|
|
2393
|
+
combinedAge,
|
|
2394
|
+
ageMaxDate,
|
|
2395
|
+
ageMinDate,
|
|
2396
|
+
ageMax,
|
|
2397
|
+
ageMin
|
|
2398
|
+
});
|
|
2399
|
+
if (errors.length)
|
|
2400
|
+
result.errors = errors;
|
|
2401
|
+
return result;
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2217
2404
|
function attributeFilter(params) {
|
|
2218
2405
|
if (params === null)
|
|
2219
2406
|
return {};
|
|
@@ -2415,6 +2602,41 @@ function UUID() {
|
|
|
2415
2602
|
lut[d3 & 255] + lut[d3 >> 8 & 255] + lut[d3 >> 16 & 255] + lut[d3 >> 24 & 255];
|
|
2416
2603
|
}
|
|
2417
2604
|
|
|
2605
|
+
function categoryCanContain({
|
|
2606
|
+
childCategory,
|
|
2607
|
+
withDetails,
|
|
2608
|
+
category
|
|
2609
|
+
}) {
|
|
2610
|
+
const categoryDetails = getCategoryAgeDetails({ category });
|
|
2611
|
+
const childCategoryDetails = getCategoryAgeDetails({
|
|
2612
|
+
category: childCategory
|
|
2613
|
+
});
|
|
2614
|
+
const invalidAgeMin = childCategoryDetails.ageMin && (categoryDetails.ageMin && childCategoryDetails.ageMin < categoryDetails.ageMin || categoryDetails.ageMax && childCategoryDetails.ageMin > categoryDetails.ageMax);
|
|
2615
|
+
const invalidAgeMax = childCategoryDetails.ageMax && (categoryDetails.ageMax && childCategoryDetails.ageMax > categoryDetails.ageMax || categoryDetails.ageMin && childCategoryDetails.ageMax < categoryDetails.ageMin);
|
|
2616
|
+
const invalidAgeMinDate = childCategoryDetails.ageMinDate && categoryDetails.ageMaxDate && new Date(childCategoryDetails.ageMinDate) > new Date(categoryDetails.ageMaxDate);
|
|
2617
|
+
const invalidAgeMaxDate = childCategoryDetails.ageMaxDate && categoryDetails.ageMinDate && new Date(childCategoryDetails.ageMaxDate) < new Date(categoryDetails.ageMinDate);
|
|
2618
|
+
const valid = !invalidAgeMax && !invalidAgeMin && !invalidAgeMinDate && !invalidAgeMaxDate;
|
|
2619
|
+
const ignoreFalse = true;
|
|
2620
|
+
const result = definedAttributes(
|
|
2621
|
+
{
|
|
2622
|
+
valid,
|
|
2623
|
+
invalidAgeMax,
|
|
2624
|
+
invalidAgeMin,
|
|
2625
|
+
invalidAgeMinDate,
|
|
2626
|
+
invalidAgeMaxDate
|
|
2627
|
+
},
|
|
2628
|
+
ignoreFalse
|
|
2629
|
+
);
|
|
2630
|
+
if (withDetails) {
|
|
2631
|
+
Object.assign(result, { categoryDetails, childCategoryDetails });
|
|
2632
|
+
}
|
|
2633
|
+
return result;
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
function mustBeAnArray(value) {
|
|
2637
|
+
return `${value} must be an array`;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2418
2640
|
function decorateResult({
|
|
2419
2641
|
context,
|
|
2420
2642
|
result,
|
|
@@ -2553,6 +2775,7 @@ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
|
|
|
2553
2775
|
})(ParticipantTypeEnum || {});
|
|
2554
2776
|
|
|
2555
2777
|
function validateTieFormat(params) {
|
|
2778
|
+
const checkCategory = !!(params?.enforceCategory !== false && params?.category);
|
|
2556
2779
|
const checkGender = !!(params?.enforceGender !== false && params?.gender);
|
|
2557
2780
|
const checkCollectionIds = params?.checkCollectionIds;
|
|
2558
2781
|
const tieFormat = params?.tieFormat;
|
|
@@ -2589,9 +2812,11 @@ function validateTieFormat(params) {
|
|
|
2589
2812
|
if ((setValue || scoreValue) && !collectionValue)
|
|
2590
2813
|
aggregateValueImperative = true;
|
|
2591
2814
|
const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
|
|
2815
|
+
referenceCategory: params.category,
|
|
2592
2816
|
referenceGender: params.gender,
|
|
2593
2817
|
collectionDefinition,
|
|
2594
2818
|
checkCollectionIds,
|
|
2819
|
+
checkCategory,
|
|
2595
2820
|
checkGender
|
|
2596
2821
|
});
|
|
2597
2822
|
if (valid2) {
|
|
@@ -2633,19 +2858,22 @@ function validateTieFormat(params) {
|
|
|
2633
2858
|
return result;
|
|
2634
2859
|
}
|
|
2635
2860
|
function validateCollectionDefinition({
|
|
2861
|
+
checkCategory = true,
|
|
2636
2862
|
collectionDefinition,
|
|
2637
2863
|
checkCollectionIds,
|
|
2638
2864
|
checkGender = true,
|
|
2865
|
+
referenceCategory,
|
|
2639
2866
|
referenceGender,
|
|
2640
2867
|
event
|
|
2641
2868
|
}) {
|
|
2642
2869
|
referenceGender = referenceGender ?? event?.gender;
|
|
2870
|
+
const stack = "validateCollectionDefinition";
|
|
2643
2871
|
const errors = [];
|
|
2644
2872
|
if (typeof collectionDefinition !== "object") {
|
|
2645
2873
|
errors.push(
|
|
2646
2874
|
`collectionDefinition must be an object: ${collectionDefinition}`
|
|
2647
2875
|
);
|
|
2648
|
-
return { errors, error: INVALID_OBJECT };
|
|
2876
|
+
return decorateResult({ result: { errors, error: INVALID_OBJECT }, stack });
|
|
2649
2877
|
}
|
|
2650
2878
|
const {
|
|
2651
2879
|
collectionValueProfiles,
|
|
@@ -2658,6 +2886,7 @@ function validateCollectionDefinition({
|
|
|
2658
2886
|
matchUpType,
|
|
2659
2887
|
scoreValue,
|
|
2660
2888
|
setValue,
|
|
2889
|
+
category,
|
|
2661
2890
|
gender
|
|
2662
2891
|
} = collectionDefinition;
|
|
2663
2892
|
if (checkCollectionIds && typeof collectionId !== "string") {
|
|
@@ -2703,8 +2932,23 @@ function validateCollectionDefinition({
|
|
|
2703
2932
|
if (checkGender && referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender) {
|
|
2704
2933
|
errors.push(`Invalid gender: ${gender}`);
|
|
2705
2934
|
}
|
|
2935
|
+
if (checkCategory && referenceCategory && category) {
|
|
2936
|
+
const result = categoryCanContain({
|
|
2937
|
+
category: referenceCategory,
|
|
2938
|
+
childCategory: category
|
|
2939
|
+
});
|
|
2940
|
+
if (!result.valid)
|
|
2941
|
+
return decorateResult({
|
|
2942
|
+
result: { error: INVALID_CATEGORY },
|
|
2943
|
+
context: result,
|
|
2944
|
+
stack
|
|
2945
|
+
});
|
|
2946
|
+
}
|
|
2706
2947
|
if (errors.length)
|
|
2707
|
-
return {
|
|
2948
|
+
return decorateResult({
|
|
2949
|
+
result: { errors, error: INVALID_COLLECTION_DEFINITION },
|
|
2950
|
+
stack
|
|
2951
|
+
});
|
|
2708
2952
|
return { valid: true };
|
|
2709
2953
|
}
|
|
2710
2954
|
function checkTieFormat(tieFormat) {
|
|
@@ -6441,20 +6685,20 @@ const ROUND_ROBIN_WITH_PLAYOFF = "ROUND_ROBIN_WITH_PLAYOFF";
|
|
|
6441
6685
|
const DECIDER = "DECIDER";
|
|
6442
6686
|
const BACKDRAW = "BACKDRAW";
|
|
6443
6687
|
const COMPASS_ATTRIBUTES = {
|
|
6444
|
-
0: { name: "
|
|
6445
|
-
"0-1": { name: "
|
|
6446
|
-
"0-2": { name: "
|
|
6447
|
-
"0-3": { name: "
|
|
6448
|
-
"0-1-1": { name: "
|
|
6449
|
-
"0-1-2": { name: "
|
|
6450
|
-
"0-2-1": { name: "
|
|
6451
|
-
"0-1-1-1": { name: "
|
|
6688
|
+
0: { name: "East", abbreviation: "E" },
|
|
6689
|
+
"0-1": { name: "West", abbreviation: "W" },
|
|
6690
|
+
"0-2": { name: "North", abbreviation: "N" },
|
|
6691
|
+
"0-3": { name: "Northeast", abbreviation: "NE" },
|
|
6692
|
+
"0-1-1": { name: "South", abbreviation: "S" },
|
|
6693
|
+
"0-1-2": { name: "Southwest", abbreviation: "SW" },
|
|
6694
|
+
"0-2-1": { name: "Northwest", abbreviation: "NW" },
|
|
6695
|
+
"0-1-1-1": { name: "Southeast", abbreviation: "SE" }
|
|
6452
6696
|
};
|
|
6453
6697
|
const OLYMPIC_ATTRIBUTES = {
|
|
6454
|
-
0: { name: "
|
|
6455
|
-
"0-1": { name: "
|
|
6456
|
-
"0-2": { name: "
|
|
6457
|
-
"0-1-1": { name: "
|
|
6698
|
+
0: { name: "East", abbreviation: "E" },
|
|
6699
|
+
"0-1": { name: "West", abbreviation: "W" },
|
|
6700
|
+
"0-2": { name: "North", abbreviation: "N" },
|
|
6701
|
+
"0-1-1": { name: "South", abbreviation: "S" }
|
|
6458
6702
|
};
|
|
6459
6703
|
const WIN_RATIO = "WIN_RATIO";
|
|
6460
6704
|
const ROUND_OUTCOME = "ROUND_OUTCOME";
|
|
@@ -17427,103 +17671,6 @@ const garman = {
|
|
|
17427
17671
|
courtGenerator
|
|
17428
17672
|
};
|
|
17429
17673
|
|
|
17430
|
-
const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
|
|
17431
|
-
const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
|
|
17432
|
-
function parseAgeCategoryCode({ consideredDate, category } = { consideredDate: "" }) {
|
|
17433
|
-
const invalid = { error: INVALID_VALUES, ageMin: 8, ageMax: 99 };
|
|
17434
|
-
if (typeof category !== "object" || !isValidDateString(consideredDate))
|
|
17435
|
-
return invalid;
|
|
17436
|
-
const consideredYear = parseInt(consideredDate.split("-")[0]);
|
|
17437
|
-
const errors = [];
|
|
17438
|
-
let { ageCategoryCode, ageMaxDate, ageMinDate, ageMax, ageMin } = category;
|
|
17439
|
-
const categoryName = category.categoryName;
|
|
17440
|
-
let combinedAge;
|
|
17441
|
-
if (!typeMatch(
|
|
17442
|
-
[ageCategoryCode, ageMaxDate, ageMinDate, categoryName],
|
|
17443
|
-
"string"
|
|
17444
|
-
) || !allNumeric([ageMax, ageMin]))
|
|
17445
|
-
return invalid;
|
|
17446
|
-
ageCategoryCode = ageCategoryCode ?? categoryName;
|
|
17447
|
-
const prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
|
|
17448
|
-
const extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
|
|
17449
|
-
const isBetween = ageCategoryCode?.includes("-");
|
|
17450
|
-
const isCombined = isBetween && ageCategoryCode?.match(extractCombined);
|
|
17451
|
-
const isCoded = ageCategoryCode?.match(prePost);
|
|
17452
|
-
const isYYMM = (datePart) => datePart.match(/^\d{2}-\d{2}$/);
|
|
17453
|
-
const constructedDate = (y, d, df) => isValidDateString(d) && d || d && isYYMM(d) && `${y}-${d}` || `${y}-${df}`;
|
|
17454
|
-
const uPre = (ageInt) => {
|
|
17455
|
-
const ageMinYear = consideredYear - ageInt;
|
|
17456
|
-
ageMinDate = constructedDate(ageMinYear, ageMinDate, "01-01");
|
|
17457
|
-
if (ageMax && ageMax !== ageInt - 1)
|
|
17458
|
-
errors.push(`Invalid ageMax: ${ageMax}`);
|
|
17459
|
-
if (!ageMax)
|
|
17460
|
-
ageMax = ageInt - 1;
|
|
17461
|
-
return { ageMinDate, ageMax };
|
|
17462
|
-
};
|
|
17463
|
-
const uPost = (ageInt) => {
|
|
17464
|
-
const ageMinYear = consideredYear - ageInt - 1;
|
|
17465
|
-
ageMinDate = constructedDate(ageMinYear, ageMinDate, "01-01");
|
|
17466
|
-
if (ageMax && ageMax !== ageInt)
|
|
17467
|
-
errors.push(`Invalid ageMax: ${ageMax}`);
|
|
17468
|
-
if (!ageMax)
|
|
17469
|
-
ageMax = ageInt;
|
|
17470
|
-
return { ageMinDate, ageMax };
|
|
17471
|
-
};
|
|
17472
|
-
const oPre = (ageInt) => {
|
|
17473
|
-
const ageMaxYear = consideredYear - ageInt - 2;
|
|
17474
|
-
ageMaxDate = constructedDate(ageMaxYear, ageMaxDate, "12-31");
|
|
17475
|
-
if (ageMin && ageMin !== ageInt + 1)
|
|
17476
|
-
errors.push(`Invalid ageMin: ${ageMin}`);
|
|
17477
|
-
if (!ageMin)
|
|
17478
|
-
ageMin = ageInt + 1;
|
|
17479
|
-
return { ageMaxDate, ageMin };
|
|
17480
|
-
};
|
|
17481
|
-
const oPost = (ageInt) => {
|
|
17482
|
-
const ageMaxYear = consideredYear - ageInt - 1;
|
|
17483
|
-
ageMaxDate = constructedDate(ageMaxYear, ageMaxDate, "12-31");
|
|
17484
|
-
if (ageMin && ageMin !== ageInt)
|
|
17485
|
-
errors.push(`Invalid ageMin: ${ageMin}`);
|
|
17486
|
-
if (!ageMin)
|
|
17487
|
-
ageMin = ageInt;
|
|
17488
|
-
return { ageMaxDate, ageMin };
|
|
17489
|
-
};
|
|
17490
|
-
const processCode = (code) => {
|
|
17491
|
-
const [pre, age, post] = (code.match(prePost) || []).slice(1);
|
|
17492
|
-
const ageInt = parseInt(age);
|
|
17493
|
-
if (pre === "U")
|
|
17494
|
-
({ ageMinDate, ageMax } = uPre(ageInt));
|
|
17495
|
-
if (post === "U")
|
|
17496
|
-
({ ageMinDate, ageMax } = uPost(ageInt));
|
|
17497
|
-
if (pre === "O")
|
|
17498
|
-
({ ageMaxDate, ageMin } = oPre(ageInt));
|
|
17499
|
-
if (post === "O")
|
|
17500
|
-
({ ageMaxDate, ageMin } = oPost(ageInt));
|
|
17501
|
-
};
|
|
17502
|
-
if (isCombined) {
|
|
17503
|
-
const [lowAge, highAge] = (ageCategoryCode?.match(extractCombined) ?? []).slice(1).map((n) => parseInt(n));
|
|
17504
|
-
if (lowAge <= highAge) {
|
|
17505
|
-
ageMin = ageMin ?? lowAge;
|
|
17506
|
-
ageMax = ageMax ?? highAge;
|
|
17507
|
-
combinedAge = true;
|
|
17508
|
-
} else {
|
|
17509
|
-
errors.push(`Invalid combined age range ${ageCategoryCode}`);
|
|
17510
|
-
}
|
|
17511
|
-
} else if (isBetween) {
|
|
17512
|
-
ageCategoryCode?.split("-").forEach(processCode);
|
|
17513
|
-
} else if (isCoded) {
|
|
17514
|
-
processCode(ageCategoryCode);
|
|
17515
|
-
}
|
|
17516
|
-
if (errors.length)
|
|
17517
|
-
return { error: errors, ageMin: 8, ageMax: 99 };
|
|
17518
|
-
return definedAttributes({
|
|
17519
|
-
combinedAge,
|
|
17520
|
-
ageMaxDate,
|
|
17521
|
-
ageMinDate,
|
|
17522
|
-
ageMax,
|
|
17523
|
-
ageMin
|
|
17524
|
-
});
|
|
17525
|
-
}
|
|
17526
|
-
|
|
17527
17674
|
function parseScoreString({
|
|
17528
17675
|
tiebreakTo = 7,
|
|
17529
17676
|
scoreString
|
|
@@ -23108,21 +23255,25 @@ const structureTemplate = ({
|
|
|
23108
23255
|
return structure;
|
|
23109
23256
|
};
|
|
23110
23257
|
|
|
23111
|
-
function generateRoundRobin({
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23117
|
-
|
|
23118
|
-
|
|
23119
|
-
|
|
23120
|
-
|
|
23121
|
-
|
|
23122
|
-
|
|
23123
|
-
|
|
23124
|
-
|
|
23125
|
-
|
|
23258
|
+
function generateRoundRobin(params) {
|
|
23259
|
+
const {
|
|
23260
|
+
groupNameBase = "Group",
|
|
23261
|
+
playoffAttributes,
|
|
23262
|
+
stageSequence = 1,
|
|
23263
|
+
structureOptions,
|
|
23264
|
+
appliedPolicies,
|
|
23265
|
+
seedingProfile,
|
|
23266
|
+
stage = MAIN,
|
|
23267
|
+
matchUpType,
|
|
23268
|
+
roundTarget,
|
|
23269
|
+
structureId,
|
|
23270
|
+
groupNames,
|
|
23271
|
+
drawSize,
|
|
23272
|
+
idPrefix,
|
|
23273
|
+
isMock,
|
|
23274
|
+
uuids
|
|
23275
|
+
} = params;
|
|
23276
|
+
const structureName = params.structureName ?? playoffAttributes?.["0"]?.name ?? constantToString(MAIN);
|
|
23126
23277
|
const { groupCount, groupSize } = deriveGroups({
|
|
23127
23278
|
structureOptions,
|
|
23128
23279
|
appliedPolicies,
|
|
@@ -23142,12 +23293,13 @@ function generateRoundRobin({
|
|
|
23142
23293
|
maxRoundNumber = Math.max(
|
|
23143
23294
|
...matchUps.map(({ roundNumber }) => roundNumber)
|
|
23144
23295
|
);
|
|
23296
|
+
const structureName2 = groupNames?.[structureOrder - 1] ?? `${groupNameBase} ${structureOrder}`;
|
|
23145
23297
|
return structureTemplate({
|
|
23146
|
-
structureName: `Group ${structureOrder}`,
|
|
23147
23298
|
structureId: uuids?.pop(),
|
|
23148
23299
|
structureType: ITEM,
|
|
23149
23300
|
finishingPosition,
|
|
23150
23301
|
structureOrder,
|
|
23302
|
+
structureName: structureName2,
|
|
23151
23303
|
matchUps
|
|
23152
23304
|
});
|
|
23153
23305
|
});
|
|
@@ -30304,7 +30456,9 @@ function removeCollectionDefinition(params) {
|
|
|
30304
30456
|
function addCollectionDefinition$1({
|
|
30305
30457
|
updateInProgressMatchUps = true,
|
|
30306
30458
|
collectionDefinition,
|
|
30459
|
+
referenceCategory,
|
|
30307
30460
|
tournamentRecord,
|
|
30461
|
+
enforceCategory,
|
|
30308
30462
|
referenceGender,
|
|
30309
30463
|
drawDefinition,
|
|
30310
30464
|
tieFormatName,
|
|
@@ -30322,16 +30476,21 @@ function addCollectionDefinition$1({
|
|
|
30322
30476
|
drawDefinition,
|
|
30323
30477
|
event
|
|
30324
30478
|
}).appliedPolicies ?? {};
|
|
30325
|
-
|
|
30326
|
-
|
|
30327
|
-
|
|
30479
|
+
const matchUpActionsPolicy = appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS];
|
|
30480
|
+
enforceCategory = enforceCategory ?? matchUpActionsPolicy?.participants?.enforceCategory;
|
|
30481
|
+
enforceGender = enforceGender ?? matchUpActionsPolicy?.participants?.enforceGender;
|
|
30482
|
+
const checkCategory = !!((referenceCategory ?? event?.category) && enforceCategory !== false);
|
|
30483
|
+
const checkGender = !!((referenceGender ?? event?.gender) && enforceGender !== false);
|
|
30484
|
+
const validationResult = validateCollectionDefinition({
|
|
30485
|
+
referenceCategory: referenceCategory ?? event?.category,
|
|
30328
30486
|
collectionDefinition,
|
|
30329
30487
|
referenceGender,
|
|
30488
|
+
checkCategory,
|
|
30330
30489
|
checkGender,
|
|
30331
30490
|
event
|
|
30332
30491
|
});
|
|
30333
|
-
if (
|
|
30334
|
-
return decorateResult({ result:
|
|
30492
|
+
if (validationResult.error) {
|
|
30493
|
+
return decorateResult({ result: validationResult, stack });
|
|
30335
30494
|
}
|
|
30336
30495
|
let result = !matchUp?.tieFormat ? getTieFormat$1({
|
|
30337
30496
|
drawDefinition,
|
|
@@ -36990,6 +37149,8 @@ const POLICY_MATCHUP_ACTIONS_DEFAULT = {
|
|
|
36990
37149
|
}
|
|
36991
37150
|
],
|
|
36992
37151
|
participants: {
|
|
37152
|
+
enforceCategory: true,
|
|
37153
|
+
// validate collectionDefinition.category against event.category
|
|
36993
37154
|
enforceGender: true
|
|
36994
37155
|
// disallow placing FEMALEs in MALE events and vice versa
|
|
36995
37156
|
},
|
|
@@ -39230,7 +39391,7 @@ function competitionEngineAsync(test) {
|
|
|
39230
39391
|
}
|
|
39231
39392
|
|
|
39232
39393
|
function addVoluntaryConsolationStructure$1({
|
|
39233
|
-
structureName = VOLUNTARY_CONSOLATION,
|
|
39394
|
+
structureName = constantToString(VOLUNTARY_CONSOLATION),
|
|
39234
39395
|
structureAbbreviation,
|
|
39235
39396
|
drawDefinition,
|
|
39236
39397
|
matchUpType,
|
|
@@ -39458,7 +39619,9 @@ function generateQualifyingStructures({
|
|
|
39458
39619
|
}
|
|
39459
39620
|
const roundTargetName = qualifyingProfiles.length > 1 ? `${roundTarget}-` : "";
|
|
39460
39621
|
const stageSequenceName = structureProfiles.length > 1 || roundTargetName ? stageSequence : "";
|
|
39461
|
-
const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${
|
|
39622
|
+
const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${constantToString(
|
|
39623
|
+
QUALIFYING
|
|
39624
|
+
)} ${roundTargetName}${stageSequenceName}` : constantToString(QUALIFYING));
|
|
39462
39625
|
if (drawType === ROUND_ROBIN) {
|
|
39463
39626
|
const {
|
|
39464
39627
|
structures: structures2,
|
|
@@ -40104,6 +40267,7 @@ function roundMatchCounts({ drawSize }) {
|
|
|
40104
40267
|
function firstRoundLoserConsolation(params) {
|
|
40105
40268
|
const {
|
|
40106
40269
|
finishingPositionOffset = 0,
|
|
40270
|
+
playoffAttributes,
|
|
40107
40271
|
stageSequence = 1,
|
|
40108
40272
|
staggeredEntry,
|
|
40109
40273
|
structureName,
|
|
@@ -40125,7 +40289,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
40125
40289
|
};
|
|
40126
40290
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
40127
40291
|
const mainStructure = structureTemplate({
|
|
40128
|
-
structureName: structureName || constantToString(MAIN),
|
|
40292
|
+
structureName: structureName || playoffAttributes?.["0"]?.name || constantToString(MAIN),
|
|
40129
40293
|
structureId: structureId || uuids?.pop(),
|
|
40130
40294
|
stageSequence,
|
|
40131
40295
|
matchUpType,
|
|
@@ -40144,7 +40308,7 @@ function firstRoundLoserConsolation(params) {
|
|
|
40144
40308
|
isMock
|
|
40145
40309
|
});
|
|
40146
40310
|
const consolation = constantToString(CONSOLATION);
|
|
40147
|
-
const consolationStructureName = params.consolationStructureName
|
|
40311
|
+
const consolationStructureName = playoffAttributes?.["0-1"]?.name ?? params.consolationStructureName ?? (structureName ? `${structureName} ${consolation}` : consolation);
|
|
40148
40312
|
const consolationStructure = structureTemplate({
|
|
40149
40313
|
structureName: consolationStructureName,
|
|
40150
40314
|
matchUps: consolationMatchUps,
|
|
@@ -40222,10 +40386,10 @@ function feedInLinks({
|
|
|
40222
40386
|
|
|
40223
40387
|
function generateCurtisConsolation(params) {
|
|
40224
40388
|
const {
|
|
40225
|
-
structureName = constantToString(MAIN),
|
|
40226
40389
|
playoffStructureNameBase,
|
|
40227
40390
|
finishingPositionOffset,
|
|
40228
40391
|
stageSequence = 1,
|
|
40392
|
+
playoffAttributes,
|
|
40229
40393
|
structureNameMap,
|
|
40230
40394
|
staggeredEntry,
|
|
40231
40395
|
stage = MAIN,
|
|
@@ -40245,6 +40409,7 @@ function generateCurtisConsolation(params) {
|
|
|
40245
40409
|
uuids
|
|
40246
40410
|
};
|
|
40247
40411
|
const { matchUps, roundsCount: mainDrawRoundsCount } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
40412
|
+
const structureName = params.structureName ?? playoffAttributes?.["0"]?.name ?? constantToString(MAIN);
|
|
40248
40413
|
const mainStructure = structureTemplate({
|
|
40249
40414
|
structureId: structureId || uuids?.pop(),
|
|
40250
40415
|
structureName,
|
|
@@ -40263,6 +40428,7 @@ function generateCurtisConsolation(params) {
|
|
|
40263
40428
|
idPrefix: idPrefix && `${idPrefix}-c${index}`,
|
|
40264
40429
|
structureId: uuids?.pop(),
|
|
40265
40430
|
playoffStructureNameBase,
|
|
40431
|
+
playoffAttributes,
|
|
40266
40432
|
structureNameMap,
|
|
40267
40433
|
stageSequence: stageSequence2,
|
|
40268
40434
|
roundOffset,
|
|
@@ -40291,7 +40457,7 @@ function generateCurtisConsolation(params) {
|
|
|
40291
40457
|
matchUpType,
|
|
40292
40458
|
isMock
|
|
40293
40459
|
});
|
|
40294
|
-
const defaultName = constantToString(PLAY_OFF);
|
|
40460
|
+
const defaultName = playoffAttributes?.["3-4"]?.name ?? constantToString(PLAY_OFF);
|
|
40295
40461
|
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
40296
40462
|
const structureName2 = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
40297
40463
|
const playoffStructure = structureTemplate({
|
|
@@ -40323,6 +40489,7 @@ function generateCurtisConsolation(params) {
|
|
|
40323
40489
|
function consolationFeedStructure({
|
|
40324
40490
|
playoffStructureNameBase,
|
|
40325
40491
|
stageSequence = 1,
|
|
40492
|
+
playoffAttributes,
|
|
40326
40493
|
structureNameMap,
|
|
40327
40494
|
roundOffset = 0,
|
|
40328
40495
|
matchUpType,
|
|
@@ -40344,7 +40511,8 @@ function consolationFeedStructure({
|
|
|
40344
40511
|
isMock,
|
|
40345
40512
|
uuids
|
|
40346
40513
|
});
|
|
40347
|
-
const
|
|
40514
|
+
const indexedStructureName = index === 0 && playoffAttributes?.["0-1"]?.name || index === 1 && playoffAttributes?.["0-3"]?.name;
|
|
40515
|
+
const defaultName = indexedStructureName || `${constantToString(CONSOLATION)} ${index + 1}`;
|
|
40348
40516
|
const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
|
|
40349
40517
|
const structureName = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
|
|
40350
40518
|
const consolationStructure = structureTemplate({
|
|
@@ -40394,8 +40562,8 @@ function generatePlayoffStructures(params) {
|
|
|
40394
40562
|
const finishingPositionRange = `${finishingPositionsFrom}-${finishingPositionsTo}`;
|
|
40395
40563
|
const attributeProfile = playoffAttributes?.[exitProfile];
|
|
40396
40564
|
const base = playoffStructureNameBase && `${playoffStructureNameBase} ` || "";
|
|
40397
|
-
const customNaming = finishingPositionNaming?.[finishingPositionRange];
|
|
40398
|
-
const structureName = customNaming?.name || attributeProfile?.name && (addNameBaseToAttributeName ? `${base}${attributeProfile?.name}` : attributeProfile.name) || `${base}${finishingPositionRange}`;
|
|
40565
|
+
const customNaming = playoffAttributes?.[finishingPositionRange] ?? finishingPositionNaming?.[finishingPositionRange];
|
|
40566
|
+
const structureName = params.structureName || customNaming?.name || attributeProfile?.name && (addNameBaseToAttributeName ? `${base}${attributeProfile?.name}` : attributeProfile.name) || `${base}${finishingPositionRange}`;
|
|
40399
40567
|
const structureAbbreviation = customNaming?.abbreviation || attributeProfile?.abbreviation;
|
|
40400
40568
|
const mainParams = {
|
|
40401
40569
|
idPrefix: idPrefix && `${idPrefix}-${structureName}-RP`,
|
|
@@ -40499,6 +40667,7 @@ function feedInChampionship(params) {
|
|
|
40499
40667
|
const {
|
|
40500
40668
|
finishingPositionOffset,
|
|
40501
40669
|
stageSequence = 1,
|
|
40670
|
+
playoffAttributes,
|
|
40502
40671
|
policyDefinitions,
|
|
40503
40672
|
feedsFromFinal,
|
|
40504
40673
|
staggeredEntry,
|
|
@@ -40526,7 +40695,7 @@ function feedInChampionship(params) {
|
|
|
40526
40695
|
};
|
|
40527
40696
|
const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
|
|
40528
40697
|
const mainStructure = structureTemplate({
|
|
40529
|
-
structureName: structureName || constantToString(MAIN),
|
|
40698
|
+
structureName: structureName || playoffAttributes?.["0"]?.name || constantToString(MAIN),
|
|
40530
40699
|
structureId: structureId || uuids?.pop(),
|
|
40531
40700
|
stageSequence,
|
|
40532
40701
|
matchUpType,
|
|
@@ -40550,12 +40719,14 @@ function feedInChampionship(params) {
|
|
|
40550
40719
|
fmlc
|
|
40551
40720
|
});
|
|
40552
40721
|
if (drawSize > 2) {
|
|
40722
|
+
const name = playoffAttributes?.["0-1"]?.name ?? constantToString(CONSOLATION);
|
|
40723
|
+
const structureName2 = params.playoffStructureNameBase ? `${params.playoffStructureNameBase} ${name}` : name;
|
|
40553
40724
|
const consolationStructure = structureTemplate({
|
|
40554
|
-
structureName: constantToString(CONSOLATION),
|
|
40555
40725
|
matchUps: consolationMatchUps,
|
|
40556
40726
|
structureId: uuids?.pop(),
|
|
40557
40727
|
stage: CONSOLATION,
|
|
40558
40728
|
stageSequence: 1,
|
|
40729
|
+
structureName: structureName2,
|
|
40559
40730
|
matchUpType
|
|
40560
40731
|
});
|
|
40561
40732
|
structures.push(consolationStructure);
|
|
@@ -40576,10 +40747,9 @@ function feedInChampionship(params) {
|
|
|
40576
40747
|
}
|
|
40577
40748
|
|
|
40578
40749
|
function processPlayoffGroups({
|
|
40579
|
-
compassAttributes = COMPASS_ATTRIBUTES,
|
|
40580
|
-
olympicAttributes = OLYMPIC_ATTRIBUTES,
|
|
40581
40750
|
requireSequential = true,
|
|
40582
40751
|
playoffMatchUpFormat,
|
|
40752
|
+
playoffAttributes,
|
|
40583
40753
|
sourceStructureId,
|
|
40584
40754
|
policyDefinitions,
|
|
40585
40755
|
stageSequence,
|
|
@@ -40628,6 +40798,8 @@ function processPlayoffGroups({
|
|
|
40628
40798
|
if (positionsPlayedOff) {
|
|
40629
40799
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
40630
40800
|
}
|
|
40801
|
+
const finishingPositionRange = positionsPlayedOff && `${Math.min(...positionsPlayedOff)}-${Math.max(...positionsPlayedOff)}`;
|
|
40802
|
+
const structureName = playoffGroup.structureName || finishingPositionRange && playoffGroup.playoffAttributes?.[finishingPositionRange]?.name || playoffGroup.playoffAttributes?.["0"]?.name;
|
|
40631
40803
|
const playoffGroupParams = {
|
|
40632
40804
|
addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
|
|
40633
40805
|
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
@@ -40636,8 +40808,8 @@ function processPlayoffGroups({
|
|
|
40636
40808
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40637
40809
|
playoffAttributes: playoffGroup.playoffAttributes,
|
|
40638
40810
|
structureNameMap: playoffGroup.structureNameMap,
|
|
40639
|
-
|
|
40640
|
-
|
|
40811
|
+
sequenceLimit: playoffGroup.sequenceLimit,
|
|
40812
|
+
structureName
|
|
40641
40813
|
};
|
|
40642
40814
|
const params = {
|
|
40643
40815
|
...playoffGroupParams,
|
|
@@ -40679,9 +40851,9 @@ function processPlayoffGroups({
|
|
|
40679
40851
|
});
|
|
40680
40852
|
const playoffStructure = structureTemplate({
|
|
40681
40853
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40682
|
-
structureName: playoffGroup.structureName,
|
|
40683
40854
|
matchUpFormat: playoffMatchUpFormat,
|
|
40684
40855
|
stage: PLAY_OFF,
|
|
40856
|
+
structureName,
|
|
40685
40857
|
stageSequence,
|
|
40686
40858
|
matchUps
|
|
40687
40859
|
});
|
|
@@ -40698,10 +40870,11 @@ function processPlayoffGroups({
|
|
|
40698
40870
|
finishingPositions
|
|
40699
40871
|
});
|
|
40700
40872
|
} else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
40701
|
-
const { structureName } = playoffGroup;
|
|
40702
40873
|
const params2 = {
|
|
40874
|
+
playoffAttributes: playoffGroup.playoffAttributes ?? playoffAttributes,
|
|
40875
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
40703
40876
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40704
|
-
|
|
40877
|
+
structureName: playoffGroup.structureName,
|
|
40705
40878
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
40706
40879
|
addNameBaseToAttributeName: true,
|
|
40707
40880
|
finishingPositionOffset,
|
|
@@ -40714,12 +40887,12 @@ function processPlayoffGroups({
|
|
|
40714
40887
|
};
|
|
40715
40888
|
if (playoffDrawType === COMPASS) {
|
|
40716
40889
|
Object.assign(params2, {
|
|
40717
|
-
playoffAttributes:
|
|
40890
|
+
playoffAttributes: playoffGroup?.playoffAttributes ?? playoffAttributes ?? COMPASS_ATTRIBUTES,
|
|
40718
40891
|
roundOffsetLimit: 3
|
|
40719
40892
|
});
|
|
40720
40893
|
} else if (playoffDrawType === OLYMPIC) {
|
|
40721
40894
|
Object.assign(params2, {
|
|
40722
|
-
playoffAttributes:
|
|
40895
|
+
playoffAttributes: playoffGroup?.playoffAttributes ?? playoffAttributes ?? OLYMPIC_ATTRIBUTES,
|
|
40723
40896
|
roundOffsetLimit: 2
|
|
40724
40897
|
});
|
|
40725
40898
|
}
|
|
@@ -40754,12 +40927,14 @@ function processPlayoffGroups({
|
|
|
40754
40927
|
].includes(playoffDrawType)) {
|
|
40755
40928
|
const uuidsFMLC = [uuids?.pop(), uuids?.pop()];
|
|
40756
40929
|
const params2 = {
|
|
40930
|
+
playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
|
|
40757
40931
|
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
40758
|
-
|
|
40932
|
+
playoffAttributes: playoffGroup.playoffAttributes,
|
|
40759
40933
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
40760
40934
|
finishingPositionOffset,
|
|
40761
40935
|
uuids: uuidsFMLC,
|
|
40762
40936
|
stage: PLAY_OFF,
|
|
40937
|
+
structureName,
|
|
40763
40938
|
matchUpType,
|
|
40764
40939
|
feedPolicy,
|
|
40765
40940
|
drawSize,
|
|
@@ -40845,7 +41020,7 @@ function generateRoundRobinWithPlayOff(params) {
|
|
|
40845
41020
|
};
|
|
40846
41021
|
const { structures, groupCount, groupSize } = generateRoundRobin(mainDrawProperties);
|
|
40847
41022
|
if (groupCount < 1) {
|
|
40848
|
-
|
|
41023
|
+
return { error: INVALID_CONFIGURATION };
|
|
40849
41024
|
}
|
|
40850
41025
|
const playoffGroups = structureOptions?.playoffGroups || [
|
|
40851
41026
|
{ finishingPositions: [1], structureName: constantToString(PLAY_OFF) }
|
|
@@ -41111,10 +41286,8 @@ function luckyRoundProfiles(drawSize) {
|
|
|
41111
41286
|
|
|
41112
41287
|
function getGenerators(params) {
|
|
41113
41288
|
const {
|
|
41114
|
-
|
|
41115
|
-
olympicAttributes = OLYMPIC_ATTRIBUTES,
|
|
41289
|
+
playoffAttributes,
|
|
41116
41290
|
stageSequence = 1,
|
|
41117
|
-
structureName,
|
|
41118
41291
|
structureId,
|
|
41119
41292
|
stage = MAIN,
|
|
41120
41293
|
matchUpType,
|
|
@@ -41124,13 +41297,13 @@ function getGenerators(params) {
|
|
|
41124
41297
|
const { appliedPolicies } = getAppliedPolicies(params);
|
|
41125
41298
|
const feedPolicy = params.policyDefinitions?.[POLICY_TYPE_FEED_IN] || appliedPolicies?.[POLICY_TYPE_FEED_IN];
|
|
41126
41299
|
params.skipRounds = params.skipRounds || drawSize <= 4 && (feedPolicy?.feedMainFinal ? 0 : 1) || 0;
|
|
41127
|
-
const
|
|
41300
|
+
const structureName = params.structureName ?? playoffAttributes?.["0"]?.name ?? constantToString(MAIN);
|
|
41128
41301
|
const singleElimination = () => {
|
|
41129
41302
|
const { matchUps } = treeMatchUps(params);
|
|
41130
41303
|
const structure = structureTemplate({
|
|
41131
41304
|
structureId: structureId || uuids?.pop(),
|
|
41132
|
-
structureName: structureName || main,
|
|
41133
41305
|
stageSequence,
|
|
41306
|
+
structureName,
|
|
41134
41307
|
matchUpType,
|
|
41135
41308
|
matchUps,
|
|
41136
41309
|
stage
|
|
@@ -41141,9 +41314,9 @@ function getGenerators(params) {
|
|
|
41141
41314
|
[AD_HOC]: () => {
|
|
41142
41315
|
const structure = structureTemplate({
|
|
41143
41316
|
structureId: structureId || uuids?.pop(),
|
|
41144
|
-
structureName: structureName || main,
|
|
41145
41317
|
finishingPosition: WIN_RATIO,
|
|
41146
41318
|
stageSequence,
|
|
41319
|
+
structureName,
|
|
41147
41320
|
matchUps: [],
|
|
41148
41321
|
matchUpType,
|
|
41149
41322
|
stage
|
|
@@ -41154,8 +41327,8 @@ function getGenerators(params) {
|
|
|
41154
41327
|
const { matchUps } = luckyDraw(params);
|
|
41155
41328
|
const structure = structureTemplate({
|
|
41156
41329
|
structureId: structureId || uuids?.pop(),
|
|
41157
|
-
structureName: structureName || main,
|
|
41158
41330
|
stageSequence,
|
|
41331
|
+
structureName,
|
|
41159
41332
|
matchUpType,
|
|
41160
41333
|
matchUps,
|
|
41161
41334
|
stage
|
|
@@ -41167,12 +41340,12 @@ function getGenerators(params) {
|
|
|
41167
41340
|
[COMPASS]: () => generatePlayoffStructures({
|
|
41168
41341
|
...params,
|
|
41169
41342
|
roundOffsetLimit: 3,
|
|
41170
|
-
playoffAttributes:
|
|
41343
|
+
playoffAttributes: playoffAttributes ?? COMPASS_ATTRIBUTES
|
|
41171
41344
|
}),
|
|
41172
41345
|
[OLYMPIC]: () => generatePlayoffStructures({
|
|
41173
41346
|
...params,
|
|
41174
41347
|
roundOffsetLimit: 2,
|
|
41175
|
-
playoffAttributes:
|
|
41348
|
+
playoffAttributes: playoffAttributes ?? OLYMPIC_ATTRIBUTES
|
|
41176
41349
|
}),
|
|
41177
41350
|
[PLAY_OFF]: () => {
|
|
41178
41351
|
return generatePlayoffStructures(params);
|
|
@@ -41181,8 +41354,8 @@ function getGenerators(params) {
|
|
|
41181
41354
|
const { matchUps } = feedInMatchUps({ drawSize, uuids, matchUpType });
|
|
41182
41355
|
const structure = structureTemplate({
|
|
41183
41356
|
structureId: structureId || uuids?.pop(),
|
|
41184
|
-
structureName: structureName || main,
|
|
41185
41357
|
stageSequence,
|
|
41358
|
+
structureName,
|
|
41186
41359
|
matchUpType,
|
|
41187
41360
|
stage: MAIN,
|
|
41188
41361
|
matchUps
|
|
@@ -44221,7 +44394,7 @@ function generateQualifyingStructure$1(params) {
|
|
|
44221
44394
|
}
|
|
44222
44395
|
const roundTargetName = roundTarget ? `${roundTarget}-` : "";
|
|
44223
44396
|
const stageSequenceName = `${stageSequence}`;
|
|
44224
|
-
const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${QUALIFYING} ${roundTargetName}${stageSequenceName}` : QUALIFYING);
|
|
44397
|
+
const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${constantToString(QUALIFYING)} ${roundTargetName}${stageSequenceName}` : constantToString(QUALIFYING));
|
|
44225
44398
|
if (drawType === ROUND_ROBIN) {
|
|
44226
44399
|
const { maxRoundNumber, structures, groupCount } = generateRoundRobin({
|
|
44227
44400
|
structureName: structureName || qualifyingStructureName,
|
|
@@ -58232,8 +58405,8 @@ function prepareStage(params) {
|
|
|
58232
58405
|
});
|
|
58233
58406
|
if (!scaledEntries?.length && seedByRanking) {
|
|
58234
58407
|
const rankingScaleAttributes = {
|
|
58235
|
-
scaleType: RANKING$1,
|
|
58236
58408
|
scaleName: categoryName || ageCategoryCode,
|
|
58409
|
+
scaleType: RANKING$1,
|
|
58237
58410
|
eventType
|
|
58238
58411
|
};
|
|
58239
58412
|
({ scaledEntries } = getScaledEntries({
|
|
@@ -61256,7 +61429,7 @@ function generatePersons(params) {
|
|
|
61256
61429
|
shuffledPersons.push(person);
|
|
61257
61430
|
});
|
|
61258
61431
|
}
|
|
61259
|
-
const { ageMinDate, ageMaxDate } =
|
|
61432
|
+
const { ageMinDate, ageMaxDate } = getCategoryAgeDetails({
|
|
61260
61433
|
consideredDate,
|
|
61261
61434
|
category
|
|
61262
61435
|
});
|
|
@@ -64117,7 +64290,8 @@ const utilities = {
|
|
|
64117
64290
|
nextPowerOf2,
|
|
64118
64291
|
numericSort,
|
|
64119
64292
|
overlap,
|
|
64120
|
-
|
|
64293
|
+
getCategoryAgeDetails,
|
|
64294
|
+
categoryCanContain,
|
|
64121
64295
|
randomMember,
|
|
64122
64296
|
randomPop,
|
|
64123
64297
|
shuffleArray,
|