tods-competition-factory 1.8.25 → 1.8.27

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.
@@ -1601,7 +1601,9 @@ type AutomatedPositioningArgs = {
1601
1601
  };
1602
1602
  declare function automatedPositioning({ applyPositioning, tournamentRecord, drawDefinition, seedingProfile, structureId, placeByes, seedsOnly, drawSize, event, }: AutomatedPositioningArgs): (ResultType & {
1603
1603
  positionAssignments?: PositionAssignment[] | undefined;
1604
- positioningReport?: any;
1604
+ positioningReport?: {
1605
+ [key: string]: any;
1606
+ } | undefined;
1605
1607
  success?: boolean | undefined;
1606
1608
  conflicts?: any[] | undefined;
1607
1609
  }) | {
@@ -1627,6 +1629,9 @@ type AutomatedPlayoffPositioningArgs = {
1627
1629
  };
1628
1630
  declare function automatedPlayoffPositioning(params: AutomatedPlayoffPositioningArgs): {
1629
1631
  structurePositionAssignments?: StructurePositionAssignmentType[];
1632
+ positioningReports?: {
1633
+ [key: string]: any;
1634
+ }[];
1630
1635
  success?: boolean;
1631
1636
  error?: ErrorType;
1632
1637
  };
@@ -846,18 +846,21 @@ function cycleMutationStatus() {
846
846
  return status;
847
847
  }
848
848
  function addNotice$1({ topic, payload, key }) {
849
- syncGlobalState.modified = true;
850
849
  if (typeof topic !== "string" || typeof payload !== "object") {
851
850
  return;
852
851
  }
853
- if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic])
852
+ if (!syncGlobalState.disableNotifications)
853
+ syncGlobalState.modified = true;
854
+ if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic]) {
854
855
  return;
856
+ }
855
857
  if (key) {
856
858
  syncGlobalState.notices = syncGlobalState.notices.filter(
857
859
  (notice) => !(notice.topic === topic && notice.key === key)
858
860
  );
859
861
  }
860
862
  syncGlobalState.notices.push({ topic, payload, key });
863
+ return { ...SUCCESS };
861
864
  }
862
865
  function getNotices({ topic }) {
863
866
  const notices = syncGlobalState.notices.filter((notice) => notice.topic === topic).map((notice) => notice.payload);
@@ -1449,6 +1452,7 @@ const POLICY_TYPE_MATCHUP_ACTIONS = "matchUpActions";
1449
1452
  const POLICY_TYPE_ROUND_NAMING = "roundNaming";
1450
1453
  const POLICY_TYPE_PARTICIPANT = "participant";
1451
1454
  const POLICY_TYPE_SCHEDULING = "scheduling";
1455
+ const POLICY_TYPE_AVOIDANCE = "avoidance";
1452
1456
  const POLICY_TYPE_DISPLAY = "display";
1453
1457
  const POLICY_TYPE_SCORING = "scoring";
1454
1458
  const POLICY_TYPE_SEEDING = "seeding";
@@ -3100,41 +3104,6 @@ function getMatchUpType(params) {
3100
3104
  return { matchUpType };
3101
3105
  }
3102
3106
 
3103
- function modifyEntryProfile({
3104
- drawDefinition,
3105
- attributes
3106
- }) {
3107
- let { extension } = findDrawDefinitionExtension({
3108
- name: ENTRY_PROFILE,
3109
- drawDefinition
3110
- });
3111
- const entryProfile = extension?.value || {};
3112
- attributes.forEach((attribute) => {
3113
- Object.keys(attribute).forEach((key) => {
3114
- if (!entryProfile[key]) {
3115
- entryProfile[key] = attribute[key];
3116
- } else {
3117
- Object.assign(entryProfile[key], attribute[key]);
3118
- }
3119
- });
3120
- });
3121
- extension = {
3122
- name: ENTRY_PROFILE,
3123
- value: entryProfile
3124
- };
3125
- addDrawDefinitionExtension({ drawDefinition, extension });
3126
- return { entryProfile };
3127
- }
3128
-
3129
- function getEntryProfile({ drawDefinition }) {
3130
- const { extension } = findDrawDefinitionExtension({
3131
- name: ENTRY_PROFILE,
3132
- drawDefinition
3133
- });
3134
- const entryProfile = extension?.value || {};
3135
- return { entryProfile };
3136
- }
3137
-
3138
3107
  const MAIN = "MAIN";
3139
3108
  const QUALIFYING = "QUALIFYING";
3140
3109
  const CONSOLATION = "CONSOLATION";
@@ -3328,6 +3297,118 @@ function getDrawStructures({
3328
3297
  }
3329
3298
  }
3330
3299
 
3300
+ function getAllPositionedParticipantIds({
3301
+ drawDefinition
3302
+ }) {
3303
+ if (!drawDefinition)
3304
+ return { error: MISSING_DRAW_DEFINITION };
3305
+ const stagePositionedParticipantIds = {};
3306
+ const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
3307
+ const stage = structure.stage;
3308
+ if (!stagePositionedParticipantIds[stage])
3309
+ stagePositionedParticipantIds[stage] = [];
3310
+ const { positionAssignments } = getPositionAssignments({ structure });
3311
+ const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
3312
+ stagePositionedParticipantIds[stage].push(...particiapntIds);
3313
+ return particiapntIds;
3314
+ }).flat();
3315
+ return { allPositionedParticipantIds, stagePositionedParticipantIds };
3316
+ }
3317
+ function getPositionAssignments({
3318
+ drawDefinition,
3319
+ structureId,
3320
+ structure
3321
+ }) {
3322
+ let error, positionAssignments = [];
3323
+ if (!structure) {
3324
+ if (!drawDefinition) {
3325
+ return { positionAssignments, error: MISSING_DRAW_DEFINITION };
3326
+ }
3327
+ ({ structure, error } = findStructure({ drawDefinition, structureId }));
3328
+ if (error)
3329
+ return { positionAssignments, error };
3330
+ }
3331
+ if (structure.structures) {
3332
+ positionAssignments = [].concat(
3333
+ ...structure.structures.map((structure2) => {
3334
+ return getPositionAssignments({ structure: structure2 }).positionAssignments;
3335
+ })
3336
+ );
3337
+ } else if (structure.positionAssignments) {
3338
+ positionAssignments = structure.positionAssignments;
3339
+ } else {
3340
+ error = MISSING_POSITION_ASSIGNMENTS;
3341
+ }
3342
+ return { positionAssignments, error };
3343
+ }
3344
+ function structureAssignedDrawPositions({
3345
+ drawDefinition,
3346
+ structureId,
3347
+ structure
3348
+ }) {
3349
+ const positionAssignments = getPositionAssignments({
3350
+ drawDefinition,
3351
+ structureId,
3352
+ structure
3353
+ })?.positionAssignments || [];
3354
+ const assignedPositions = positionAssignments?.filter((assignment) => {
3355
+ return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
3356
+ });
3357
+ const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
3358
+ const unassignedPositions = positionAssignments?.filter((assignment) => {
3359
+ return !assignment.participantId && !assignment.bye && !assignment.qualifier;
3360
+ });
3361
+ const byePositions = positionAssignments?.filter((assignment) => {
3362
+ return !assignment.participantId && assignment.bye;
3363
+ });
3364
+ const qualifierPositions = positionAssignments?.filter((assignment) => {
3365
+ return !assignment.participantId && assignment.qualifier;
3366
+ });
3367
+ return {
3368
+ allPositionsAssigned,
3369
+ positionAssignments,
3370
+ unassignedPositions,
3371
+ assignedPositions,
3372
+ qualifierPositions,
3373
+ byePositions
3374
+ };
3375
+ }
3376
+
3377
+ function modifyEntryProfile({
3378
+ drawDefinition,
3379
+ attributes
3380
+ }) {
3381
+ let { extension } = findDrawDefinitionExtension({
3382
+ name: ENTRY_PROFILE,
3383
+ drawDefinition
3384
+ });
3385
+ const entryProfile = extension?.value || {};
3386
+ attributes.forEach((attribute) => {
3387
+ Object.keys(attribute).forEach((key) => {
3388
+ if (!entryProfile[key]) {
3389
+ entryProfile[key] = attribute[key];
3390
+ } else {
3391
+ Object.assign(entryProfile[key], attribute[key]);
3392
+ }
3393
+ });
3394
+ });
3395
+ extension = {
3396
+ name: ENTRY_PROFILE,
3397
+ value: entryProfile
3398
+ };
3399
+ addDrawDefinitionExtension({ drawDefinition, extension });
3400
+ return { entryProfile };
3401
+ }
3402
+
3403
+ function getEntryProfile({ drawDefinition }) {
3404
+ const { extension } = findDrawDefinitionExtension({
3405
+ name: ENTRY_PROFILE,
3406
+ drawDefinition
3407
+ });
3408
+ const entryProfile = extension?.value || {};
3409
+ return { entryProfile };
3410
+ }
3411
+
3331
3412
  const ALTERNATE = EntryStatusEnum.Alternate;
3332
3413
  const CONFIRMED = EntryStatusEnum.Confirmed;
3333
3414
  const DIRECT_ACCEPTANCE = EntryStatusEnum.DirectAcceptance;
@@ -3515,6 +3596,7 @@ function getStageDirectEntriesCount({ stage, drawDefinition }) {
3515
3596
 
3516
3597
  function getStructureSeedAssignments({
3517
3598
  provisionalPositioning,
3599
+ returnAllProxies,
3518
3600
  drawDefinition,
3519
3601
  structureId,
3520
3602
  structure
@@ -3523,6 +3605,9 @@ function getStructureSeedAssignments({
3523
3605
  if (!structure) {
3524
3606
  ({ structure, error } = findStructure({ drawDefinition, structureId }));
3525
3607
  }
3608
+ const positionAssignments = getPositionAssignments({
3609
+ structure
3610
+ }).positionAssignments;
3526
3611
  if (error || !structure)
3527
3612
  return { seedAssignments: [], error: STRUCTURE_NOT_FOUND };
3528
3613
  if (!structureId)
@@ -3536,18 +3621,22 @@ function getStructureSeedAssignments({
3536
3621
  structureId,
3537
3622
  stage
3538
3623
  });
3539
- const seedProxies = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
3624
+ const proxiedEntries = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
3540
3625
  return a.GEMscore < b.GEMscore && 1 || a.GEMscore > b.GEMscore && -1 || 0;
3541
3626
  }).map((entry, index) => {
3542
3627
  const seedNumber = index + 1;
3543
3628
  return {
3544
3629
  participantId: entry.participantId,
3545
3630
  seedValue: seedNumber,
3546
- seedNumber,
3547
- seedProxy: true
3631
+ seedProxy: true,
3548
3632
  // flag so that proxy seeding information doesn't get used externally
3633
+ seedNumber
3549
3634
  };
3550
3635
  }) : [];
3636
+ const seedProxies = proxiedEntries?.slice(
3637
+ 0,
3638
+ returnAllProxies ? proxiedEntries.length : positionAssignments.length / 2
3639
+ );
3551
3640
  if (seedProxies.length) {
3552
3641
  seedAssignments = seedProxies;
3553
3642
  } else if (structure.seedAssignments) {
@@ -3556,7 +3645,13 @@ function getStructureSeedAssignments({
3556
3645
  error = MISSING_SEED_ASSIGNMENTS;
3557
3646
  }
3558
3647
  const seedLimit = structure.seedLimit || structure?.positionAssignments?.length;
3559
- return { seedAssignments, seedLimit, stage, stageSequence, error };
3648
+ return {
3649
+ seedAssignments,
3650
+ stageSequence,
3651
+ seedLimit,
3652
+ stage,
3653
+ error
3654
+ };
3560
3655
  }
3561
3656
 
3562
3657
  function getExitProfiles({ drawDefinition }) {
@@ -3835,83 +3930,6 @@ function getSourceDrawPositionRanges({
3835
3930
  return { sourceDrawPositionRanges };
3836
3931
  }
3837
3932
 
3838
- function getAllPositionedParticipantIds({
3839
- drawDefinition
3840
- }) {
3841
- if (!drawDefinition)
3842
- return { error: MISSING_DRAW_DEFINITION };
3843
- const stagePositionedParticipantIds = {};
3844
- const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
3845
- const stage = structure.stage;
3846
- if (!stagePositionedParticipantIds[stage])
3847
- stagePositionedParticipantIds[stage] = [];
3848
- const { positionAssignments } = getPositionAssignments({ structure });
3849
- const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
3850
- stagePositionedParticipantIds[stage].push(...particiapntIds);
3851
- return particiapntIds;
3852
- }).flat();
3853
- return { allPositionedParticipantIds, stagePositionedParticipantIds };
3854
- }
3855
- function getPositionAssignments({
3856
- drawDefinition,
3857
- structureId,
3858
- structure
3859
- }) {
3860
- let error, positionAssignments = [];
3861
- if (!structure) {
3862
- if (!drawDefinition) {
3863
- return { positionAssignments, error: MISSING_DRAW_DEFINITION };
3864
- }
3865
- ({ structure, error } = findStructure({ drawDefinition, structureId }));
3866
- if (error)
3867
- return { positionAssignments, error };
3868
- }
3869
- if (structure.structures) {
3870
- positionAssignments = [].concat(
3871
- ...structure.structures.map((structure2) => {
3872
- return getPositionAssignments({ structure: structure2 }).positionAssignments;
3873
- })
3874
- );
3875
- } else if (structure.positionAssignments) {
3876
- positionAssignments = structure.positionAssignments;
3877
- } else {
3878
- error = MISSING_POSITION_ASSIGNMENTS;
3879
- }
3880
- return { positionAssignments, error };
3881
- }
3882
- function structureAssignedDrawPositions({
3883
- drawDefinition,
3884
- structureId,
3885
- structure
3886
- }) {
3887
- const positionAssignments = getPositionAssignments({
3888
- drawDefinition,
3889
- structureId,
3890
- structure
3891
- })?.positionAssignments || [];
3892
- const assignedPositions = positionAssignments?.filter((assignment) => {
3893
- return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
3894
- });
3895
- const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
3896
- const unassignedPositions = positionAssignments?.filter((assignment) => {
3897
- return !assignment.participantId && !assignment.bye && !assignment.qualifier;
3898
- });
3899
- const byePositions = positionAssignments?.filter((assignment) => {
3900
- return !assignment.participantId && assignment.bye;
3901
- });
3902
- const qualifierPositions = positionAssignments?.filter((assignment) => {
3903
- return !assignment.participantId && assignment.qualifier;
3904
- });
3905
- return {
3906
- allPositionsAssigned,
3907
- positionAssignments,
3908
- unassignedPositions,
3909
- assignedPositions,
3910
- qualifierPositions,
3911
- byePositions
3912
- };
3913
- }
3914
-
3915
3933
  function getOrderedDrawPositions({
3916
3934
  drawPositions,
3917
3935
  roundProfile,
@@ -5393,6 +5411,7 @@ function getSeedGroups({
5393
5411
 
5394
5412
  function getValidSeedBlocks({
5395
5413
  provisionalPositioning,
5414
+ returnAllProxies,
5396
5415
  appliedPolicies,
5397
5416
  drawDefinition,
5398
5417
  allPositions,
@@ -5408,6 +5427,7 @@ function getValidSeedBlocks({
5408
5427
  });
5409
5428
  const { seedAssignments } = getStructureSeedAssignments({
5410
5429
  provisionalPositioning,
5430
+ returnAllProxies,
5411
5431
  drawDefinition,
5412
5432
  structure
5413
5433
  });
@@ -5642,6 +5662,7 @@ function getNextSeedBlock(params) {
5642
5662
  } = params;
5643
5663
  const { structure } = findStructure({ drawDefinition, structureId });
5644
5664
  const { seedAssignments } = getStructureSeedAssignments({
5665
+ returnAllProxies: params.returnAllProxies,
5645
5666
  provisionalPositioning,
5646
5667
  drawDefinition,
5647
5668
  structure
@@ -5653,6 +5674,7 @@ function getNextSeedBlock(params) {
5653
5674
  const assignedDrawPositions = positionsWithParticipants?.map((assignment) => assignment.drawPosition).filter(Boolean);
5654
5675
  const { appliedPolicies } = getAppliedPolicies({ drawDefinition });
5655
5676
  const validSeedBlocks = seedBlockInfo?.validSeedBlocks || structure && getValidSeedBlocks({
5677
+ returnAllProxies: params.returnAllProxies,
5656
5678
  provisionalPositioning,
5657
5679
  appliedPolicies,
5658
5680
  drawDefinition,
@@ -10010,6 +10032,48 @@ function assignFedDrawPositionBye({
10010
10032
  }
10011
10033
  }
10012
10034
 
10035
+ function processAccessors({
10036
+ significantCharacters,
10037
+ accessors = [],
10038
+ value
10039
+ }) {
10040
+ const extractedValues = [];
10041
+ const accessor = accessors[0];
10042
+ if (value?.[accessor]) {
10043
+ const remainingKeys = accessors.slice(1);
10044
+ if (Array.isArray(value[accessor])) {
10045
+ const values = value[accessor];
10046
+ values.forEach((nestedValue) => {
10047
+ const result = processAccessors({
10048
+ accessors: remainingKeys,
10049
+ significantCharacters,
10050
+ value: nestedValue
10051
+ });
10052
+ extractedValues.push(...result);
10053
+ });
10054
+ } else {
10055
+ value = value[accessor];
10056
+ if (remainingKeys.length) {
10057
+ const result = processAccessors({
10058
+ accessors: remainingKeys,
10059
+ significantCharacters,
10060
+ value
10061
+ });
10062
+ extractedValues.push(...result);
10063
+ } else {
10064
+ checkValue({ value });
10065
+ }
10066
+ }
10067
+ }
10068
+ function checkValue({ value: value2 }) {
10069
+ if (value2 && ["string", "number"].includes(typeof value2)) {
10070
+ const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
10071
+ extractedValues.push(extractedValue);
10072
+ }
10073
+ }
10074
+ return extractedValues;
10075
+ }
10076
+
10013
10077
  function getAttributeGroupings({
10014
10078
  targetParticipantIds,
10015
10079
  policyAttributes,
@@ -10061,8 +10125,14 @@ function extractAttributeValues({
10061
10125
  policyAttributes.forEach((policyAttribute) => {
10062
10126
  const { directive, groupings, key, significantCharacters } = policyAttribute || {};
10063
10127
  if (key) {
10064
- const keys = key.split(".");
10065
- processKeys({ value: participant, keys, significantCharacters });
10128
+ const accessors = key.split(".");
10129
+ extractedValues.push(
10130
+ ...processAccessors({
10131
+ significantCharacters,
10132
+ value: participant,
10133
+ accessors
10134
+ })
10135
+ );
10066
10136
  } else if (directive) {
10067
10137
  const includeIds = policyAttribute?.includeIds;
10068
10138
  const collectionIds = (idCollections?.[directive] || []).filter(
@@ -10091,32 +10161,6 @@ function extractAttributeValues({
10091
10161
  });
10092
10162
  const values = unique(extractedValues);
10093
10163
  return { values };
10094
- function processKeys({ value, keys = [], significantCharacters }) {
10095
- for (const [index, key] of keys.entries()) {
10096
- if (value?.[key]) {
10097
- if (Array.isArray(value[key])) {
10098
- const values2 = value[key];
10099
- const remainingKeys = keys.slice(index);
10100
- values2.forEach(
10101
- (nestedValue) => processKeys({
10102
- value: nestedValue,
10103
- keys: remainingKeys,
10104
- significantCharacters
10105
- })
10106
- );
10107
- } else {
10108
- value = value[key];
10109
- checkValue({ value, index });
10110
- }
10111
- }
10112
- }
10113
- function checkValue({ value: value2, index }) {
10114
- if (value2 && index === keys.length - 1 && ["string", "number"].includes(typeof value2)) {
10115
- const extractedValue = significantCharacters ? value2.slice(0, significantCharacters) : value2;
10116
- extractedValues.push(extractedValue);
10117
- }
10118
- }
10119
- }
10120
10164
  }
10121
10165
 
10122
10166
  function getPositionedParticipants({
@@ -10771,10 +10815,11 @@ function updateMatchUpStatusCodes({
10771
10815
  );
10772
10816
  matchUp.matchUpStatusCodes = (matchUp.matchUpStatusCodes ?? []).map(
10773
10817
  (code) => {
10774
- if (code.sideNumber === sourceSideNumber) {
10775
- return { ...code, previousMatchUpStatus: sourceMatchUpStatus };
10818
+ const value = isString(code) || !isNaN(code) ? { code } : code;
10819
+ if (value.sideNumber === sourceSideNumber) {
10820
+ return { ...value, previousMatchUpStatus: sourceMatchUpStatus };
10776
10821
  }
10777
- return code;
10822
+ return value;
10778
10823
  }
10779
10824
  );
10780
10825
  }
@@ -11934,8 +11979,7 @@ function randomUnseededSeparation({
11934
11979
  structureId,
11935
11980
  avoidance,
11936
11981
  drawSize,
11937
- entries,
11938
- // entries for the specific stage of drawDefinition
11982
+ // entries, // entries for the specific stage of drawDefinition
11939
11983
  event
11940
11984
  }) {
11941
11985
  if (!avoidance) {
@@ -11973,10 +12017,11 @@ function randomUnseededSeparation({
11973
12017
  const isRoundRobin = structure?.structureType === CONTAINER;
11974
12018
  const params = isRoundRobin ? { structure, matchUps, allDrawPositions, roundsToSeparate } : { matchUps, allDrawPositions, roundsToSeparate };
11975
12019
  const { drawPositionGroups, drawPositionChunks } = isRoundRobin ? roundRobinParticipantGroups(params) : eliminationParticipantGroups(params);
11976
- const idCollections = {};
11977
- idCollections.groupParticipants = participants.filter((participant) => participant.participantType === GROUP).map((participant) => participant.participantId);
11978
- idCollections.teamParticipants = participants.filter((participant) => participant.participantType === TEAM).map((participant) => participant.participantId);
11979
- idCollections.pairParticipants = participants.filter((participant) => participant.participantType === PAIR).map((participant) => participant.participantId);
12020
+ const idCollections = {
12021
+ groupParticipants: participants.filter((participant) => participant.participantType === GROUP).map((participant) => participant.participantId),
12022
+ teamParticipants: participants.filter((participant) => participant.participantType === TEAM).map((participant) => participant.participantId),
12023
+ pairParticipants: participants.filter((participant) => participant.participantType === PAIR).map((participant) => participant.participantId)
12024
+ };
11980
12025
  const allGroups = getAttributeGroupings({
11981
12026
  targetParticipantIds: unseededParticipantIds,
11982
12027
  policyAttributes,
@@ -12037,8 +12082,8 @@ function randomUnseededSeparation({
12037
12082
  policyAttributes,
12038
12083
  idCollections,
12039
12084
  allGroups,
12040
- drawSize,
12041
- entries
12085
+ drawSize
12086
+ // entries,
12042
12087
  })
12043
12088
  );
12044
12089
  const candidates = noPairPriorityCandidates.concat(...pairedPriorityCandidates).filter((candidate2) => !candidate2.errors?.length);
@@ -12185,7 +12230,7 @@ function positionUnseededParticipants({
12185
12230
  drawDefinition,
12186
12231
  event
12187
12232
  });
12188
- let { avoidance } = appliedPolicies ?? {};
12233
+ let avoidance = (appliedPolicies ?? {})[POLICY_TYPE_AVOIDANCE];
12189
12234
  if (structure.stage === PLAY_OFF) {
12190
12235
  const groupings = entries.reduce((groupings2, entry) => {
12191
12236
  if (!groupings2[entry.groupingValue])
@@ -12471,11 +12516,11 @@ function getSeedOrderByePositions({
12471
12516
  const strictSeedOrderByePositions = getOrderedByePositions({
12472
12517
  orderedSeedDrawPositions: orderedSortedFirstRoundSeededDrawPositions,
12473
12518
  relevantMatchUps
12474
- }).slice(0, positionedSeeds.length);
12519
+ }).slice(0, byesToPlace);
12475
12520
  const blockSeedOrderByePositions = getOrderedByePositions({
12476
12521
  orderedSeedDrawPositions: blockSortedRandomDrawPositions,
12477
12522
  relevantMatchUps
12478
- }).slice(0, positionedSeeds.length);
12523
+ }).slice(0, byesToPlace);
12479
12524
  return {
12480
12525
  strictSeedOrderByePositions,
12481
12526
  blockSeedOrderByePositions,
@@ -13157,7 +13202,6 @@ function automatedPositioning$1({
13157
13202
  event
13158
13203
  }) : void 0;
13159
13204
  if (result2?.error) {
13160
- console.log("positionByes", { result: result2 });
13161
13205
  return handleErrorCondition(result2);
13162
13206
  }
13163
13207
  unseededByePositions = result2?.unseededByePositions;
@@ -13315,6 +13359,7 @@ function automatedPlayoffPositioning(params) {
13315
13359
  );
13316
13360
  const structurePositionAssignments = [];
13317
13361
  const participants = tournamentRecord?.participants;
13362
+ const positioningReports = [];
13318
13363
  if (playoffStructures) {
13319
13364
  for (const structure of playoffStructures) {
13320
13365
  const { structureId: playoffStructureId } = structure;
@@ -13336,9 +13381,11 @@ function automatedPlayoffPositioning(params) {
13336
13381
  structureId: playoffStructureId
13337
13382
  });
13338
13383
  }
13384
+ if (result.positioningReport)
13385
+ positioningReports.push(result.positioningReport);
13339
13386
  }
13340
13387
  }
13341
- return { ...SUCCESS, structurePositionAssignments };
13388
+ return { ...SUCCESS, structurePositionAssignments, positioningReports };
13342
13389
  }
13343
13390
 
13344
13391
  function getStructureRoundProfile({
@@ -16296,6 +16343,29 @@ function ensureSideLineUps({
16296
16343
  }
16297
16344
  }
16298
16345
 
16346
+ function genderValidityCheck({
16347
+ referenceGender,
16348
+ matchUpType,
16349
+ gender
16350
+ }) {
16351
+ const stack = "genderValidityCheck";
16352
+ if (referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && [GenderEnum.Male, GenderEnum.Female].includes(gender)) {
16353
+ const valid = gender === referenceGender;
16354
+ return valid ? { valid: true } : decorateResult({
16355
+ result: { valid: false, error: INVALID_GENDER },
16356
+ context: { gender },
16357
+ stack
16358
+ });
16359
+ }
16360
+ if (matchUpType === TypeEnum.Singles && referenceGender === MIXED)
16361
+ return decorateResult({
16362
+ info: "matchUpType SINGLES is invalid for gender MIXED",
16363
+ result: { error: INVALID_GENDER, valid: false },
16364
+ stack
16365
+ });
16366
+ return { valid: true };
16367
+ }
16368
+
16299
16369
  const typeMatch = (arr, type) => arr.filter(Boolean).every((i) => typeof i === type);
16300
16370
  const allNumeric = (arr) => arr.filter(Boolean).every(isNumeric);
16301
16371
  function getCategoryAgeDetails(params) {
@@ -16785,13 +16855,19 @@ function validateCollectionDefinition({
16785
16855
  if (matchUpFormat && !matchUpFormatCode.isValid(matchUpFormat)) {
16786
16856
  errors.push(`Invalid matchUpFormat: ${matchUpFormat}`);
16787
16857
  }
16788
- if (checkGender && referenceGender && gender && [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) && referenceGender !== gender) {
16789
- errors.push(`Invalid gender: ${gender}`);
16790
- return decorateResult({
16791
- result: { error: INVALID_GENDER, errors },
16792
- context: { referenceGender, gender },
16793
- stack
16858
+ if (checkGender) {
16859
+ const result = genderValidityCheck({
16860
+ referenceGender,
16861
+ matchUpType,
16862
+ gender
16794
16863
  });
16864
+ if (result.error) {
16865
+ return decorateResult({
16866
+ context: { referenceGender, gender },
16867
+ result,
16868
+ stack
16869
+ });
16870
+ }
16795
16871
  }
16796
16872
  if (checkCategory && referenceCategory && category) {
16797
16873
  const result = categoryCanContain({