tods-competition-factory 1.2.21 → 1.2.22
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/query.mjs +64 -56
- package/dist/forge/query.mjs.map +1 -1
- package/dist/index.mjs +65 -57
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +86 -72
- 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/forge/query.mjs
CHANGED
|
@@ -14221,6 +14221,52 @@ function positionActions(params) {
|
|
|
14221
14221
|
|
|
14222
14222
|
const hasParticipantId = (o) => o == null ? void 0 : o.participantId;
|
|
14223
14223
|
|
|
14224
|
+
function getStructureGroups({ drawDefinition }) {
|
|
14225
|
+
const links = drawDefinition.links || [];
|
|
14226
|
+
const sourceStructureIds = {};
|
|
14227
|
+
let linkedStructureIds = links.map((link) => {
|
|
14228
|
+
const sourceId = link.source.structureId;
|
|
14229
|
+
const targetId = link.target.structureId;
|
|
14230
|
+
sourceStructureIds[targetId] = unique([
|
|
14231
|
+
...sourceStructureIds[targetId] || [],
|
|
14232
|
+
sourceId
|
|
14233
|
+
]).filter(Boolean);
|
|
14234
|
+
return [link.source.structureId, link.target.structureId];
|
|
14235
|
+
});
|
|
14236
|
+
const iterations = linkedStructureIds.length;
|
|
14237
|
+
generateRange(0, Math.ceil(iterations / 2)).forEach(() => {
|
|
14238
|
+
linkedStructureIds = generateRange(0, iterations).map((index) => {
|
|
14239
|
+
const structureIds = linkedStructureIds[index];
|
|
14240
|
+
const mergedWithOverlappingIds = linkedStructureIds.reduce((biggest, ids) => {
|
|
14241
|
+
const hasOverlap = overlap(structureIds, ids);
|
|
14242
|
+
return hasOverlap ? biggest.concat(...ids) : biggest;
|
|
14243
|
+
}, []) || [];
|
|
14244
|
+
return unique(structureIds.concat(...mergedWithOverlappingIds));
|
|
14245
|
+
});
|
|
14246
|
+
});
|
|
14247
|
+
const groupedStructureIds = linkedStructureIds[0];
|
|
14248
|
+
const identityLink = (a, b) => intersection(a, b).length === a.length;
|
|
14249
|
+
const allLinkStructuresLinked = linkedStructureIds.slice(1).reduce((allLinkStructuresLinked2, ids) => {
|
|
14250
|
+
return allLinkStructuresLinked2 && identityLink(ids, groupedStructureIds);
|
|
14251
|
+
}, true);
|
|
14252
|
+
const structureGroups = [groupedStructureIds].filter(Boolean);
|
|
14253
|
+
const linkCheck = [groupedStructureIds].filter(Boolean);
|
|
14254
|
+
const structures = drawDefinition.structures || [];
|
|
14255
|
+
structures.forEach((structure) => {
|
|
14256
|
+
const { structureId, stage } = structure;
|
|
14257
|
+
const existingGroup = structureGroups.find((group) => {
|
|
14258
|
+
return group.includes(structureId);
|
|
14259
|
+
});
|
|
14260
|
+
if (!existingGroup) {
|
|
14261
|
+
structureGroups.push([structureId]);
|
|
14262
|
+
if (stage !== VOLUNTARY_CONSOLATION)
|
|
14263
|
+
linkCheck.push(structureId);
|
|
14264
|
+
}
|
|
14265
|
+
});
|
|
14266
|
+
const allStructuresLinked = allLinkStructuresLinked && linkCheck.length === 1;
|
|
14267
|
+
return { structureGroups, allStructuresLinked, sourceStructureIds };
|
|
14268
|
+
}
|
|
14269
|
+
|
|
14224
14270
|
var __defProp$3 = Object.defineProperty;
|
|
14225
14271
|
var __defProps$3 = Object.defineProperties;
|
|
14226
14272
|
var __getOwnPropDescs$3 = Object.getOwnPropertyDescriptors;
|
|
@@ -14268,7 +14314,7 @@ function getDrawData({
|
|
|
14268
14314
|
drawId
|
|
14269
14315
|
}))(drawDefinition);
|
|
14270
14316
|
let mainStageSeedAssignments, qualificationStageSeedAssignments;
|
|
14271
|
-
const { structureGroups, allStructuresLinked } = getStructureGroups({
|
|
14317
|
+
const { structureGroups, allStructuresLinked, sourceStructureIds } = getStructureGroups({
|
|
14272
14318
|
drawDefinition
|
|
14273
14319
|
});
|
|
14274
14320
|
if (!allStructuresLinked) {
|
|
@@ -14278,6 +14324,7 @@ function getDrawData({
|
|
|
14278
14324
|
let drawActive = false;
|
|
14279
14325
|
let participantPlacements = false;
|
|
14280
14326
|
const groupedStructures = structureGroups.map((structureIds) => {
|
|
14327
|
+
const completedStructures = {};
|
|
14281
14328
|
const structures2 = structureIds.map((structureId) => {
|
|
14282
14329
|
const { structure } = findStructure({ drawDefinition, structureId });
|
|
14283
14330
|
const { seedAssignments } = getStructureSeedAssignments({
|
|
@@ -14345,6 +14392,7 @@ function getDrawData({
|
|
|
14345
14392
|
matchUpFormat,
|
|
14346
14393
|
positionAssignments: positionAssignments2
|
|
14347
14394
|
}))(structure);
|
|
14395
|
+
structureInfo.sourceStructureIds = sourceStructureIds[structureId];
|
|
14348
14396
|
structureInfo.structureActive = matchUps.reduce((active, matchUp) => {
|
|
14349
14397
|
var _a2;
|
|
14350
14398
|
const activeMatchUpStatus = [
|
|
@@ -14359,19 +14407,13 @@ function getDrawData({
|
|
|
14359
14407
|
].includes(matchUp.matchUpStatus);
|
|
14360
14408
|
return active || activeMatchUpStatus || !!matchUp.winningSide || !!((_a2 = matchUp.score) == null ? void 0 : _a2.scoreStringSide1);
|
|
14361
14409
|
}, false);
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
DEFAULTED,
|
|
14370
|
-
ABANDONED
|
|
14371
|
-
].includes(matchUp.matchUpStatus);
|
|
14372
|
-
},
|
|
14373
|
-
!!matchUps.length
|
|
14374
|
-
);
|
|
14410
|
+
const structureCompleted = matchUps.reduce((completed, matchUp) => {
|
|
14411
|
+
return completed && [BYE, COMPLETED, RETIRED, WALKOVER$1, DEFAULTED, ABANDONED].includes(
|
|
14412
|
+
matchUp.matchUpStatus
|
|
14413
|
+
);
|
|
14414
|
+
}, !!matchUps.length);
|
|
14415
|
+
structureInfo.structureCompleted = structureCompleted;
|
|
14416
|
+
completedStructures[structureId] = structureCompleted;
|
|
14375
14417
|
if (structureInfo.structureActive)
|
|
14376
14418
|
drawActive = true;
|
|
14377
14419
|
return __spreadProps$3(__spreadValues$3({}, structureInfo), {
|
|
@@ -14382,9 +14424,14 @@ function getDrawData({
|
|
|
14382
14424
|
structureId
|
|
14383
14425
|
});
|
|
14384
14426
|
});
|
|
14385
|
-
|
|
14386
|
-
|
|
14387
|
-
|
|
14427
|
+
structures2.forEach((structure) => {
|
|
14428
|
+
var _a;
|
|
14429
|
+
if (!includePositionAssignments)
|
|
14430
|
+
delete structure.positionAssignments;
|
|
14431
|
+
structure.sourceStructuresComplete = (_a = structure.sourceStructureIds) == null ? void 0 : _a.every(
|
|
14432
|
+
(id) => completedStructures[id]
|
|
14433
|
+
);
|
|
14434
|
+
});
|
|
14388
14435
|
return structures2;
|
|
14389
14436
|
});
|
|
14390
14437
|
const structures = groupedStructures.flat();
|
|
@@ -14402,45 +14449,6 @@ function getDrawData({
|
|
|
14402
14449
|
drawInfo: noDeepCopy ? drawInfo : makeDeepCopy(drawInfo, false, true)
|
|
14403
14450
|
}, SUCCESS);
|
|
14404
14451
|
}
|
|
14405
|
-
function getStructureGroups({ drawDefinition }) {
|
|
14406
|
-
const links = drawDefinition.links || [];
|
|
14407
|
-
let linkedStructureIds = links.map((link) => [
|
|
14408
|
-
link.source.structureId,
|
|
14409
|
-
link.target.structureId
|
|
14410
|
-
]);
|
|
14411
|
-
const iterations = linkedStructureIds.length;
|
|
14412
|
-
generateRange(0, Math.ceil(iterations / 2)).forEach(() => {
|
|
14413
|
-
linkedStructureIds = generateRange(0, iterations).map((index) => {
|
|
14414
|
-
const structureIds = linkedStructureIds[index];
|
|
14415
|
-
const mergedWithOverlappingIds = linkedStructureIds.reduce((biggest, ids) => {
|
|
14416
|
-
const hasOverlap = overlap(structureIds, ids);
|
|
14417
|
-
return hasOverlap ? biggest.concat(...ids) : biggest;
|
|
14418
|
-
}, []) || [];
|
|
14419
|
-
return unique(structureIds.concat(...mergedWithOverlappingIds));
|
|
14420
|
-
});
|
|
14421
|
-
});
|
|
14422
|
-
const groupedStructureIds = linkedStructureIds[0];
|
|
14423
|
-
const identityLink = (a, b) => intersection(a, b).length === a.length;
|
|
14424
|
-
const allLinkStructuresLinked = linkedStructureIds.slice(1).reduce((allLinkStructuresLinked2, ids) => {
|
|
14425
|
-
return allLinkStructuresLinked2 && identityLink(ids, groupedStructureIds);
|
|
14426
|
-
}, true);
|
|
14427
|
-
const structureGroups = [groupedStructureIds].filter(Boolean);
|
|
14428
|
-
const linkCheck = [groupedStructureIds].filter(Boolean);
|
|
14429
|
-
const structures = drawDefinition.structures || [];
|
|
14430
|
-
structures.forEach((structure) => {
|
|
14431
|
-
const { structureId, stage } = structure;
|
|
14432
|
-
const existingGroup = structureGroups.find((group) => {
|
|
14433
|
-
return group.includes(structureId);
|
|
14434
|
-
});
|
|
14435
|
-
if (!existingGroup) {
|
|
14436
|
-
structureGroups.push([structureId]);
|
|
14437
|
-
if (stage !== VOLUNTARY_CONSOLATION)
|
|
14438
|
-
linkCheck.push(structureId);
|
|
14439
|
-
}
|
|
14440
|
-
});
|
|
14441
|
-
const allStructuresLinked = allLinkStructuresLinked && linkCheck.length === 1;
|
|
14442
|
-
return { structureGroups, allStructuresLinked };
|
|
14443
|
-
}
|
|
14444
14452
|
|
|
14445
14453
|
var __defProp$2 = Object.defineProperty;
|
|
14446
14454
|
var __defProps$2 = Object.defineProperties;
|