tods-competition-factory 1.8.43 → 1.8.45
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 +47 -23
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +12 -11
- package/dist/forge/query.mjs +3 -3
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +32 -21
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +134 -98
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +163 -145
- 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
|
@@ -2404,7 +2404,7 @@ const matchUpFormatCode = {
|
|
|
2404
2404
|
};
|
|
2405
2405
|
|
|
2406
2406
|
function factoryVersion() {
|
|
2407
|
-
return "1.8.
|
|
2407
|
+
return "1.8.45";
|
|
2408
2408
|
}
|
|
2409
2409
|
|
|
2410
2410
|
function getObjectTieFormat(obj) {
|
|
@@ -2467,6 +2467,57 @@ function resolveTieFormat({
|
|
|
2467
2467
|
};
|
|
2468
2468
|
}
|
|
2469
2469
|
|
|
2470
|
+
function decorateResult({
|
|
2471
|
+
context,
|
|
2472
|
+
result,
|
|
2473
|
+
stack,
|
|
2474
|
+
info
|
|
2475
|
+
}) {
|
|
2476
|
+
if (result && !Array.isArray(result?.stack))
|
|
2477
|
+
result.stack = [];
|
|
2478
|
+
if (result && Array.isArray(result?.stack) && typeof stack === "string") {
|
|
2479
|
+
result.stack.push(stack);
|
|
2480
|
+
}
|
|
2481
|
+
if (result && info) {
|
|
2482
|
+
result.info = info;
|
|
2483
|
+
}
|
|
2484
|
+
if (result && typeof context === "object" && Object.keys(context).length) {
|
|
2485
|
+
Object.assign(result, definedAttributes(context));
|
|
2486
|
+
}
|
|
2487
|
+
if (result && !result?.error && !result?.success) {
|
|
2488
|
+
Object.assign(result, { ...SUCCESS });
|
|
2489
|
+
}
|
|
2490
|
+
return result ?? { success: true };
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
const ANY = "ANY";
|
|
2494
|
+
const MALE = "MALE";
|
|
2495
|
+
const MIXED = "MIXED";
|
|
2496
|
+
const OTHER$3 = "OTHER";
|
|
2497
|
+
const FEMALE = "FEMALE";
|
|
2498
|
+
const genderConstants = {
|
|
2499
|
+
ANY,
|
|
2500
|
+
MALE,
|
|
2501
|
+
FEMALE,
|
|
2502
|
+
MIXED,
|
|
2503
|
+
OTHER: OTHER$3
|
|
2504
|
+
};
|
|
2505
|
+
|
|
2506
|
+
const SINGLES_MATCHUP = "SINGLES";
|
|
2507
|
+
const SINGLES$1 = "SINGLES";
|
|
2508
|
+
const DOUBLES_MATCHUP = "DOUBLES";
|
|
2509
|
+
const DOUBLES$1 = "DOUBLES";
|
|
2510
|
+
const TEAM_MATCHUP = "TEAM";
|
|
2511
|
+
const TEAM$2 = "TEAM";
|
|
2512
|
+
const matchUpTypes = {
|
|
2513
|
+
SINGLES_MATCHUP,
|
|
2514
|
+
SINGLES: SINGLES$1,
|
|
2515
|
+
DOUBLES_MATCHUP,
|
|
2516
|
+
DOUBLES: DOUBLES$1,
|
|
2517
|
+
TEAM_MATCHUP,
|
|
2518
|
+
TEAM: TEAM$2
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2470
2521
|
var DrawTypeEnum = /* @__PURE__ */ ((DrawTypeEnum2) => {
|
|
2471
2522
|
DrawTypeEnum2["AdHoc"] = "AD_HOC";
|
|
2472
2523
|
DrawTypeEnum2["Compass"] = "COMPASS";
|
|
@@ -2581,60 +2632,29 @@ var ParticipantTypeEnum = /* @__PURE__ */ ((ParticipantTypeEnum2) => {
|
|
|
2581
2632
|
return ParticipantTypeEnum2;
|
|
2582
2633
|
})(ParticipantTypeEnum || {});
|
|
2583
2634
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
stack
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
result.stack = [];
|
|
2592
|
-
if (result && Array.isArray(result?.stack) && typeof stack === "string") {
|
|
2593
|
-
result.stack.push(stack);
|
|
2594
|
-
}
|
|
2595
|
-
if (result && info) {
|
|
2596
|
-
result.info = info;
|
|
2597
|
-
}
|
|
2598
|
-
if (result && typeof context === "object" && Object.keys(context).length) {
|
|
2599
|
-
Object.assign(result, definedAttributes(context));
|
|
2600
|
-
}
|
|
2601
|
-
if (result && !result?.error && !result?.success) {
|
|
2602
|
-
Object.assign(result, { ...SUCCESS });
|
|
2603
|
-
}
|
|
2604
|
-
return result ?? { success: true };
|
|
2605
|
-
}
|
|
2606
|
-
|
|
2607
|
-
const ANY = "ANY";
|
|
2608
|
-
const MALE = "MALE";
|
|
2609
|
-
const MIXED = "MIXED";
|
|
2610
|
-
const OTHER$3 = "OTHER";
|
|
2611
|
-
const FEMALE = "FEMALE";
|
|
2612
|
-
const genderConstants = {
|
|
2613
|
-
ANY,
|
|
2614
|
-
MALE,
|
|
2615
|
-
FEMALE,
|
|
2616
|
-
MIXED,
|
|
2617
|
-
OTHER: OTHER$3
|
|
2618
|
-
};
|
|
2619
|
-
|
|
2620
|
-
function genderValidityCheck({
|
|
2621
|
-
referenceGender,
|
|
2622
|
-
matchUpType,
|
|
2623
|
-
gender
|
|
2624
|
-
}) {
|
|
2625
|
-
const stack = "genderValidityCheck";
|
|
2626
|
-
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender)) {
|
|
2627
|
-
const valid = gender === referenceGender;
|
|
2628
|
-
return valid ? { valid: true } : decorateResult({
|
|
2635
|
+
const mixedGenderError = "MIXED events can not contain mixed singles or { gender: ANY } collections";
|
|
2636
|
+
const anyMixedError = "events with { gender: ANY } can not contain MIXED singles collections";
|
|
2637
|
+
function tieFormatGenderValidityCheck(params) {
|
|
2638
|
+
const stack = "tieFormatGenderValidityCheck";
|
|
2639
|
+
const { referenceGender, matchUpType, gender } = params;
|
|
2640
|
+
if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender)
|
|
2641
|
+
return decorateResult({
|
|
2629
2642
|
result: { valid: false, error: INVALID_GENDER },
|
|
2630
2643
|
context: { gender },
|
|
2631
2644
|
stack
|
|
2632
2645
|
});
|
|
2646
|
+
const eventType = params.eventType ?? params.referenceEvent?.eventType;
|
|
2647
|
+
if (referenceGender === MIXED && (eventType !== TEAM$2 || gender === ANY || gender === MIXED && matchUpType !== TypeEnum.Doubles)) {
|
|
2648
|
+
return decorateResult({
|
|
2649
|
+
result: { error: INVALID_GENDER, valid: false },
|
|
2650
|
+
info: mixedGenderError,
|
|
2651
|
+
stack
|
|
2652
|
+
});
|
|
2633
2653
|
}
|
|
2634
|
-
if (referenceGender ===
|
|
2654
|
+
if (referenceGender === ANY && gender === MIXED && matchUpType !== TypeEnum.Doubles)
|
|
2635
2655
|
return decorateResult({
|
|
2636
|
-
info: "MIXED events can only contain MIXED doubles collections",
|
|
2637
2656
|
result: { error: INVALID_GENDER, valid: false },
|
|
2657
|
+
info: anyMixedError,
|
|
2638
2658
|
stack
|
|
2639
2659
|
});
|
|
2640
2660
|
return { valid: true };
|
|
@@ -2876,6 +2896,7 @@ function validateTieFormat(params) {
|
|
|
2876
2896
|
const checkGender = !!(params?.enforceGender !== false && params?.gender);
|
|
2877
2897
|
const checkCollectionIds = params?.checkCollectionIds;
|
|
2878
2898
|
const tieFormat = params?.tieFormat;
|
|
2899
|
+
const event = params?.event;
|
|
2879
2900
|
const stack = "validateTieFormat";
|
|
2880
2901
|
const errors = [];
|
|
2881
2902
|
if (!params || !tieFormat || typeof tieFormat !== "object") {
|
|
@@ -2911,10 +2932,12 @@ function validateTieFormat(params) {
|
|
|
2911
2932
|
const { valid: valid2, errors: collectionDefinitionErrors } = validateCollectionDefinition({
|
|
2912
2933
|
referenceCategory: params.category,
|
|
2913
2934
|
referenceGender: params.gender,
|
|
2935
|
+
eventType: params.eventType,
|
|
2914
2936
|
collectionDefinition,
|
|
2915
2937
|
checkCollectionIds,
|
|
2916
2938
|
checkCategory,
|
|
2917
|
-
checkGender
|
|
2939
|
+
checkGender,
|
|
2940
|
+
event
|
|
2918
2941
|
});
|
|
2919
2942
|
if (valid2) {
|
|
2920
2943
|
return true;
|
|
@@ -2961,6 +2984,7 @@ function validateCollectionDefinition({
|
|
|
2961
2984
|
checkGender = true,
|
|
2962
2985
|
referenceCategory,
|
|
2963
2986
|
referenceGender,
|
|
2987
|
+
eventType,
|
|
2964
2988
|
event
|
|
2965
2989
|
}) {
|
|
2966
2990
|
referenceGender = referenceGender ?? event?.gender;
|
|
@@ -3027,7 +3051,8 @@ function validateCollectionDefinition({
|
|
|
3027
3051
|
errors.push(`Invalid matchUpFormat: ${matchUpFormat}`);
|
|
3028
3052
|
}
|
|
3029
3053
|
if (checkGender) {
|
|
3030
|
-
const result =
|
|
3054
|
+
const result = tieFormatGenderValidityCheck({
|
|
3055
|
+
eventType: eventType ?? event?.eventType,
|
|
3031
3056
|
referenceGender,
|
|
3032
3057
|
matchUpType,
|
|
3033
3058
|
gender
|
|
@@ -3059,8 +3084,15 @@ function validateCollectionDefinition({
|
|
|
3059
3084
|
});
|
|
3060
3085
|
return { valid: true };
|
|
3061
3086
|
}
|
|
3062
|
-
function checkTieFormat(
|
|
3063
|
-
|
|
3087
|
+
function checkTieFormat({
|
|
3088
|
+
tieFormat,
|
|
3089
|
+
eventType
|
|
3090
|
+
}) {
|
|
3091
|
+
const result = validateTieFormat({
|
|
3092
|
+
checkCollectionIds: false,
|
|
3093
|
+
eventType,
|
|
3094
|
+
tieFormat
|
|
3095
|
+
});
|
|
3064
3096
|
if (result.error)
|
|
3065
3097
|
return result;
|
|
3066
3098
|
for (const collectionDefinition of tieFormat.collectionDefinitions) {
|
|
@@ -3471,21 +3503,6 @@ function calculatePercentages({
|
|
|
3471
3503
|
});
|
|
3472
3504
|
}
|
|
3473
3505
|
|
|
3474
|
-
const SINGLES_MATCHUP = "SINGLES";
|
|
3475
|
-
const SINGLES$1 = "SINGLES";
|
|
3476
|
-
const DOUBLES_MATCHUP = "DOUBLES";
|
|
3477
|
-
const DOUBLES$1 = "DOUBLES";
|
|
3478
|
-
const TEAM_MATCHUP = "TEAM";
|
|
3479
|
-
const TEAM$2 = "TEAM";
|
|
3480
|
-
const matchUpTypes = {
|
|
3481
|
-
SINGLES_MATCHUP,
|
|
3482
|
-
SINGLES: SINGLES$1,
|
|
3483
|
-
DOUBLES_MATCHUP,
|
|
3484
|
-
DOUBLES: DOUBLES$1,
|
|
3485
|
-
TEAM_MATCHUP,
|
|
3486
|
-
TEAM: TEAM$2
|
|
3487
|
-
};
|
|
3488
|
-
|
|
3489
3506
|
function getParticipantResults({
|
|
3490
3507
|
participantIds,
|
|
3491
3508
|
matchUpFormat,
|
|
@@ -8739,7 +8756,7 @@ function generateTieMatchUpScore(params) {
|
|
|
8739
8756
|
const tieFormat = resolveTieFormat({ matchUp, drawDefinition, structure, event })?.tieFormat || params?.tieFormat;
|
|
8740
8757
|
if (!tieFormat)
|
|
8741
8758
|
return { error: MISSING_TIE_FORMAT };
|
|
8742
|
-
const result = validateTieFormat({ tieFormat });
|
|
8759
|
+
const result = validateTieFormat({ tieFormat, eventType: event?.eventType });
|
|
8743
8760
|
if (result.error)
|
|
8744
8761
|
return result;
|
|
8745
8762
|
const collectionDefinitions = tieFormat?.collectionDefinitions || [];
|
|
@@ -21030,7 +21047,7 @@ function allPlayoffPositionsFilled(params) {
|
|
|
21030
21047
|
if (!playoffStructures?.length)
|
|
21031
21048
|
return false;
|
|
21032
21049
|
const enteredParticipantsCount = drawDefinition?.entries?.filter(
|
|
21033
|
-
(entry) => STRUCTURE_SELECTED_STATUSES.includes(entry
|
|
21050
|
+
(entry) => entry?.entryStatus && STRUCTURE_SELECTED_STATUSES.includes(entry.entryStatus)
|
|
21034
21051
|
)?.length || 0;
|
|
21035
21052
|
let participantIdsCount = 0;
|
|
21036
21053
|
const allPositionsFilled = (playoffStructures || []).reduce(
|
|
@@ -22443,9 +22460,9 @@ function getSeedsCount(params) {
|
|
|
22443
22460
|
}
|
|
22444
22461
|
}
|
|
22445
22462
|
const consideredParticipantCount = requireParticipantCount && participantsCount || drawSize;
|
|
22446
|
-
if (consideredParticipantCount > drawSize)
|
|
22463
|
+
if (consideredParticipantCount && consideredParticipantCount > drawSize)
|
|
22447
22464
|
return { error: PARTICIPANT_COUNT_EXCEEDS_DRAW_SIZE };
|
|
22448
|
-
const policy = policyDefinitions[POLICY_TYPE_SEEDING];
|
|
22465
|
+
const policy = policyDefinitions?.[POLICY_TYPE_SEEDING];
|
|
22449
22466
|
if (!policy)
|
|
22450
22467
|
return { error: INVALID_POLICY_DEFINITION };
|
|
22451
22468
|
const seedsCountThresholds = policy.seedsCountThresholds;
|
|
@@ -22457,7 +22474,7 @@ function getSeedsCount(params) {
|
|
|
22457
22474
|
return drawSizeProgression ? threshold.drawSize <= drawSize : drawSize === threshold.drawSize;
|
|
22458
22475
|
});
|
|
22459
22476
|
const seedsCount = relevantThresholds.reduce((seedsCount2, threshold) => {
|
|
22460
|
-
return participantsCount >= threshold.minimumParticipantCount ? threshold.seedsCount : seedsCount2;
|
|
22477
|
+
return participantsCount && participantsCount >= threshold.minimumParticipantCount ? threshold.seedsCount : seedsCount2;
|
|
22461
22478
|
}, 0);
|
|
22462
22479
|
return { seedsCount };
|
|
22463
22480
|
}
|
|
@@ -33307,7 +33324,10 @@ function modifyCollectionDefinition$1({
|
|
|
33307
33324
|
modifications.push({ collectionId, gender });
|
|
33308
33325
|
}
|
|
33309
33326
|
const modifiedTieFormat = definedAttributes(tieFormat);
|
|
33310
|
-
result = validateTieFormat({
|
|
33327
|
+
result = validateTieFormat({
|
|
33328
|
+
tieFormat: modifiedTieFormat,
|
|
33329
|
+
eventType: event?.eventType
|
|
33330
|
+
});
|
|
33311
33331
|
if (result.error) {
|
|
33312
33332
|
return decorateResult({ result, stack });
|
|
33313
33333
|
}
|
|
@@ -33578,7 +33598,8 @@ function removeCollectionDefinition$1({
|
|
|
33578
33598
|
matchUp = matchUp ?? result?.matchUp;
|
|
33579
33599
|
const existingTieFormat = result?.tieFormat;
|
|
33580
33600
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33581
|
-
|
|
33601
|
+
const eventType = event?.eventType;
|
|
33602
|
+
result = validateTieFormat({ tieFormat, eventType });
|
|
33582
33603
|
if (result.error)
|
|
33583
33604
|
return decorateResult({ result, stack });
|
|
33584
33605
|
const targetCollection = tieFormat?.collectionDefinitions?.find(
|
|
@@ -33715,7 +33736,7 @@ function removeCollectionDefinition$1({
|
|
|
33715
33736
|
});
|
|
33716
33737
|
}
|
|
33717
33738
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33718
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33739
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType });
|
|
33719
33740
|
if (result.error)
|
|
33720
33741
|
return decorateResult({ result, stack });
|
|
33721
33742
|
if (eventId && event) {
|
|
@@ -33807,7 +33828,8 @@ function addCollectionDefinition$1({
|
|
|
33807
33828
|
matchUp = matchUp ?? result?.matchUp;
|
|
33808
33829
|
const existingTieFormat = matchUp?.tieFormat ?? result?.tieFormat;
|
|
33809
33830
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
33810
|
-
|
|
33831
|
+
const eventType = event?.eventType;
|
|
33832
|
+
result = validateTieFormat({ tieFormat, eventType });
|
|
33811
33833
|
if (result?.error) {
|
|
33812
33834
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33813
33835
|
}
|
|
@@ -33842,7 +33864,7 @@ function addCollectionDefinition$1({
|
|
|
33842
33864
|
const addedMatchUps = [];
|
|
33843
33865
|
let targetMatchUps = [];
|
|
33844
33866
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
33845
|
-
result = validateTieFormat({ tieFormat: prunedTieFormat });
|
|
33867
|
+
result = validateTieFormat({ tieFormat: prunedTieFormat, eventType });
|
|
33846
33868
|
if (result?.error) {
|
|
33847
33869
|
return decorateResult({ result: { error: result.error }, stack });
|
|
33848
33870
|
}
|
|
@@ -34130,7 +34152,10 @@ function collectionGroupUpdate({
|
|
|
34130
34152
|
event
|
|
34131
34153
|
});
|
|
34132
34154
|
const prunedTieFormat = definedAttributes(tieFormat);
|
|
34133
|
-
const result = validateTieFormat({
|
|
34155
|
+
const result = validateTieFormat({
|
|
34156
|
+
eventType: event?.eventType,
|
|
34157
|
+
tieFormat: prunedTieFormat
|
|
34158
|
+
});
|
|
34134
34159
|
if (result.error)
|
|
34135
34160
|
return result;
|
|
34136
34161
|
if (eventId && event) {
|
|
@@ -34180,7 +34205,7 @@ function removeCollectionGroup$1({
|
|
|
34180
34205
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34181
34206
|
const wasAggregateValue = existingTieFormat?.winCriteria.aggregateValue;
|
|
34182
34207
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34183
|
-
result = validateTieFormat({ tieFormat });
|
|
34208
|
+
result = validateTieFormat({ tieFormat, eventType: event?.eventType });
|
|
34184
34209
|
if (result.error)
|
|
34185
34210
|
return decorateResult({ result, stack });
|
|
34186
34211
|
const modifiedCollectionIds = [];
|
|
@@ -34267,7 +34292,7 @@ function addCollectionGroup$1({
|
|
|
34267
34292
|
const existingTieFormat = result?.tieFormat;
|
|
34268
34293
|
const originalValueGoal = existingTieFormat?.winCriteria.valueGoal;
|
|
34269
34294
|
const tieFormat = copyTieFormat(existingTieFormat);
|
|
34270
|
-
result = validateTieFormat({ tieFormat });
|
|
34295
|
+
result = validateTieFormat({ tieFormat, eventType: event.eventType });
|
|
34271
34296
|
if (result.error)
|
|
34272
34297
|
return decorateResult({ result, stack });
|
|
34273
34298
|
for (const collectionDefinition of tieFormat.collectionDefinitions) {
|
|
@@ -34331,7 +34356,10 @@ function modifyTieFormat$1({
|
|
|
34331
34356
|
event
|
|
34332
34357
|
}) {
|
|
34333
34358
|
const stack = "modifyTieFormat";
|
|
34334
|
-
if (!validateTieFormat({
|
|
34359
|
+
if (!validateTieFormat({
|
|
34360
|
+
tieFormat: modifiedTieFormat,
|
|
34361
|
+
eventType: event?.eventType
|
|
34362
|
+
}).valid) {
|
|
34335
34363
|
return decorateResult({
|
|
34336
34364
|
result: { error: INVALID_TIE_FORMAT },
|
|
34337
34365
|
info: "falied validation",
|
|
@@ -42893,7 +42921,8 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
|
|
|
42893
42921
|
const drawDefinition = modifyOriginal ? params.drawDefinition : makeDeepCopy(params.drawDefinition, false, true);
|
|
42894
42922
|
let { tieFormat, matchUpType } = params;
|
|
42895
42923
|
if (tieFormat) {
|
|
42896
|
-
const
|
|
42924
|
+
const eventType = params.event?.eventType;
|
|
42925
|
+
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
42897
42926
|
if (result2.error)
|
|
42898
42927
|
return result2;
|
|
42899
42928
|
}
|
|
@@ -45360,7 +45389,8 @@ function generateVoluntaryConsolation$1(params) {
|
|
|
45360
45389
|
return { error: INVALID_DRAW_SIZE };
|
|
45361
45390
|
let { tieFormat, matchUpType } = params;
|
|
45362
45391
|
if (tieFormat) {
|
|
45363
|
-
const
|
|
45392
|
+
const eventType = params.event?.eventType;
|
|
45393
|
+
const result2 = validateTieFormat({ tieFormat, eventType });
|
|
45364
45394
|
if (result2.error)
|
|
45365
45395
|
return result2;
|
|
45366
45396
|
}
|
|
@@ -53809,15 +53839,13 @@ function generateLineUps(params) {
|
|
|
53809
53839
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
53810
53840
|
if (!tieFormat && !drawDefinition)
|
|
53811
53841
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
53812
|
-
tieFormat = tieFormat
|
|
53813
|
-
if (validateTieFormat({ tieFormat }).error)
|
|
53842
|
+
tieFormat = tieFormat ?? resolveTieFormat({ drawDefinition, event })?.tieFormat;
|
|
53843
|
+
if (validateTieFormat({ tieFormat, eventType: params.event?.eventType }).error)
|
|
53814
53844
|
return { error: INVALID_TIE_FORMAT };
|
|
53815
53845
|
if (typeof scaleAccessor !== "object" && !useDefaultEventRanking)
|
|
53816
53846
|
return { error: INVALID_VALUES, context: { scaleAccessor } };
|
|
53817
53847
|
const lineUps = {};
|
|
53818
|
-
const targetEntries = (drawDefinition?.entries
|
|
53819
|
-
(entry) => entry?.entryStatus === DIRECT_ACCEPTANCE
|
|
53820
|
-
);
|
|
53848
|
+
const targetEntries = (drawDefinition?.entries ?? event?.entries ?? []).filter((entry) => entry?.entryStatus === DIRECT_ACCEPTANCE);
|
|
53821
53849
|
const participantIds = targetEntries.map(getParticipantId);
|
|
53822
53850
|
const { participants = [] } = getParticipants$1({
|
|
53823
53851
|
withIndividualParticipants: true,
|
|
@@ -53828,7 +53856,7 @@ function generateLineUps(params) {
|
|
|
53828
53856
|
({ participantId }) => participantIds.includes(participantId)
|
|
53829
53857
|
);
|
|
53830
53858
|
const formatScaleType = (type) => type === RANKING$1 ? "rankings" : "ratings";
|
|
53831
|
-
const defaultScaleName = event?.category?.categoryName
|
|
53859
|
+
const defaultScaleName = event?.category?.categoryName ?? event?.category?.ageCategoryCode;
|
|
53832
53860
|
const {
|
|
53833
53861
|
scaleName = defaultScaleName,
|
|
53834
53862
|
scaleType = RANKING$1,
|
|
@@ -53860,7 +53888,7 @@ function generateLineUps(params) {
|
|
|
53860
53888
|
const singlesScaleSort = (a, b) => sortMethod(a, b, SINGLES_MATCHUP);
|
|
53861
53889
|
const doublesScaleSort = (a, b) => sortMethod(a, b, DOUBLES_MATCHUP);
|
|
53862
53890
|
const participantIdPairs = [];
|
|
53863
|
-
const collectionDefinitions = tieFormat
|
|
53891
|
+
const collectionDefinitions = tieFormat?.collectionDefinitions ?? [];
|
|
53864
53892
|
for (const teamParticipant of teamParticipants) {
|
|
53865
53893
|
const singlesSort = teamParticipant.individualParticipants.sort(singlesScaleSort);
|
|
53866
53894
|
const doublesSort = singlesOnly ? singlesSort : teamParticipant.individualParticipants.sort(doublesScaleSort);
|
|
@@ -53875,7 +53903,7 @@ function generateLineUps(params) {
|
|
|
53875
53903
|
const participantIds2 = [];
|
|
53876
53904
|
generateRange(0, singlesMatchUp ? 1 : 2).forEach((i2) => {
|
|
53877
53905
|
const nextParticipantId = typeSort.find((participant) => {
|
|
53878
|
-
const targetGender = [MALE, FEMALE].includes(gender) && gender || gender === MIXED && [MALE, FEMALE][i2];
|
|
53906
|
+
const targetGender = gender && ([MALE, FEMALE].includes(gender) && gender || gender === MIXED && [MALE, FEMALE][i2]);
|
|
53879
53907
|
return (!targetGender || targetGender === participant.person.sex) && !collectionParticipantIds.includes(participant.participantId);
|
|
53880
53908
|
}).participantId;
|
|
53881
53909
|
if (nextParticipantId) {
|
|
@@ -57239,7 +57267,10 @@ function addEvent({
|
|
|
57239
57267
|
};
|
|
57240
57268
|
if (event.eventType === TypeEnum.Team) {
|
|
57241
57269
|
if (event.tieFormat) {
|
|
57242
|
-
const result = validateTieFormat({
|
|
57270
|
+
const result = validateTieFormat({
|
|
57271
|
+
tieFormat: event.tieFormat,
|
|
57272
|
+
eventType: event.eventType
|
|
57273
|
+
});
|
|
57243
57274
|
if (result.error)
|
|
57244
57275
|
return result;
|
|
57245
57276
|
} else if (event.tieFormatName) {
|
|
@@ -59650,7 +59681,8 @@ function generateDrawDefinition(params) {
|
|
|
59650
59681
|
const result = validateTieFormat({
|
|
59651
59682
|
gender: event?.gender,
|
|
59652
59683
|
enforceGender,
|
|
59653
|
-
tieFormat
|
|
59684
|
+
tieFormat,
|
|
59685
|
+
event
|
|
59654
59686
|
});
|
|
59655
59687
|
if (result.error)
|
|
59656
59688
|
return decorateResult({ result, stack });
|
|
@@ -59669,7 +59701,10 @@ function generateDrawDefinition(params) {
|
|
|
59669
59701
|
const equivalentInScope = matchUpFormat && event?.matchUpFormat === matchUpFormat || event?.tieFormat && tieFormat && JSON.stringify(event.tieFormat) === JSON.stringify(tieFormat);
|
|
59670
59702
|
if (!equivalentInScope) {
|
|
59671
59703
|
if (tieFormat) {
|
|
59672
|
-
const result = checkTieFormat(
|
|
59704
|
+
const result = checkTieFormat({
|
|
59705
|
+
eventType: event.eventType,
|
|
59706
|
+
tieFormat
|
|
59707
|
+
});
|
|
59673
59708
|
if (result.error)
|
|
59674
59709
|
return decorateResult({ result, stack });
|
|
59675
59710
|
drawDefinition.tieFormat = result.tieFormat ?? tieFormat;
|
|
@@ -60085,11 +60120,12 @@ function aggregateTieFormats({
|
|
|
60085
60120
|
addedCount += 1;
|
|
60086
60121
|
}
|
|
60087
60122
|
};
|
|
60088
|
-
|
|
60123
|
+
const eventType = event.eventType;
|
|
60124
|
+
checkTieFormat({ tieFormat: event.tieFormat, eventType });
|
|
60089
60125
|
for (const drawDefinition of event.drawDefinitions ?? []) {
|
|
60090
|
-
checkTieFormat(drawDefinition);
|
|
60126
|
+
checkTieFormat({ tieFormat: drawDefinition.tieFormat, eventType });
|
|
60091
60127
|
for (const structure of drawDefinition.structures ?? []) {
|
|
60092
|
-
checkTieFormat(structure);
|
|
60128
|
+
checkTieFormat({ tieFormat: structure.tieFormat, eventType });
|
|
60093
60129
|
}
|
|
60094
60130
|
}
|
|
60095
60131
|
const setTieFormatId = (matchUpId, tieFormatId) => {
|
|
@@ -65547,7 +65583,7 @@ const utilities = {
|
|
|
65547
65583
|
findExtension: findExtension$2,
|
|
65548
65584
|
flattenJSON,
|
|
65549
65585
|
garman,
|
|
65550
|
-
|
|
65586
|
+
tieFormatGenderValidityCheck,
|
|
65551
65587
|
generateHashCode,
|
|
65552
65588
|
generateRange,
|
|
65553
65589
|
generateScoreString,
|