tods-competition-factory 1.6.23 → 1.6.25
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 +3 -1
- package/dist/forge/generate.mjs +2 -2
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +3 -1
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.d.ts +3 -1
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +67 -23
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +104 -47
- 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 +5 -5
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.6.
|
|
365
|
+
return '1.6.25';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -639,6 +639,9 @@ function shuffleArray(arr) {
|
|
|
639
639
|
.sort(function (a, b) { return a[0] - b[0]; })
|
|
640
640
|
.map(function (a) { return a[1]; });
|
|
641
641
|
}
|
|
642
|
+
function numericSortValue(v) {
|
|
643
|
+
return isConvertableInteger(v) ? v : Infinity;
|
|
644
|
+
}
|
|
642
645
|
// return an object whose attributes are values and whose values are counts for values
|
|
643
646
|
// e.g. values=[1,2,2,3,4,4,5] produces { 1: 1, 2: 2, 3: 1, 4: 2, 5: 1}
|
|
644
647
|
function instanceCount(values) {
|
|
@@ -4827,6 +4830,7 @@ var POLICY_TYPE_PARTICIPANT = 'participant';
|
|
|
4827
4830
|
var POLICY_TYPE_PROGRESSION = 'progression';
|
|
4828
4831
|
var POLICY_TYPE_SCHEDULING = 'scheduling';
|
|
4829
4832
|
var POLICY_TYPE_AVOIDANCE = 'avoidance';
|
|
4833
|
+
var POLICY_TYPE_DISPLAY = 'display'; // storage for client type displays, e.g. { public: {}, admin: {} }
|
|
4830
4834
|
var POLICY_TYPE_SCORING = 'scoring';
|
|
4831
4835
|
var POLICY_TYPE_SEEDING = 'seeding';
|
|
4832
4836
|
var POLICY_TYPE_FEED_IN = 'feedIn';
|
|
@@ -4844,6 +4848,7 @@ var policyConstants = {
|
|
|
4844
4848
|
POLICY_TYPE_PROGRESSION: POLICY_TYPE_PROGRESSION,
|
|
4845
4849
|
POLICY_TYPE_SCHEDULING: POLICY_TYPE_SCHEDULING,
|
|
4846
4850
|
POLICY_TYPE_AVOIDANCE: POLICY_TYPE_AVOIDANCE,
|
|
4851
|
+
POLICY_TYPE_DISPLAY: POLICY_TYPE_DISPLAY,
|
|
4847
4852
|
POLICY_TYPE_FEED_IN: POLICY_TYPE_FEED_IN,
|
|
4848
4853
|
POLICY_TYPE_SCORING: POLICY_TYPE_SCORING,
|
|
4849
4854
|
POLICY_TYPE_SEEDING: POLICY_TYPE_SEEDING,
|
|
@@ -39197,7 +39202,7 @@ function addCourts$1(_a) {
|
|
|
39197
39202
|
|
|
39198
39203
|
function modifyVenue$1(_a) {
|
|
39199
39204
|
var e_1, _b;
|
|
39200
|
-
var _c, _d, _e, _f;
|
|
39205
|
+
var _c, _d, _e, _f, _g;
|
|
39201
39206
|
var tournamentRecord = _a.tournamentRecord, modifications = _a.modifications, venueId = _a.venueId, force = _a.force;
|
|
39202
39207
|
if (!tournamentRecord)
|
|
39203
39208
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -39225,25 +39230,25 @@ function modifyVenue$1(_a) {
|
|
|
39225
39230
|
var _a;
|
|
39226
39231
|
return Object.assign(venue, (_a = {}, _a[attribute] = modifications[attribute], _a));
|
|
39227
39232
|
});
|
|
39228
|
-
var existingCourtIds = ((_c = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _c === void 0 ? void 0 : _c.map(function (court) { return court.courtId; }))
|
|
39229
|
-
var courtIdsToModify = ((
|
|
39233
|
+
var existingCourtIds = (_d = (_c = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _c === void 0 ? void 0 : _c.map(function (court) { return court.courtId; })) !== null && _d !== void 0 ? _d : [];
|
|
39234
|
+
var courtIdsToModify = ((_e = modifications.courts) === null || _e === void 0 ? void 0 : _e.map(function (court) { return court.courtId; })) || [];
|
|
39230
39235
|
var courtIdsToDelete = existingCourtIds.filter(function (courtId) { return !courtIdsToModify.includes(courtId); });
|
|
39231
39236
|
if (courtIdsToDelete.length) {
|
|
39232
|
-
var courtsToDelete = (
|
|
39237
|
+
var courtsToDelete = (_f = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _f === void 0 ? void 0 : _f.filter(function (court) {
|
|
39233
39238
|
return courtIdsToDelete.includes(court.courtId);
|
|
39234
39239
|
});
|
|
39235
39240
|
var scheduleDeletionsCount = courtsToDelete === null || courtsToDelete === void 0 ? void 0 : courtsToDelete.map(function (court) {
|
|
39236
|
-
var _a;
|
|
39241
|
+
var _a, _b;
|
|
39237
39242
|
// check whether deleting court would remove schedule from any matchUps
|
|
39238
39243
|
var result = getScheduledCourtMatchUps({
|
|
39239
39244
|
courtId: court.courtId,
|
|
39240
39245
|
tournamentRecord: tournamentRecord,
|
|
39241
39246
|
venueMatchUps: venueMatchUps,
|
|
39242
39247
|
});
|
|
39243
|
-
return ((_a = result.matchUps) === null || _a === void 0 ? void 0 : _a.length)
|
|
39248
|
+
return (_b = (_a = result.matchUps) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
39244
39249
|
}).reduce(function (a, b) { return a + b; });
|
|
39245
39250
|
if (venue && (!scheduleDeletionsCount || force)) {
|
|
39246
|
-
venue.courts = (
|
|
39251
|
+
venue.courts = (_g = venue.courts) === null || _g === void 0 ? void 0 : _g.filter(function (court) {
|
|
39247
39252
|
return courtIdsToModify.includes(court.courtId);
|
|
39248
39253
|
});
|
|
39249
39254
|
}
|
|
@@ -39255,8 +39260,8 @@ function modifyVenue$1(_a) {
|
|
|
39255
39260
|
}
|
|
39256
39261
|
if (modifications.courts) {
|
|
39257
39262
|
try {
|
|
39258
|
-
for (var
|
|
39259
|
-
var court =
|
|
39263
|
+
for (var _h = __values(modifications.courts), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
39264
|
+
var court = _j.value;
|
|
39260
39265
|
var courtId = (court || {}).courtId;
|
|
39261
39266
|
var result_1 = modifyCourt$1({
|
|
39262
39267
|
modifications: court,
|
|
@@ -39281,7 +39286,7 @@ function modifyVenue$1(_a) {
|
|
|
39281
39286
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
39282
39287
|
finally {
|
|
39283
39288
|
try {
|
|
39284
|
-
if (
|
|
39289
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
39285
39290
|
}
|
|
39286
39291
|
finally { if (e_1) throw e_1.error; }
|
|
39287
39292
|
}
|
|
@@ -45660,6 +45665,29 @@ function deleteAdHocMatchUps$1(_a) {
|
|
|
45660
45665
|
return __assign({}, SUCCESS);
|
|
45661
45666
|
}
|
|
45662
45667
|
|
|
45668
|
+
function setStructureOrder(_a) {
|
|
45669
|
+
var drawDefinition = _a.drawDefinition, orderMap = _a.orderMap;
|
|
45670
|
+
if (!drawDefinition)
|
|
45671
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
45672
|
+
if (typeof orderMap !== 'object' ||
|
|
45673
|
+
!Object.values(orderMap).every(function (val) { return isConvertableInteger(val); }))
|
|
45674
|
+
decorateResult({
|
|
45675
|
+
result: { error: INVALID_VALUES },
|
|
45676
|
+
context: { orderMap: orderMap },
|
|
45677
|
+
});
|
|
45678
|
+
if (!drawDefinition.structures)
|
|
45679
|
+
drawDefinition.structures = [];
|
|
45680
|
+
drawDefinition.structures.forEach(function (structure) {
|
|
45681
|
+
var structureOrder = orderMap[structure.structureId];
|
|
45682
|
+
if (structureOrder)
|
|
45683
|
+
structure.structureOrder = structureOrder;
|
|
45684
|
+
});
|
|
45685
|
+
drawDefinition.structures.sort(function (a, b) {
|
|
45686
|
+
return numericSortValue(a.structureOrder) - numericSortValue(b.structureOrder);
|
|
45687
|
+
});
|
|
45688
|
+
return __assign({}, SUCCESS);
|
|
45689
|
+
}
|
|
45690
|
+
|
|
45663
45691
|
function renameStructures$1(_a) {
|
|
45664
45692
|
var e_1, _b;
|
|
45665
45693
|
var drawDefinition = _a.drawDefinition, structureDetails = _a.structureDetails;
|
|
@@ -45929,6 +45957,7 @@ var structureGovernor = {
|
|
|
45929
45957
|
generateAndPopulatePlayoffStructures: generateAndPopulatePlayoffStructures,
|
|
45930
45958
|
attachPlayoffStructures: attachPlayoffStructures$1,
|
|
45931
45959
|
addPlayoffStructures: addPlayoffStructures$1,
|
|
45960
|
+
setStructureOrder: setStructureOrder,
|
|
45932
45961
|
renameStructures: renameStructures$1,
|
|
45933
45962
|
generateQualifyingStructure: generateQualifyingStructure$1,
|
|
45934
45963
|
attachQualifyingStructure: attachQualifyingStructure$1,
|
|
@@ -48143,11 +48172,15 @@ function eliminationSwap(_a) {
|
|
|
48143
48172
|
return qualifier;
|
|
48144
48173
|
}).length === 2)
|
|
48145
48174
|
return __assign({}, SUCCESS);
|
|
48175
|
+
var isQualifierSwap = assignments.some(function (_a) {
|
|
48176
|
+
var qualifier = _a.qualifier;
|
|
48177
|
+
return qualifier;
|
|
48178
|
+
});
|
|
48146
48179
|
var isByeSwap = assignments.some(function (_a) {
|
|
48147
48180
|
var bye = _a.bye;
|
|
48148
48181
|
return bye;
|
|
48149
48182
|
});
|
|
48150
|
-
if (isByeSwap) {
|
|
48183
|
+
if (isByeSwap && !isQualifierSwap) {
|
|
48151
48184
|
return swapParticipantIdWithBYE({
|
|
48152
48185
|
inContextDrawMatchUps: inContextDrawMatchUps,
|
|
48153
48186
|
tournamentRecord: tournamentRecord,
|
|
@@ -48159,7 +48192,7 @@ function eliminationSwap(_a) {
|
|
|
48159
48192
|
});
|
|
48160
48193
|
}
|
|
48161
48194
|
else {
|
|
48162
|
-
return
|
|
48195
|
+
return eliminationPosiitonSwap({
|
|
48163
48196
|
inContextDrawMatchUps: inContextDrawMatchUps,
|
|
48164
48197
|
tournamentRecord: tournamentRecord,
|
|
48165
48198
|
drawDefinition: drawDefinition,
|
|
@@ -48228,7 +48261,7 @@ function swapParticipantIdWithBYE(_a) {
|
|
|
48228
48261
|
return result;
|
|
48229
48262
|
return __assign({}, SUCCESS);
|
|
48230
48263
|
}
|
|
48231
|
-
function
|
|
48264
|
+
function eliminationPosiitonSwap(_a) {
|
|
48232
48265
|
var inContextDrawMatchUps = _a.inContextDrawMatchUps, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, assignments = _a.assignments, matchUpsMap = _a.matchUpsMap, structure = _a.structure, event = _a.event;
|
|
48233
48266
|
// preserves order of drawPositions in original positionAssignments array
|
|
48234
48267
|
// while insuring that all attributes are faithfully copied over and only drawPosition is swapped
|
|
@@ -48280,11 +48313,15 @@ function roundRobinSwap(_a) {
|
|
|
48280
48313
|
structure: structure,
|
|
48281
48314
|
event: event,
|
|
48282
48315
|
});
|
|
48316
|
+
var isQualifierSwap = assignments.some(function (_a) {
|
|
48317
|
+
var qualifier = _a.qualifier;
|
|
48318
|
+
return qualifier;
|
|
48319
|
+
});
|
|
48283
48320
|
var isByeSwap = assignments.some(function (_a) {
|
|
48284
48321
|
var bye = _a.bye;
|
|
48285
48322
|
return bye;
|
|
48286
48323
|
});
|
|
48287
|
-
if (isByeSwap) {
|
|
48324
|
+
if (isByeSwap && !isQualifierSwap) {
|
|
48288
48325
|
swapParticipantIdWithBYE({
|
|
48289
48326
|
inContextDrawMatchUps: inContextDrawMatchUps,
|
|
48290
48327
|
tournamentRecord: tournamentRecord,
|
|
@@ -48541,8 +48578,8 @@ var DEFAULT_RATING = 0;
|
|
|
48541
48578
|
var MAX_ITERATIONS = 5000;
|
|
48542
48579
|
function generateDrawMaticRound(_a) {
|
|
48543
48580
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
48544
|
-
var _e;
|
|
48545
|
-
var
|
|
48581
|
+
var _e, _f;
|
|
48582
|
+
var _g = _a.maxIterations, maxIterations = _g === void 0 ? MAX_ITERATIONS : _g, _h = _a.generateMatchUps, generateMatchUps = _h === void 0 ? true : _h, tournamentParticipants = _a.tournamentParticipants, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds, addToStructure = _a.addToStructure, drawDefinition = _a.drawDefinition, adHocRatings = _a.adHocRatings, structureId = _a.structureId, matchUpIds = _a.matchUpIds, eventType = _a.eventType, structure = _a.structure;
|
|
48546
48583
|
if (!drawDefinition)
|
|
48547
48584
|
return { error: MISSING_DRAW_DEFINITION };
|
|
48548
48585
|
if (!structure && !structureId)
|
|
@@ -48588,7 +48625,7 @@ function generateDrawMaticRound(_a) {
|
|
|
48588
48625
|
// add SAME_TEAM_VALUE for participants who appear on the same team
|
|
48589
48626
|
for (var teamParticipants_1 = __values(teamParticipants), teamParticipants_1_1 = teamParticipants_1.next(); !teamParticipants_1_1.done; teamParticipants_1_1 = teamParticipants_1.next()) {
|
|
48590
48627
|
var teamParticipant = teamParticipants_1_1.value;
|
|
48591
|
-
var participantIds_1 = teamParticipant.individualParticipantIds
|
|
48628
|
+
var participantIds_1 = (_f = teamParticipant.individualParticipantIds) !== null && _f !== void 0 ? _f : [];
|
|
48592
48629
|
var uniquePairings_2 = getPairingsData({ participantIds: participantIds_1 }).uniquePairings;
|
|
48593
48630
|
try {
|
|
48594
48631
|
for (var uniquePairings_1 = (e_3 = void 0, __values(uniquePairings_2)), uniquePairings_1_1 = uniquePairings_1.next(); !uniquePairings_1_1.done; uniquePairings_1_1 = uniquePairings_1.next()) {
|
|
@@ -48621,9 +48658,9 @@ function generateDrawMaticRound(_a) {
|
|
|
48621
48658
|
// 'P-I-0|P-I-2': 0,
|
|
48622
48659
|
// 'P-I-0|P-I-3': 0
|
|
48623
48660
|
// }
|
|
48624
|
-
var
|
|
48661
|
+
var _j = getPairingsData({
|
|
48625
48662
|
participantIds: participantIds,
|
|
48626
|
-
}), uniquePairings =
|
|
48663
|
+
}), uniquePairings = _j.uniquePairings, possiblePairings = _j.possiblePairings, deltaObjects = _j.deltaObjects;
|
|
48627
48664
|
var params = {
|
|
48628
48665
|
tournamentParticipants: tournamentParticipants,
|
|
48629
48666
|
possiblePairings: possiblePairings,
|
|
@@ -48637,7 +48674,7 @@ function generateDrawMaticRound(_a) {
|
|
|
48637
48674
|
eventType: eventType,
|
|
48638
48675
|
structure: structure,
|
|
48639
48676
|
};
|
|
48640
|
-
var
|
|
48677
|
+
var _k = getPairings(params), candidatesCount = _k.candidatesCount, participantIdPairings = _k.participantIdPairings, iterations = _k.iterations;
|
|
48641
48678
|
if (!candidatesCount)
|
|
48642
48679
|
return { error: NO_CANDIDATES };
|
|
48643
48680
|
var matchUps;
|
|
@@ -51239,13 +51276,19 @@ function getOrderedTieFormat(_a) {
|
|
|
51239
51276
|
if (collectionOrder)
|
|
51240
51277
|
collectionDefinition.collectionOrder = collectionOrder;
|
|
51241
51278
|
});
|
|
51242
|
-
orderedTieFormat.collectionDefinitions.sort(function (a, b) {
|
|
51279
|
+
orderedTieFormat.collectionDefinitions.sort(function (a, b) {
|
|
51280
|
+
return numericSortValue(a.collectionOrder) - numericSortValue(b.collectionOrder);
|
|
51281
|
+
});
|
|
51243
51282
|
return orderedTieFormat;
|
|
51244
51283
|
}
|
|
51245
51284
|
function orderCollectionDefinitions(_a) {
|
|
51246
51285
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, matchUpId = _a.matchUpId, orderMap = _a.orderMap, eventId = _a.eventId, matchUp = _a.matchUp, event = _a.event;
|
|
51247
|
-
if (typeof orderMap !== 'object'
|
|
51248
|
-
|
|
51286
|
+
if (typeof orderMap !== 'object' ||
|
|
51287
|
+
!Object.values(orderMap).every(function (val) { return isConvertableInteger(val); }))
|
|
51288
|
+
return decorateResult({
|
|
51289
|
+
result: { error: INVALID_VALUES },
|
|
51290
|
+
context: { orderMap: orderMap },
|
|
51291
|
+
});
|
|
51249
51292
|
if (eventId && (event === null || event === void 0 ? void 0 : event.tieFormat)) {
|
|
51250
51293
|
updateEventTieFormat({ tournamentRecord: tournamentRecord, event: event, orderMap: orderMap });
|
|
51251
51294
|
}
|
|
@@ -52884,7 +52927,8 @@ function modifyTieFormat(_a) {
|
|
|
52884
52927
|
processedTieFormat.collectionDefinitions =
|
|
52885
52928
|
processedTieFormat.collectionDefinitions
|
|
52886
52929
|
.sort(function (a, b) {
|
|
52887
|
-
return (a.collectionOrder
|
|
52930
|
+
return numericSortValue(a.collectionOrder) -
|
|
52931
|
+
numericSortValue(b.collectionOrder);
|
|
52888
52932
|
})
|
|
52889
52933
|
.map(function (def, i) { return (__assign(__assign({}, def), { collectionOrder: i + 1 })); });
|
|
52890
52934
|
return __assign(__assign({}, SUCCESS), { processedTieFormat: processedTieFormat });
|
|
@@ -55429,8 +55473,8 @@ function unPublishEvent(_a) {
|
|
|
55429
55473
|
event: event,
|
|
55430
55474
|
}).timeItem;
|
|
55431
55475
|
var itemValue = (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) || (_b = {}, _b[status] = {}, _b);
|
|
55432
|
-
delete itemValue[status].drawIds;
|
|
55433
55476
|
delete itemValue[status].structureIds;
|
|
55477
|
+
delete itemValue[status].drawIds;
|
|
55434
55478
|
var updatedTimeItem = { itemValue: itemValue, itemType: itemType };
|
|
55435
55479
|
addEventTimeItem({ event: event, timeItem: updatedTimeItem, removePriorValues: removePriorValues });
|
|
55436
55480
|
addNotice({
|
|
@@ -55754,9 +55798,9 @@ function getEventData(params) {
|
|
|
55754
55798
|
|
|
55755
55799
|
function publishEvent(params) {
|
|
55756
55800
|
var _a;
|
|
55757
|
-
var _b, _c, _d, _e, _f, _g, _h;
|
|
55801
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
55758
55802
|
var policyDefinitions = params.policyDefinitions, drawIds = params.drawIds, structureIds = params.structureIds;
|
|
55759
|
-
var removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord,
|
|
55803
|
+
var removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord, _k = params.status, status = _k === void 0 ? PUBLIC : _k, event = params.event, drawIdsToRemove = params.drawIdsToRemove, drawIdsToAdd = params.drawIdsToAdd, includePositionAssignments = params.includePositionAssignments, structureIdsToRemove = params.structureIdsToRemove, structureIdsToAdd = params.structureIdsToAdd;
|
|
55760
55804
|
if (!tournamentRecord)
|
|
55761
55805
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
55762
55806
|
if (!event)
|
|
@@ -55796,8 +55840,9 @@ function publishEvent(params) {
|
|
|
55796
55840
|
if (structureIdsToAdd === null || structureIdsToAdd === void 0 ? void 0 : structureIdsToAdd.length) {
|
|
55797
55841
|
structureIds = unique(structureIds.push.apply(structureIds, __spreadArray([], __read(structureIdsToAdd), false)));
|
|
55798
55842
|
}
|
|
55843
|
+
var existingStatusValue = (_g = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _g === void 0 ? void 0 : _g[status];
|
|
55799
55844
|
var updatedTimeItem = {
|
|
55800
|
-
itemValue: (_a = {}, _a[status] = { drawIds: drawIds, structureIds: structureIds }, _a),
|
|
55845
|
+
itemValue: (_a = {}, _a[status] = __assign(__assign({}, existingStatusValue), { drawIds: drawIds, structureIds: structureIds }), _a),
|
|
55801
55846
|
itemType: itemType,
|
|
55802
55847
|
};
|
|
55803
55848
|
addEventTimeItem({ event: event, timeItem: updatedTimeItem, removePriorValues: removePriorValues });
|
|
@@ -55809,7 +55854,7 @@ function publishEvent(params) {
|
|
|
55809
55854
|
event: event,
|
|
55810
55855
|
}).eventData;
|
|
55811
55856
|
// filter out drawData for unPublished draws
|
|
55812
|
-
var publishState = (
|
|
55857
|
+
var publishState = (_j = (_h = eventData === null || eventData === void 0 ? void 0 : eventData.eventInfo) === null || _h === void 0 ? void 0 : _h.publish) === null || _j === void 0 ? void 0 : _j.state;
|
|
55813
55858
|
eventData.drawsData = eventData.drawsData.filter(function (_a) {
|
|
55814
55859
|
var _b;
|
|
55815
55860
|
var drawId = _a.drawId;
|
|
@@ -58805,19 +58850,29 @@ function removeTieMatchUpParticipantId(params) {
|
|
|
58805
58850
|
}
|
|
58806
58851
|
|
|
58807
58852
|
function getPositionAssignments(_a) {
|
|
58808
|
-
var
|
|
58853
|
+
var _b;
|
|
58854
|
+
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, _c = _a.stage, stage = _c === void 0 ? MAIN : _c, structureId = _a.structureId, structure = _a.structure;
|
|
58809
58855
|
if (!tournamentRecord)
|
|
58810
58856
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
58811
58857
|
if (!structure && !drawDefinition)
|
|
58812
58858
|
return { error: MISSING_DRAW_DEFINITION };
|
|
58859
|
+
if (!structure &&
|
|
58860
|
+
!structureId &&
|
|
58861
|
+
((_b = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) === null || _b === void 0 ? void 0 : _b.filter(function (structure) { return structure.stage === stage; }).length) === 1) {
|
|
58862
|
+
structure = drawDefinition.structures.find(function (structure) { return structure.stage === stage; });
|
|
58863
|
+
}
|
|
58813
58864
|
if (!structure && !structureId)
|
|
58814
58865
|
return { error: MISSING_STRUCTURE_ID };
|
|
58815
|
-
var
|
|
58866
|
+
var _d = getPositionAssignments$1({
|
|
58816
58867
|
drawDefinition: drawDefinition,
|
|
58817
58868
|
structureId: structureId,
|
|
58818
58869
|
structure: structure,
|
|
58819
|
-
}), error =
|
|
58820
|
-
return {
|
|
58870
|
+
}), error = _d.error, assignments = _d.positionAssignments;
|
|
58871
|
+
return {
|
|
58872
|
+
error: error,
|
|
58873
|
+
positionAssignments: assignments || [],
|
|
58874
|
+
structureId: structure === null || structure === void 0 ? void 0 : structure.structureId,
|
|
58875
|
+
};
|
|
58821
58876
|
}
|
|
58822
58877
|
|
|
58823
58878
|
function deleteDrawDefinitions(_a) {
|
|
@@ -61856,12 +61911,13 @@ function addVoluntaryConsolationStructure(params) {
|
|
|
61856
61911
|
}
|
|
61857
61912
|
|
|
61858
61913
|
function prepareStage(params) {
|
|
61914
|
+
var _a;
|
|
61859
61915
|
var seedsCount = params.seedsCount;
|
|
61860
61916
|
var preparedStructureIds = params.preparedStructureIds || [];
|
|
61861
|
-
var provisionalPositioning = params.provisionalPositioning, inContextDrawMatchUps = params.inContextDrawMatchUps, tournamentRecord = params.tournamentRecord, appliedPolicies = params.appliedPolicies, qualifyingOnly = params.qualifyingOnly, drawDefinition = params.drawDefinition, seedingProfile = params.seedingProfile, participants = params.participants, matchUpsMap = params.matchUpsMap, automated = params.automated, placeByes = params.placeByes, drawType = params.drawType, drawSize = params.drawSize, entries = params.entries, event = params.event,
|
|
61862
|
-
|
|
61863
|
-
seedByRanking =
|
|
61864
|
-
seedingScaleName = params.seedingScaleName,
|
|
61917
|
+
var provisionalPositioning = params.provisionalPositioning, inContextDrawMatchUps = params.inContextDrawMatchUps, tournamentRecord = params.tournamentRecord, appliedPolicies = params.appliedPolicies, qualifyingOnly = params.qualifyingOnly, drawDefinition = params.drawDefinition, seedingProfile = params.seedingProfile, participants = params.participants, matchUpsMap = params.matchUpsMap, automated = params.automated, placeByes = params.placeByes, drawType = params.drawType, drawSize = params.drawSize, entries = params.entries, event = params.event, _b = params.enforcePolicyLimits, enforcePolicyLimits = _b === void 0 ? true : _b, seedAssignmentProfile = params.seedAssignmentProfile, // mainly used by mocksEngine for scenario testing
|
|
61918
|
+
_c = params.seedByRanking, // mainly used by mocksEngine for scenario testing
|
|
61919
|
+
seedByRanking = _c === void 0 ? true : _c, seededParticipants = params.seededParticipants, assignSeedsCount = params.assignSeedsCount, // used for testing bye placement next to seeds
|
|
61920
|
+
seedingScaleName = params.seedingScaleName, _d = params.stageSequence, stageSequence = _d === void 0 ? 1 : _d, roundTarget = params.roundTarget, stage = params.stage;
|
|
61865
61921
|
var eventType = event === null || event === void 0 ? void 0 : event.eventType;
|
|
61866
61922
|
var stageEntries = entries.filter(function (entry) {
|
|
61867
61923
|
var _a, _b;
|
|
@@ -61951,7 +62007,7 @@ function prepareStage(params) {
|
|
|
61951
62007
|
}
|
|
61952
62008
|
else if (event || seedingScaleName) {
|
|
61953
62009
|
// if no seededParticipants have been defined, seed by seeding scale or ranking scale, if present
|
|
61954
|
-
var
|
|
62010
|
+
var _e = (event === null || event === void 0 ? void 0 : event.category) || {}, categoryName = _e.categoryName, ageCategoryCode = _e.ageCategoryCode;
|
|
61955
62011
|
var seedingScaleAttributes = {
|
|
61956
62012
|
scaleType: SEEDING$1,
|
|
61957
62013
|
scaleName: seedingScaleName || categoryName || ageCategoryCode || event.eventId,
|
|
@@ -61978,7 +62034,7 @@ function prepareStage(params) {
|
|
|
61978
62034
|
stage: stage,
|
|
61979
62035
|
}).scaledEntries);
|
|
61980
62036
|
}
|
|
61981
|
-
var scaledEntriesCount = (scaledEntries === null || scaledEntries === void 0 ? void 0 : scaledEntries.length)
|
|
62037
|
+
var scaledEntriesCount = (_a = scaledEntries === null || scaledEntries === void 0 ? void 0 : scaledEntries.length) !== null && _a !== void 0 ? _a : 0;
|
|
61982
62038
|
if (scaledEntriesCount < seedsCount)
|
|
61983
62039
|
seedsCount = scaledEntriesCount;
|
|
61984
62040
|
scaledEntries === null || scaledEntries === void 0 ? void 0 : scaledEntries.filter(function (_a) {
|
|
@@ -62531,6 +62587,12 @@ function renameStructures(params) {
|
|
|
62531
62587
|
return renameStructures$1(params);
|
|
62532
62588
|
}
|
|
62533
62589
|
|
|
62590
|
+
function resetMatchUpLineUps(params) {
|
|
62591
|
+
if (!params.tournamentRecord)
|
|
62592
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
62593
|
+
return resetMatchUpLineUps$1(params);
|
|
62594
|
+
}
|
|
62595
|
+
|
|
62534
62596
|
function aggregateTieFormats(_a) {
|
|
62535
62597
|
var e_1, _b;
|
|
62536
62598
|
var _c, _d, _e, _f, _g;
|
|
@@ -62706,18 +62768,13 @@ function enableTieAutoCalc(params) {
|
|
|
62706
62768
|
return enableTieAutoCalc$1(params);
|
|
62707
62769
|
}
|
|
62708
62770
|
|
|
62709
|
-
function resetMatchUpLineUps(params) {
|
|
62710
|
-
if (!params.tournamentRecord)
|
|
62711
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
62712
|
-
return resetMatchUpLineUps$1(params);
|
|
62713
|
-
}
|
|
62714
|
-
|
|
62715
62771
|
var eventGovernor = {
|
|
62716
62772
|
generateQualifyingStructure: generateQualifyingStructure,
|
|
62717
62773
|
attachQualifyingStructure: attachQualifyingStructure,
|
|
62718
62774
|
attachPlayoffStructures: attachPlayoffStructures,
|
|
62719
|
-
attachStructures: attachStructures,
|
|
62720
62775
|
addQualifyingStructure: addQualifyingStructure,
|
|
62776
|
+
setStructureOrder: setStructureOrder,
|
|
62777
|
+
attachStructures: attachStructures,
|
|
62721
62778
|
renameStructures: renameStructures,
|
|
62722
62779
|
disableTieAutoCalc: disableTieAutoCalc,
|
|
62723
62780
|
enableTieAutoCalc: enableTieAutoCalc,
|