tods-competition-factory 1.8.24 → 1.8.26
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 +6 -1
- package/dist/forge/generate.mjs +153 -130
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +1 -1
- package/dist/forge/query.mjs +32 -6
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +85 -66
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +5 -2
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +222 -156
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +244 -193
- 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
|
@@ -1021,6 +1021,10 @@ const SCHEDULED_MATCHUPS = {
|
|
|
1021
1021
|
message: "Scheduled matchUps",
|
|
1022
1022
|
code: "ERR_SCHEDULED_MATCHUPS"
|
|
1023
1023
|
};
|
|
1024
|
+
const SCORES_PRESENT = {
|
|
1025
|
+
message: "Scores present",
|
|
1026
|
+
code: "ERR_SCORES_PRESENT"
|
|
1027
|
+
};
|
|
1024
1028
|
const errorConditionConstants = {
|
|
1025
1029
|
ANACHRONISM,
|
|
1026
1030
|
CANNOT_CHANGE_WINNING_SIDE,
|
|
@@ -1183,6 +1187,7 @@ const errorConditionConstants = {
|
|
|
1183
1187
|
POLICY_NOT_FOUND,
|
|
1184
1188
|
SCHEDULE_NOT_CLEARED,
|
|
1185
1189
|
SCHEDULED_MATCHUPS,
|
|
1190
|
+
SCORES_PRESENT,
|
|
1186
1191
|
SEEDSCOUNT_GREATER_THAN_DRAW_SIZE,
|
|
1187
1192
|
STAGE_SEQUENCE_LIMIT,
|
|
1188
1193
|
STRUCTURE_NOT_FOUND,
|
|
@@ -1293,18 +1298,21 @@ function cycleMutationStatus$1() {
|
|
|
1293
1298
|
return status;
|
|
1294
1299
|
}
|
|
1295
1300
|
function addNotice$1({ topic, payload, key }) {
|
|
1296
|
-
syncGlobalState.modified = true;
|
|
1297
1301
|
if (typeof topic !== "string" || typeof payload !== "object") {
|
|
1298
1302
|
return;
|
|
1299
1303
|
}
|
|
1300
|
-
if (syncGlobalState.disableNotifications
|
|
1304
|
+
if (!syncGlobalState.disableNotifications)
|
|
1305
|
+
syncGlobalState.modified = true;
|
|
1306
|
+
if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic]) {
|
|
1301
1307
|
return;
|
|
1308
|
+
}
|
|
1302
1309
|
if (key) {
|
|
1303
1310
|
syncGlobalState.notices = syncGlobalState.notices.filter(
|
|
1304
1311
|
(notice) => !(notice.topic === topic && notice.key === key)
|
|
1305
1312
|
);
|
|
1306
1313
|
}
|
|
1307
1314
|
syncGlobalState.notices.push({ topic, payload, key });
|
|
1315
|
+
return { ...SUCCESS };
|
|
1308
1316
|
}
|
|
1309
1317
|
function getNotices$1({ topic }) {
|
|
1310
1318
|
const notices = syncGlobalState.notices.filter((notice) => notice.topic === topic).map((notice) => notice.payload);
|
|
@@ -2382,7 +2390,7 @@ const matchUpFormatCode = {
|
|
|
2382
2390
|
};
|
|
2383
2391
|
|
|
2384
2392
|
function factoryVersion() {
|
|
2385
|
-
return "1.8.
|
|
2393
|
+
return "1.8.26";
|
|
2386
2394
|
}
|
|
2387
2395
|
|
|
2388
2396
|
function getObjectTieFormat(obj) {
|
|
@@ -6446,41 +6454,6 @@ function getMatchUpType(params) {
|
|
|
6446
6454
|
return { matchUpType };
|
|
6447
6455
|
}
|
|
6448
6456
|
|
|
6449
|
-
function modifyEntryProfile({
|
|
6450
|
-
drawDefinition,
|
|
6451
|
-
attributes
|
|
6452
|
-
}) {
|
|
6453
|
-
let { extension } = findDrawDefinitionExtension({
|
|
6454
|
-
name: ENTRY_PROFILE,
|
|
6455
|
-
drawDefinition
|
|
6456
|
-
});
|
|
6457
|
-
const entryProfile = extension?.value || {};
|
|
6458
|
-
attributes.forEach((attribute) => {
|
|
6459
|
-
Object.keys(attribute).forEach((key) => {
|
|
6460
|
-
if (!entryProfile[key]) {
|
|
6461
|
-
entryProfile[key] = attribute[key];
|
|
6462
|
-
} else {
|
|
6463
|
-
Object.assign(entryProfile[key], attribute[key]);
|
|
6464
|
-
}
|
|
6465
|
-
});
|
|
6466
|
-
});
|
|
6467
|
-
extension = {
|
|
6468
|
-
name: ENTRY_PROFILE,
|
|
6469
|
-
value: entryProfile
|
|
6470
|
-
};
|
|
6471
|
-
addDrawDefinitionExtension({ drawDefinition, extension });
|
|
6472
|
-
return { entryProfile };
|
|
6473
|
-
}
|
|
6474
|
-
|
|
6475
|
-
function getEntryProfile({ drawDefinition }) {
|
|
6476
|
-
const { extension } = findDrawDefinitionExtension({
|
|
6477
|
-
name: ENTRY_PROFILE,
|
|
6478
|
-
drawDefinition
|
|
6479
|
-
});
|
|
6480
|
-
const entryProfile = extension?.value || {};
|
|
6481
|
-
return { entryProfile };
|
|
6482
|
-
}
|
|
6483
|
-
|
|
6484
6457
|
const MAIN = "MAIN";
|
|
6485
6458
|
const QUALIFYING = "QUALIFYING";
|
|
6486
6459
|
const CONSOLATION = "CONSOLATION";
|
|
@@ -6530,6 +6503,7 @@ const WINNER = "WINNER";
|
|
|
6530
6503
|
const LOSER = "LOSER";
|
|
6531
6504
|
const FIRST_MATCHUP = "FIRST_MATCHUP";
|
|
6532
6505
|
const AD_HOC = "AD_HOC";
|
|
6506
|
+
const FLEX_ROUNDS = "AD_HOC";
|
|
6533
6507
|
const FEED_IN$1 = "FEED_IN";
|
|
6534
6508
|
const COMPASS = "COMPASS";
|
|
6535
6509
|
const OLYMPIC = "OLYMPIC";
|
|
@@ -6621,6 +6595,7 @@ const drawDefinitionConstants = {
|
|
|
6621
6595
|
LOSER,
|
|
6622
6596
|
AD_HOC,
|
|
6623
6597
|
FEED_IN: FEED_IN$1,
|
|
6598
|
+
FLEX_ROUNDS,
|
|
6624
6599
|
COMPASS,
|
|
6625
6600
|
PLAY_OFF,
|
|
6626
6601
|
OLYMPIC,
|
|
@@ -6746,6 +6721,118 @@ function getDrawStructures({
|
|
|
6746
6721
|
}
|
|
6747
6722
|
}
|
|
6748
6723
|
|
|
6724
|
+
function getAllPositionedParticipantIds({
|
|
6725
|
+
drawDefinition
|
|
6726
|
+
}) {
|
|
6727
|
+
if (!drawDefinition)
|
|
6728
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
6729
|
+
const stagePositionedParticipantIds = {};
|
|
6730
|
+
const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
|
|
6731
|
+
const stage = structure.stage;
|
|
6732
|
+
if (!stagePositionedParticipantIds[stage])
|
|
6733
|
+
stagePositionedParticipantIds[stage] = [];
|
|
6734
|
+
const { positionAssignments } = getPositionAssignments$1({ structure });
|
|
6735
|
+
const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
|
|
6736
|
+
stagePositionedParticipantIds[stage].push(...particiapntIds);
|
|
6737
|
+
return particiapntIds;
|
|
6738
|
+
}).flat();
|
|
6739
|
+
return { allPositionedParticipantIds, stagePositionedParticipantIds };
|
|
6740
|
+
}
|
|
6741
|
+
function getPositionAssignments$1({
|
|
6742
|
+
drawDefinition,
|
|
6743
|
+
structureId,
|
|
6744
|
+
structure
|
|
6745
|
+
}) {
|
|
6746
|
+
let error, positionAssignments = [];
|
|
6747
|
+
if (!structure) {
|
|
6748
|
+
if (!drawDefinition) {
|
|
6749
|
+
return { positionAssignments, error: MISSING_DRAW_DEFINITION };
|
|
6750
|
+
}
|
|
6751
|
+
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
6752
|
+
if (error)
|
|
6753
|
+
return { positionAssignments, error };
|
|
6754
|
+
}
|
|
6755
|
+
if (structure.structures) {
|
|
6756
|
+
positionAssignments = [].concat(
|
|
6757
|
+
...structure.structures.map((structure2) => {
|
|
6758
|
+
return getPositionAssignments$1({ structure: structure2 }).positionAssignments;
|
|
6759
|
+
})
|
|
6760
|
+
);
|
|
6761
|
+
} else if (structure.positionAssignments) {
|
|
6762
|
+
positionAssignments = structure.positionAssignments;
|
|
6763
|
+
} else {
|
|
6764
|
+
error = MISSING_POSITION_ASSIGNMENTS;
|
|
6765
|
+
}
|
|
6766
|
+
return { positionAssignments, error };
|
|
6767
|
+
}
|
|
6768
|
+
function structureAssignedDrawPositions({
|
|
6769
|
+
drawDefinition,
|
|
6770
|
+
structureId,
|
|
6771
|
+
structure
|
|
6772
|
+
}) {
|
|
6773
|
+
const positionAssignments = getPositionAssignments$1({
|
|
6774
|
+
drawDefinition,
|
|
6775
|
+
structureId,
|
|
6776
|
+
structure
|
|
6777
|
+
})?.positionAssignments || [];
|
|
6778
|
+
const assignedPositions = positionAssignments?.filter((assignment) => {
|
|
6779
|
+
return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
|
|
6780
|
+
});
|
|
6781
|
+
const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
|
|
6782
|
+
const unassignedPositions = positionAssignments?.filter((assignment) => {
|
|
6783
|
+
return !assignment.participantId && !assignment.bye && !assignment.qualifier;
|
|
6784
|
+
});
|
|
6785
|
+
const byePositions = positionAssignments?.filter((assignment) => {
|
|
6786
|
+
return !assignment.participantId && assignment.bye;
|
|
6787
|
+
});
|
|
6788
|
+
const qualifierPositions = positionAssignments?.filter((assignment) => {
|
|
6789
|
+
return !assignment.participantId && assignment.qualifier;
|
|
6790
|
+
});
|
|
6791
|
+
return {
|
|
6792
|
+
allPositionsAssigned,
|
|
6793
|
+
positionAssignments,
|
|
6794
|
+
unassignedPositions,
|
|
6795
|
+
assignedPositions,
|
|
6796
|
+
qualifierPositions,
|
|
6797
|
+
byePositions
|
|
6798
|
+
};
|
|
6799
|
+
}
|
|
6800
|
+
|
|
6801
|
+
function modifyEntryProfile({
|
|
6802
|
+
drawDefinition,
|
|
6803
|
+
attributes
|
|
6804
|
+
}) {
|
|
6805
|
+
let { extension } = findDrawDefinitionExtension({
|
|
6806
|
+
name: ENTRY_PROFILE,
|
|
6807
|
+
drawDefinition
|
|
6808
|
+
});
|
|
6809
|
+
const entryProfile = extension?.value || {};
|
|
6810
|
+
attributes.forEach((attribute) => {
|
|
6811
|
+
Object.keys(attribute).forEach((key) => {
|
|
6812
|
+
if (!entryProfile[key]) {
|
|
6813
|
+
entryProfile[key] = attribute[key];
|
|
6814
|
+
} else {
|
|
6815
|
+
Object.assign(entryProfile[key], attribute[key]);
|
|
6816
|
+
}
|
|
6817
|
+
});
|
|
6818
|
+
});
|
|
6819
|
+
extension = {
|
|
6820
|
+
name: ENTRY_PROFILE,
|
|
6821
|
+
value: entryProfile
|
|
6822
|
+
};
|
|
6823
|
+
addDrawDefinitionExtension({ drawDefinition, extension });
|
|
6824
|
+
return { entryProfile };
|
|
6825
|
+
}
|
|
6826
|
+
|
|
6827
|
+
function getEntryProfile({ drawDefinition }) {
|
|
6828
|
+
const { extension } = findDrawDefinitionExtension({
|
|
6829
|
+
name: ENTRY_PROFILE,
|
|
6830
|
+
drawDefinition
|
|
6831
|
+
});
|
|
6832
|
+
const entryProfile = extension?.value || {};
|
|
6833
|
+
return { entryProfile };
|
|
6834
|
+
}
|
|
6835
|
+
|
|
6749
6836
|
const ALTERNATE = EntryStatusEnum.Alternate;
|
|
6750
6837
|
const CONFIRMED = EntryStatusEnum.Confirmed;
|
|
6751
6838
|
const DIRECT_ACCEPTANCE = EntryStatusEnum.DirectAcceptance;
|
|
@@ -6987,6 +7074,7 @@ function getStageWildcardEntriesCount({ stage, drawDefinition }) {
|
|
|
6987
7074
|
|
|
6988
7075
|
function getStructureSeedAssignments({
|
|
6989
7076
|
provisionalPositioning,
|
|
7077
|
+
returnAllProxies,
|
|
6990
7078
|
drawDefinition,
|
|
6991
7079
|
structureId,
|
|
6992
7080
|
structure
|
|
@@ -6995,6 +7083,9 @@ function getStructureSeedAssignments({
|
|
|
6995
7083
|
if (!structure) {
|
|
6996
7084
|
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
6997
7085
|
}
|
|
7086
|
+
const positionAssignments = getPositionAssignments$1({
|
|
7087
|
+
structure
|
|
7088
|
+
}).positionAssignments;
|
|
6998
7089
|
if (error || !structure)
|
|
6999
7090
|
return { seedAssignments: [], error: STRUCTURE_NOT_FOUND };
|
|
7000
7091
|
if (!structureId)
|
|
@@ -7008,18 +7099,22 @@ function getStructureSeedAssignments({
|
|
|
7008
7099
|
structureId,
|
|
7009
7100
|
stage
|
|
7010
7101
|
});
|
|
7011
|
-
const
|
|
7102
|
+
const proxiedEntries = entries ? entries.filter((entry) => entry.placementGroup === 1).sort((a, b) => {
|
|
7012
7103
|
return a.GEMscore < b.GEMscore && 1 || a.GEMscore > b.GEMscore && -1 || 0;
|
|
7013
7104
|
}).map((entry, index) => {
|
|
7014
7105
|
const seedNumber = index + 1;
|
|
7015
7106
|
return {
|
|
7016
7107
|
participantId: entry.participantId,
|
|
7017
7108
|
seedValue: seedNumber,
|
|
7018
|
-
|
|
7019
|
-
seedProxy: true
|
|
7109
|
+
seedProxy: true,
|
|
7020
7110
|
// flag so that proxy seeding information doesn't get used externally
|
|
7111
|
+
seedNumber
|
|
7021
7112
|
};
|
|
7022
7113
|
}) : [];
|
|
7114
|
+
const seedProxies = proxiedEntries?.slice(
|
|
7115
|
+
0,
|
|
7116
|
+
returnAllProxies ? proxiedEntries.length : positionAssignments.length / 2
|
|
7117
|
+
);
|
|
7023
7118
|
if (seedProxies.length) {
|
|
7024
7119
|
seedAssignments = seedProxies;
|
|
7025
7120
|
} else if (structure.seedAssignments) {
|
|
@@ -7028,7 +7123,13 @@ function getStructureSeedAssignments({
|
|
|
7028
7123
|
error = MISSING_SEED_ASSIGNMENTS;
|
|
7029
7124
|
}
|
|
7030
7125
|
const seedLimit = structure.seedLimit || structure?.positionAssignments?.length;
|
|
7031
|
-
return {
|
|
7126
|
+
return {
|
|
7127
|
+
seedAssignments,
|
|
7128
|
+
stageSequence,
|
|
7129
|
+
seedLimit,
|
|
7130
|
+
stage,
|
|
7131
|
+
error
|
|
7132
|
+
};
|
|
7032
7133
|
}
|
|
7033
7134
|
|
|
7034
7135
|
function getExitProfiles({ drawDefinition }) {
|
|
@@ -7307,83 +7408,6 @@ function getSourceDrawPositionRanges({
|
|
|
7307
7408
|
return { sourceDrawPositionRanges };
|
|
7308
7409
|
}
|
|
7309
7410
|
|
|
7310
|
-
function getAllPositionedParticipantIds({
|
|
7311
|
-
drawDefinition
|
|
7312
|
-
}) {
|
|
7313
|
-
if (!drawDefinition)
|
|
7314
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
7315
|
-
const stagePositionedParticipantIds = {};
|
|
7316
|
-
const allPositionedParticipantIds = (drawDefinition.structures || []).map((structure) => {
|
|
7317
|
-
const stage = structure.stage;
|
|
7318
|
-
if (!stagePositionedParticipantIds[stage])
|
|
7319
|
-
stagePositionedParticipantIds[stage] = [];
|
|
7320
|
-
const { positionAssignments } = getPositionAssignments$1({ structure });
|
|
7321
|
-
const particiapntIds = positionAssignments?.map(extractAttributes("participantId")).filter(Boolean) ?? [];
|
|
7322
|
-
stagePositionedParticipantIds[stage].push(...particiapntIds);
|
|
7323
|
-
return particiapntIds;
|
|
7324
|
-
}).flat();
|
|
7325
|
-
return { allPositionedParticipantIds, stagePositionedParticipantIds };
|
|
7326
|
-
}
|
|
7327
|
-
function getPositionAssignments$1({
|
|
7328
|
-
drawDefinition,
|
|
7329
|
-
structureId,
|
|
7330
|
-
structure
|
|
7331
|
-
}) {
|
|
7332
|
-
let error, positionAssignments = [];
|
|
7333
|
-
if (!structure) {
|
|
7334
|
-
if (!drawDefinition) {
|
|
7335
|
-
return { positionAssignments, error: MISSING_DRAW_DEFINITION };
|
|
7336
|
-
}
|
|
7337
|
-
({ structure, error } = findStructure({ drawDefinition, structureId }));
|
|
7338
|
-
if (error)
|
|
7339
|
-
return { positionAssignments, error };
|
|
7340
|
-
}
|
|
7341
|
-
if (structure.structures) {
|
|
7342
|
-
positionAssignments = [].concat(
|
|
7343
|
-
...structure.structures.map((structure2) => {
|
|
7344
|
-
return getPositionAssignments$1({ structure: structure2 }).positionAssignments;
|
|
7345
|
-
})
|
|
7346
|
-
);
|
|
7347
|
-
} else if (structure.positionAssignments) {
|
|
7348
|
-
positionAssignments = structure.positionAssignments;
|
|
7349
|
-
} else {
|
|
7350
|
-
error = MISSING_POSITION_ASSIGNMENTS;
|
|
7351
|
-
}
|
|
7352
|
-
return { positionAssignments, error };
|
|
7353
|
-
}
|
|
7354
|
-
function structureAssignedDrawPositions({
|
|
7355
|
-
drawDefinition,
|
|
7356
|
-
structureId,
|
|
7357
|
-
structure
|
|
7358
|
-
}) {
|
|
7359
|
-
const positionAssignments = getPositionAssignments$1({
|
|
7360
|
-
drawDefinition,
|
|
7361
|
-
structureId,
|
|
7362
|
-
structure
|
|
7363
|
-
})?.positionAssignments || [];
|
|
7364
|
-
const assignedPositions = positionAssignments?.filter((assignment) => {
|
|
7365
|
-
return assignment.participantId ?? assignment.bye ?? assignment.qualifier;
|
|
7366
|
-
});
|
|
7367
|
-
const allPositionsAssigned = positionAssignments && positionAssignments?.length === assignedPositions?.length;
|
|
7368
|
-
const unassignedPositions = positionAssignments?.filter((assignment) => {
|
|
7369
|
-
return !assignment.participantId && !assignment.bye && !assignment.qualifier;
|
|
7370
|
-
});
|
|
7371
|
-
const byePositions = positionAssignments?.filter((assignment) => {
|
|
7372
|
-
return !assignment.participantId && assignment.bye;
|
|
7373
|
-
});
|
|
7374
|
-
const qualifierPositions = positionAssignments?.filter((assignment) => {
|
|
7375
|
-
return !assignment.participantId && assignment.qualifier;
|
|
7376
|
-
});
|
|
7377
|
-
return {
|
|
7378
|
-
allPositionsAssigned,
|
|
7379
|
-
positionAssignments,
|
|
7380
|
-
unassignedPositions,
|
|
7381
|
-
assignedPositions,
|
|
7382
|
-
qualifierPositions,
|
|
7383
|
-
byePositions
|
|
7384
|
-
};
|
|
7385
|
-
}
|
|
7386
|
-
|
|
7387
7411
|
function getOrderedDrawPositions({
|
|
7388
7412
|
drawPositions,
|
|
7389
7413
|
roundProfile,
|
|
@@ -23753,6 +23777,7 @@ function getSeedingThresholds({
|
|
|
23753
23777
|
|
|
23754
23778
|
function getValidSeedBlocks({
|
|
23755
23779
|
provisionalPositioning,
|
|
23780
|
+
returnAllProxies,
|
|
23756
23781
|
appliedPolicies,
|
|
23757
23782
|
drawDefinition,
|
|
23758
23783
|
allPositions,
|
|
@@ -23768,6 +23793,7 @@ function getValidSeedBlocks({
|
|
|
23768
23793
|
});
|
|
23769
23794
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
23770
23795
|
provisionalPositioning,
|
|
23796
|
+
returnAllProxies,
|
|
23771
23797
|
drawDefinition,
|
|
23772
23798
|
structure
|
|
23773
23799
|
});
|
|
@@ -24002,6 +24028,7 @@ function getNextSeedBlock(params) {
|
|
|
24002
24028
|
} = params;
|
|
24003
24029
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
24004
24030
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
24031
|
+
returnAllProxies: params.returnAllProxies,
|
|
24005
24032
|
provisionalPositioning,
|
|
24006
24033
|
drawDefinition,
|
|
24007
24034
|
structure
|
|
@@ -24013,6 +24040,7 @@ function getNextSeedBlock(params) {
|
|
|
24013
24040
|
const assignedDrawPositions = positionsWithParticipants?.map((assignment) => assignment.drawPosition).filter(Boolean);
|
|
24014
24041
|
const { appliedPolicies } = getAppliedPolicies({ drawDefinition });
|
|
24015
24042
|
const validSeedBlocks = seedBlockInfo?.validSeedBlocks || structure && getValidSeedBlocks({
|
|
24043
|
+
returnAllProxies: params.returnAllProxies,
|
|
24016
24044
|
provisionalPositioning,
|
|
24017
24045
|
appliedPolicies,
|
|
24018
24046
|
drawDefinition,
|
|
@@ -41569,8 +41597,7 @@ function randomUnseededSeparation({
|
|
|
41569
41597
|
structureId,
|
|
41570
41598
|
avoidance,
|
|
41571
41599
|
drawSize,
|
|
41572
|
-
entries,
|
|
41573
|
-
// entries for the specific stage of drawDefinition
|
|
41600
|
+
// entries, // entries for the specific stage of drawDefinition
|
|
41574
41601
|
event
|
|
41575
41602
|
}) {
|
|
41576
41603
|
if (!avoidance) {
|
|
@@ -41608,10 +41635,11 @@ function randomUnseededSeparation({
|
|
|
41608
41635
|
const isRoundRobin = structure?.structureType === CONTAINER;
|
|
41609
41636
|
const params = isRoundRobin ? { structure, matchUps, allDrawPositions, roundsToSeparate } : { matchUps, allDrawPositions, roundsToSeparate };
|
|
41610
41637
|
const { drawPositionGroups, drawPositionChunks } = isRoundRobin ? roundRobinParticipantGroups(params) : eliminationParticipantGroups(params);
|
|
41611
|
-
const idCollections = {
|
|
41612
|
-
|
|
41613
|
-
|
|
41614
|
-
|
|
41638
|
+
const idCollections = {
|
|
41639
|
+
groupParticipants: participants.filter((participant) => participant.participantType === GROUP).map((participant) => participant.participantId),
|
|
41640
|
+
teamParticipants: participants.filter((participant) => participant.participantType === TEAM).map((participant) => participant.participantId),
|
|
41641
|
+
pairParticipants: participants.filter((participant) => participant.participantType === PAIR).map((participant) => participant.participantId)
|
|
41642
|
+
};
|
|
41615
41643
|
const allGroups = getAttributeGroupings({
|
|
41616
41644
|
targetParticipantIds: unseededParticipantIds,
|
|
41617
41645
|
policyAttributes,
|
|
@@ -41672,8 +41700,8 @@ function randomUnseededSeparation({
|
|
|
41672
41700
|
policyAttributes,
|
|
41673
41701
|
idCollections,
|
|
41674
41702
|
allGroups,
|
|
41675
|
-
drawSize
|
|
41676
|
-
entries
|
|
41703
|
+
drawSize
|
|
41704
|
+
// entries,
|
|
41677
41705
|
})
|
|
41678
41706
|
);
|
|
41679
41707
|
const candidates = noPairPriorityCandidates.concat(...pairedPriorityCandidates).filter((candidate2) => !candidate2.errors?.length);
|
|
@@ -42043,11 +42071,11 @@ function getSeedOrderByePositions({
|
|
|
42043
42071
|
const strictSeedOrderByePositions = getOrderedByePositions({
|
|
42044
42072
|
orderedSeedDrawPositions: orderedSortedFirstRoundSeededDrawPositions,
|
|
42045
42073
|
relevantMatchUps
|
|
42046
|
-
}).slice(0,
|
|
42074
|
+
}).slice(0, byesToPlace);
|
|
42047
42075
|
const blockSeedOrderByePositions = getOrderedByePositions({
|
|
42048
42076
|
orderedSeedDrawPositions: blockSortedRandomDrawPositions,
|
|
42049
42077
|
relevantMatchUps
|
|
42050
|
-
}).slice(0,
|
|
42078
|
+
}).slice(0, byesToPlace);
|
|
42051
42079
|
return {
|
|
42052
42080
|
strictSeedOrderByePositions,
|
|
42053
42081
|
blockSeedOrderByePositions,
|
|
@@ -42729,7 +42757,6 @@ function automatedPositioning$1({
|
|
|
42729
42757
|
event
|
|
42730
42758
|
}) : void 0;
|
|
42731
42759
|
if (result2?.error) {
|
|
42732
|
-
console.log("positionByes", { result: result2 });
|
|
42733
42760
|
return handleErrorCondition(result2);
|
|
42734
42761
|
}
|
|
42735
42762
|
unseededByePositions = result2?.unseededByePositions;
|
|
@@ -42852,6 +42879,7 @@ function automatedPlayoffPositioning(params) {
|
|
|
42852
42879
|
);
|
|
42853
42880
|
const structurePositionAssignments = [];
|
|
42854
42881
|
const participants = tournamentRecord?.participants;
|
|
42882
|
+
const positioningReports = [];
|
|
42855
42883
|
if (playoffStructures) {
|
|
42856
42884
|
for (const structure of playoffStructures) {
|
|
42857
42885
|
const { structureId: playoffStructureId } = structure;
|
|
@@ -42873,9 +42901,11 @@ function automatedPlayoffPositioning(params) {
|
|
|
42873
42901
|
structureId: playoffStructureId
|
|
42874
42902
|
});
|
|
42875
42903
|
}
|
|
42904
|
+
if (result.positioningReport)
|
|
42905
|
+
positioningReports.push(result.positioningReport);
|
|
42876
42906
|
}
|
|
42877
42907
|
}
|
|
42878
|
-
return { ...SUCCESS, structurePositionAssignments };
|
|
42908
|
+
return { ...SUCCESS, structurePositionAssignments, positioningReports };
|
|
42879
42909
|
}
|
|
42880
42910
|
|
|
42881
42911
|
function generateAndPopulateRRplayoffStructures(params) {
|
|
@@ -43538,9 +43568,15 @@ function getStructureGroups({
|
|
|
43538
43568
|
}
|
|
43539
43569
|
|
|
43540
43570
|
function generateQualifyingStructure$1(params) {
|
|
43541
|
-
if (!params.drawDefinition)
|
|
43542
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
43543
43571
|
const stack = "generateQualifyingStructure";
|
|
43572
|
+
if (!params.drawDefinition)
|
|
43573
|
+
return decorateResult({
|
|
43574
|
+
result: { error: MISSING_DRAW_DEFINITION },
|
|
43575
|
+
stack
|
|
43576
|
+
});
|
|
43577
|
+
if (params.drawSize && !isConvertableInteger(params.drawSize) || params.participantsCount && !isConvertableInteger(params.participantsCount) || params.qualifyingPositions && !isConvertableInteger(params.qualifyingPositions)) {
|
|
43578
|
+
return decorateResult({ result: { error: INVALID_VALUES }, stack });
|
|
43579
|
+
}
|
|
43544
43580
|
let drawSize = params.drawSize ?? coerceEven(params.participantsCount);
|
|
43545
43581
|
const {
|
|
43546
43582
|
qualifyingRoundNumber,
|
|
@@ -43558,13 +43594,22 @@ function generateQualifyingStructure$1(params) {
|
|
|
43558
43594
|
isMock,
|
|
43559
43595
|
uuids
|
|
43560
43596
|
} = params;
|
|
43597
|
+
if (!params.drawSize)
|
|
43598
|
+
return decorateResult({
|
|
43599
|
+
result: { error: MISSING_DRAW_SIZE },
|
|
43600
|
+
context: { drawSize },
|
|
43601
|
+
stack
|
|
43602
|
+
});
|
|
43603
|
+
if (qualifyingPositions && qualifyingPositions >= params.drawSize)
|
|
43604
|
+
return decorateResult({
|
|
43605
|
+
result: { error: INVALID_VALUES },
|
|
43606
|
+
context: { drawSize, qualifyingPositions },
|
|
43607
|
+
stack
|
|
43608
|
+
});
|
|
43561
43609
|
let roundLimit, roundsCount, structure, matchUps;
|
|
43562
43610
|
let qualifiersCount = 0;
|
|
43563
43611
|
let finishingPositions;
|
|
43564
43612
|
const stageSequence = 1;
|
|
43565
|
-
if (!isConvertableInteger(drawSize)) {
|
|
43566
|
-
return decorateResult({ result: { error: MISSING_DRAW_SIZE }, stack });
|
|
43567
|
-
}
|
|
43568
43613
|
const { structureProfiles } = getStructureGroups({ drawDefinition });
|
|
43569
43614
|
const structureProfile = structureProfiles[targetStructureId];
|
|
43570
43615
|
if (!structureProfile) {
|
|
@@ -43650,6 +43695,19 @@ function generateQualifyingStructure$1(params) {
|
|
|
43650
43695
|
};
|
|
43651
43696
|
}
|
|
43652
43697
|
|
|
43698
|
+
function resequenceStructures({ drawDefinition }) {
|
|
43699
|
+
const { maxQualifyingDepth, structureProfiles } = getStructureGroups({
|
|
43700
|
+
drawDefinition
|
|
43701
|
+
});
|
|
43702
|
+
for (const structure of drawDefinition.structures) {
|
|
43703
|
+
const profile = structureProfiles[structure.structureId];
|
|
43704
|
+
if (profile.distanceFromMain) {
|
|
43705
|
+
structure.stageSequence = maxQualifyingDepth + 1 - profile.distanceFromMain;
|
|
43706
|
+
}
|
|
43707
|
+
}
|
|
43708
|
+
return { ...SUCCESS };
|
|
43709
|
+
}
|
|
43710
|
+
|
|
43653
43711
|
function attachQualifyingStructure$1({
|
|
43654
43712
|
drawDefinition,
|
|
43655
43713
|
tournamentId,
|
|
@@ -43680,15 +43738,7 @@ function attachQualifyingStructure$1({
|
|
|
43680
43738
|
drawDefinition.links = [];
|
|
43681
43739
|
drawDefinition.structures.push(structure);
|
|
43682
43740
|
drawDefinition.links.push(link);
|
|
43683
|
-
|
|
43684
|
-
drawDefinition
|
|
43685
|
-
});
|
|
43686
|
-
for (const structure2 of drawDefinition.structures) {
|
|
43687
|
-
const profile = structureProfiles[structure2.structureId];
|
|
43688
|
-
if (profile.distanceFromMain) {
|
|
43689
|
-
structure2.stageSequence = maxQualifyingDepth + 1 - profile.distanceFromMain;
|
|
43690
|
-
}
|
|
43691
|
-
}
|
|
43741
|
+
resequenceStructures({ drawDefinition });
|
|
43692
43742
|
const matchUps = getAllStructureMatchUps({ structure })?.matchUps || [];
|
|
43693
43743
|
addMatchUpsNotice({
|
|
43694
43744
|
drawDefinition,
|
|
@@ -44199,7 +44249,8 @@ function removeStructure({
|
|
|
44199
44249
|
tournamentRecord,
|
|
44200
44250
|
drawDefinition,
|
|
44201
44251
|
structureId,
|
|
44202
|
-
event
|
|
44252
|
+
event,
|
|
44253
|
+
force
|
|
44203
44254
|
}) {
|
|
44204
44255
|
if (typeof structureId !== "string")
|
|
44205
44256
|
return { error: INVALID_VALUES };
|
|
@@ -44209,10 +44260,21 @@ function removeStructure({
|
|
|
44209
44260
|
return { error: MISSING_STRUCTURE_ID };
|
|
44210
44261
|
const structures = drawDefinition.structures || [];
|
|
44211
44262
|
const removedStructureIds = [];
|
|
44263
|
+
const structure = structures.find(
|
|
44264
|
+
(structure2) => structure2.structureId === structureId
|
|
44265
|
+
);
|
|
44266
|
+
if (!structure)
|
|
44267
|
+
return { error: STRUCTURE_NOT_FOUND };
|
|
44268
|
+
const structureMatchUps = getAllStructureMatchUps({ structure }).matchUps;
|
|
44269
|
+
const scoresPresent = structureMatchUps.some(
|
|
44270
|
+
({ score }) => scoreHasValue({ score })
|
|
44271
|
+
);
|
|
44272
|
+
if (scoresPresent && !force)
|
|
44273
|
+
return { error: SCORES_PRESENT };
|
|
44212
44274
|
const mainStageSequence1 = structures.find(
|
|
44213
44275
|
({ stage, stageSequence }) => stage === MAIN && stageSequence === 1
|
|
44214
44276
|
);
|
|
44215
|
-
const isMainStageSequence1 = structureId === mainStageSequence1
|
|
44277
|
+
const isMainStageSequence1 = structureId === mainStageSequence1?.structureId;
|
|
44216
44278
|
const qualifyingStructureIds = structures.filter(({ stage }) => stage === QUALIFYING).map(extractAttributes("structureId"));
|
|
44217
44279
|
if (isMainStageSequence1 && !qualifyingStructureIds.length) {
|
|
44218
44280
|
return { error: CANNOT_REMOVE_MAIN_STRUCTURE };
|
|
@@ -44221,11 +44283,11 @@ function removeStructure({
|
|
|
44221
44283
|
const removedMatchUpIds = [];
|
|
44222
44284
|
const idsToRemove = [structureId];
|
|
44223
44285
|
const getTargetedStructureIds = (structureId2) => drawDefinition.links?.map(
|
|
44224
|
-
(link) => link.source.structureId === structureId2 && link.target.structureId !== mainStageSequence1
|
|
44225
|
-
).filter(Boolean);
|
|
44286
|
+
(link) => link.source.structureId === structureId2 && link.target.structureId !== mainStageSequence1?.structureId && link.target.structureId
|
|
44287
|
+
).filter(Boolean) ?? [];
|
|
44226
44288
|
const getQualifyingSourceStructureIds = (structureId2) => drawDefinition.links?.map(
|
|
44227
44289
|
(link) => qualifyingStructureIds.includes(link.source.structureId) && link.target.structureId === structureId2 && link.source.structureId
|
|
44228
|
-
).filter(Boolean);
|
|
44290
|
+
).filter(Boolean) ?? [];
|
|
44229
44291
|
const isQualifyingStructure = qualifyingStructureIds.includes(structureId);
|
|
44230
44292
|
const relatedStructureIdsMap = /* @__PURE__ */ new Map();
|
|
44231
44293
|
structureIds.forEach(
|
|
@@ -44236,11 +44298,11 @@ function removeStructure({
|
|
|
44236
44298
|
);
|
|
44237
44299
|
while (idsToRemove.length) {
|
|
44238
44300
|
const idBeingRemoved = idsToRemove.pop();
|
|
44239
|
-
const { structure } = findStructure({
|
|
44301
|
+
const { structure: structure2 } = findStructure({
|
|
44240
44302
|
structureId: idBeingRemoved,
|
|
44241
44303
|
drawDefinition
|
|
44242
44304
|
});
|
|
44243
|
-
const { matchUps: matchUps2 } = getAllStructureMatchUps({ structure });
|
|
44305
|
+
const { matchUps: matchUps2 } = getAllStructureMatchUps({ structure: structure2 });
|
|
44244
44306
|
const matchUpIds = getMatchUpIds(matchUps2);
|
|
44245
44307
|
removedMatchUpIds.push(...matchUpIds);
|
|
44246
44308
|
drawDefinition.links = drawDefinition.links?.filter(
|
|
@@ -44248,10 +44310,10 @@ function removeStructure({
|
|
|
44248
44310
|
) || [];
|
|
44249
44311
|
if (!isMainStageSequence1 || idBeingRemoved !== structureId) {
|
|
44250
44312
|
drawDefinition.structures = (drawDefinition.structures ?? []).filter(
|
|
44251
|
-
(
|
|
44252
|
-
if (idBeingRemoved && idBeingRemoved ===
|
|
44313
|
+
(structure3) => {
|
|
44314
|
+
if (idBeingRemoved && idBeingRemoved === structure3.structureId)
|
|
44253
44315
|
removedStructureIds.push(idBeingRemoved);
|
|
44254
|
-
return
|
|
44316
|
+
return structure3.structureId !== idBeingRemoved;
|
|
44255
44317
|
}
|
|
44256
44318
|
);
|
|
44257
44319
|
}
|
|
@@ -44259,7 +44321,7 @@ function removeStructure({
|
|
|
44259
44321
|
relatedStructureIdsMap.get(idBeingRemoved)?.filter(
|
|
44260
44322
|
(id) => (
|
|
44261
44323
|
// IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
|
|
44262
|
-
id !== mainStageSequence1
|
|
44324
|
+
id !== mainStageSequence1?.structureId || structureId === mainStageSequence1.structureId
|
|
44263
44325
|
)
|
|
44264
44326
|
);
|
|
44265
44327
|
if (targetedStructureIds?.length)
|
|
@@ -44282,6 +44344,7 @@ function removeStructure({
|
|
|
44282
44344
|
mainStageSequence1.extensions = [];
|
|
44283
44345
|
}
|
|
44284
44346
|
}
|
|
44347
|
+
isQualifyingStructure && resequenceStructures({ drawDefinition });
|
|
44285
44348
|
deleteMatchUpsNotice({
|
|
44286
44349
|
tournamentId: tournamentRecord?.tournamentId,
|
|
44287
44350
|
matchUpIds: removedMatchUpIds,
|
|
@@ -47906,6 +47969,7 @@ function getValidAssignmentActions({
|
|
|
47906
47969
|
if (!ignoreSeedPositions) {
|
|
47907
47970
|
const result = getNextSeedBlock({
|
|
47908
47971
|
provisionalPositioning,
|
|
47972
|
+
returnAllProxies: true,
|
|
47909
47973
|
randomize: true,
|
|
47910
47974
|
drawDefinition,
|
|
47911
47975
|
structureId,
|
|
@@ -48431,6 +48495,7 @@ function positionActions$1(params) {
|
|
|
48431
48495
|
action: SEED_VALUE
|
|
48432
48496
|
}) && isAvailableAction({ policyActions, action: SEED_VALUE }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
|
|
48433
48497
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
48498
|
+
returnAllProxies: true,
|
|
48434
48499
|
drawDefinition,
|
|
48435
48500
|
structure
|
|
48436
48501
|
});
|
|
@@ -48457,6 +48522,7 @@ function positionActions$1(params) {
|
|
|
48457
48522
|
action: REMOVE_SEED
|
|
48458
48523
|
}) && isAvailableAction({ policyActions, action: REMOVE_SEED }) && isValidSeedPosition({ drawDefinition, structureId, drawPosition }) && validToAssignSeed) {
|
|
48459
48524
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
48525
|
+
returnAllProxies: true,
|
|
48460
48526
|
drawDefinition,
|
|
48461
48527
|
structure
|
|
48462
48528
|
});
|