tods-competition-factory 0.72.0 → 0.74.0
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/tods-competition-factory.development.cjs.js +265 -85
- 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/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.74.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -294,6 +294,7 @@ const RETIRED = 'RETIRED';
|
|
|
294
294
|
const SUSPENDED = 'SUSPENDED';
|
|
295
295
|
const TO_BE_PLAYED = 'TO_BE_PLAYED';
|
|
296
296
|
const WALKOVER$1 = 'WALKOVER';
|
|
297
|
+
const recoveryTimeRequiredMatchUpStatuses = [AWAITING_RESULT, COMPLETED, DEFAULTED, IN_PROGRESS, INCOMPLETE, RETIRED, SUSPENDED];
|
|
297
298
|
const particicipantsRequiredMatchUpStatuses = [AWAITING_RESULT, COMPLETED, DEFAULTED, DOUBLE_WALKOVER, IN_PROGRESS, INCOMPLETE, RETIRED, SUSPENDED, WALKOVER$1];
|
|
298
299
|
const validMatchUpStatuses = [ABANDONED, AWAITING_RESULT, BYE, CANCELLED, COMPLETED, DEAD_RUBBER, DEFAULTED, DOUBLE_WALKOVER, IN_PROGRESS, INCOMPLETE, NOT_PLAYED, RETIRED, SUSPENDED, TO_BE_PLAYED, WALKOVER$1];
|
|
299
300
|
const directingMatchUpStatuses = [BYE, COMPLETED, DEFAULTED, DOUBLE_WALKOVER, RETIRED, WALKOVER$1];
|
|
@@ -717,6 +718,7 @@ const MISSING_DRAW_DEFINITION = 'Missing drawDefinition';
|
|
|
717
718
|
const EXISTING_DRAW_DEFINITIONS = 'Existing drawDefinition(s)';
|
|
718
719
|
const DRAW_DEFINITION_NOT_FOUND = 'drawDefinition not found';
|
|
719
720
|
const INVALID_STRUCTURE = 'Invalid structure';
|
|
721
|
+
const INCOMPLETE_SOURCE_STRUCTURE = 'Incomplete source structure';
|
|
720
722
|
const INVALID_DRAW_POSITION_FOR_SEEDING = 'Invalid drawPosition for seedAssignment';
|
|
721
723
|
const DRAW_POSITION_ASSIGNED = 'drawPosition already assigned';
|
|
722
724
|
const DRAW_POSITION_NOT_CLEARED = 'drawPosition not cleared';
|
|
@@ -891,6 +893,7 @@ const errorConditionConstants = {
|
|
|
891
893
|
EXISTING_PROFILE,
|
|
892
894
|
EXISTING_ROUND,
|
|
893
895
|
INCOMPATIBLE_MATCHUP_STATUS,
|
|
896
|
+
INCOMPLETE_SOURCE_STRUCTURE,
|
|
894
897
|
INVALID_BOOKINGS,
|
|
895
898
|
INVALID_CONFIGURATION,
|
|
896
899
|
INVALID_DATE_AVAILABILITY,
|
|
@@ -1020,26 +1023,35 @@ const errorConditionConstants = {
|
|
|
1020
1023
|
};
|
|
1021
1024
|
|
|
1022
1025
|
const syncGlobalState = {
|
|
1026
|
+
disableNotifications: false,
|
|
1023
1027
|
tournamentId: undefined,
|
|
1024
1028
|
tournamentRecords: {},
|
|
1025
1029
|
subscriptions: {},
|
|
1026
1030
|
notices: []
|
|
1027
1031
|
};
|
|
1028
1032
|
var syncGlobalState$1 = {
|
|
1029
|
-
setSubscriptions: setSubscriptions$1,
|
|
1030
1033
|
addNotice: addNotice$1,
|
|
1031
|
-
|
|
1034
|
+
callListener: callListener$1,
|
|
1032
1035
|
deleteNotices: deleteNotices$1,
|
|
1036
|
+
disableNotifications: disableNotifications$1,
|
|
1037
|
+
enableNotifications: enableNotifications$1,
|
|
1038
|
+
getNotices: getNotices$1,
|
|
1033
1039
|
getTopics: getTopics$1,
|
|
1034
|
-
callListener: callListener$1,
|
|
1035
1040
|
getTournamentId: getTournamentId$1,
|
|
1036
1041
|
getTournamentRecord: getTournamentRecord$1,
|
|
1037
1042
|
getTournamentRecords: getTournamentRecords$1,
|
|
1043
|
+
removeTournamentRecord: removeTournamentRecord$1,
|
|
1044
|
+
setSubscriptions: setSubscriptions$1,
|
|
1038
1045
|
setTournamentId: setTournamentId$1,
|
|
1039
1046
|
setTournamentRecord: setTournamentRecord$2,
|
|
1040
|
-
setTournamentRecords: setTournamentRecords$1
|
|
1041
|
-
removeTournamentRecord: removeTournamentRecord$1
|
|
1047
|
+
setTournamentRecords: setTournamentRecords$1
|
|
1042
1048
|
};
|
|
1049
|
+
function disableNotifications$1() {
|
|
1050
|
+
syncGlobalState.disableNotifications = true;
|
|
1051
|
+
}
|
|
1052
|
+
function enableNotifications$1() {
|
|
1053
|
+
syncGlobalState.disableNotifications = false;
|
|
1054
|
+
}
|
|
1043
1055
|
function getTournamentId$1() {
|
|
1044
1056
|
return syncGlobalState.tournamentId;
|
|
1045
1057
|
}
|
|
@@ -1126,7 +1138,7 @@ function addNotice$1({
|
|
|
1126
1138
|
return;
|
|
1127
1139
|
}
|
|
1128
1140
|
|
|
1129
|
-
if (!syncGlobalState.subscriptions[topic]) return;
|
|
1141
|
+
if (syncGlobalState.disableNotifications || !syncGlobalState.subscriptions[topic]) return;
|
|
1130
1142
|
|
|
1131
1143
|
if (key) {
|
|
1132
1144
|
syncGlobalState.notices = syncGlobalState.notices.filter(notice => !(notice.topic === topic && notice.key === key));
|
|
@@ -1165,19 +1177,19 @@ function callListener$1({
|
|
|
1165
1177
|
}
|
|
1166
1178
|
|
|
1167
1179
|
const globalState = {
|
|
1168
|
-
devContext: undefined,
|
|
1169
1180
|
timers: {
|
|
1170
1181
|
default: {
|
|
1171
1182
|
elapsedTime: 0
|
|
1172
1183
|
}
|
|
1173
1184
|
},
|
|
1174
|
-
|
|
1185
|
+
devContext: undefined,
|
|
1175
1186
|
deepCopyAttributes: {
|
|
1176
1187
|
threshold: undefined,
|
|
1177
1188
|
stringify: [],
|
|
1178
1189
|
ignore: [],
|
|
1179
1190
|
toJSON: []
|
|
1180
|
-
}
|
|
1191
|
+
},
|
|
1192
|
+
deepCopy: true
|
|
1181
1193
|
};
|
|
1182
1194
|
let _globalStateProvider = syncGlobalState$1;
|
|
1183
1195
|
const requiredStateProviderMethods = ['addNotice', 'callListener', 'deleteNotices', 'getNotices', 'getTopics', 'getTournamentId', 'getTournamentRecord', 'getTournamentRecords', 'removeTournamentRecord', 'setSubscriptions', 'setTournamentId', 'setTournamentRecord', 'setTournamentRecords'];
|
|
@@ -1233,6 +1245,12 @@ function getDevContext(contextCriteria) {
|
|
|
1233
1245
|
function setDevContext(value) {
|
|
1234
1246
|
globalState.devContext = value;
|
|
1235
1247
|
}
|
|
1248
|
+
function disableNotifications() {
|
|
1249
|
+
_globalStateProvider.disableNotifications();
|
|
1250
|
+
}
|
|
1251
|
+
function enableNotifications() {
|
|
1252
|
+
_globalStateProvider.enableNotifications();
|
|
1253
|
+
}
|
|
1236
1254
|
function setDeepCopy(value, attributes) {
|
|
1237
1255
|
if (typeof value === 'boolean') {
|
|
1238
1256
|
globalState.deepCopy = value;
|
|
@@ -10563,9 +10581,9 @@ function getAllPositionedParticipantIds({
|
|
|
10563
10581
|
}).flat();
|
|
10564
10582
|
}
|
|
10565
10583
|
function getPositionAssignments$1({
|
|
10566
|
-
structure,
|
|
10567
10584
|
drawDefinition,
|
|
10568
|
-
structureId
|
|
10585
|
+
structureId,
|
|
10586
|
+
structure
|
|
10569
10587
|
}) {
|
|
10570
10588
|
let error,
|
|
10571
10589
|
positionAssignments = [];
|
|
@@ -10616,9 +10634,9 @@ function structureAssignedDrawPositions({
|
|
|
10616
10634
|
const {
|
|
10617
10635
|
positionAssignments
|
|
10618
10636
|
} = getPositionAssignments$1({
|
|
10619
|
-
structure,
|
|
10620
10637
|
drawDefinition,
|
|
10621
|
-
structureId
|
|
10638
|
+
structureId,
|
|
10639
|
+
structure
|
|
10622
10640
|
});
|
|
10623
10641
|
const assignedPositions = positionAssignments.filter(drawPosition => {
|
|
10624
10642
|
return drawPosition.participantId || drawPosition.bye || drawPosition.qualifier;
|
|
@@ -11323,7 +11341,7 @@ function getAllStructureMatchUps({
|
|
|
11323
11341
|
drawId,
|
|
11324
11342
|
drawName
|
|
11325
11343
|
} = drawDefinition || {};
|
|
11326
|
-
const isRoundRobin = structure.structures;
|
|
11344
|
+
const isRoundRobin = !!structure.structures;
|
|
11327
11345
|
let matchUps = getMappedStructureMatchUps({
|
|
11328
11346
|
matchUpsMap,
|
|
11329
11347
|
structureId,
|
|
@@ -11570,6 +11588,11 @@ function getAllStructureMatchUps({
|
|
|
11570
11588
|
});
|
|
11571
11589
|
|
|
11572
11590
|
if (participant) {
|
|
11591
|
+
if (drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.entries) {
|
|
11592
|
+
const entry = drawDefinition.entries.find(entry => entry.participantId === side.participantId);
|
|
11593
|
+
if (entry !== null && entry !== void 0 && entry.entryStatus) participant.entryStatus = entry.entryStatus || ALTERNATE;
|
|
11594
|
+
}
|
|
11595
|
+
|
|
11573
11596
|
Object.assign(side, {
|
|
11574
11597
|
participant
|
|
11575
11598
|
});
|
|
@@ -11600,17 +11623,6 @@ function getAllStructureMatchUps({
|
|
|
11600
11623
|
matchUpType
|
|
11601
11624
|
});
|
|
11602
11625
|
}
|
|
11603
|
-
|
|
11604
|
-
if (drawDefinition !== null && drawDefinition !== void 0 && drawDefinition.entries) {
|
|
11605
|
-
matchUpWithContext.sides.filter(Boolean).forEach(side => {
|
|
11606
|
-
if (side.participantId) {
|
|
11607
|
-
const entry = drawDefinition.entries.find(entry => entry.participantId === side.participantId);
|
|
11608
|
-
if (entry !== null && entry !== void 0 && entry.entryStatus) Object.assign(side, {
|
|
11609
|
-
entryStatus: entry.entryStatus || ALTERNATE
|
|
11610
|
-
});
|
|
11611
|
-
}
|
|
11612
|
-
});
|
|
11613
|
-
}
|
|
11614
11626
|
}
|
|
11615
11627
|
|
|
11616
11628
|
if (matchUpWithContext.tieMatchUps) {
|
|
@@ -16924,22 +16936,26 @@ function assignDrawPositionBye$1({
|
|
|
16924
16936
|
drawDefinition,
|
|
16925
16937
|
drawPosition,
|
|
16926
16938
|
matchUpsMap,
|
|
16927
|
-
structureId
|
|
16939
|
+
structureId,
|
|
16940
|
+
structure
|
|
16928
16941
|
}) {
|
|
16929
16942
|
var _matchUp$drawPosition;
|
|
16930
16943
|
|
|
16931
16944
|
if (!drawDefinition) return {
|
|
16932
16945
|
error: MISSING_DRAW_DEFINITION
|
|
16933
16946
|
};
|
|
16934
|
-
|
|
16947
|
+
if (!structure) ({
|
|
16935
16948
|
structure
|
|
16936
16949
|
} = findStructure({
|
|
16937
16950
|
drawDefinition,
|
|
16938
16951
|
structureId
|
|
16939
|
-
});
|
|
16952
|
+
}));
|
|
16940
16953
|
if (!structure) return {
|
|
16941
16954
|
error: STRUCTURE_NOT_FOUND
|
|
16942
16955
|
};
|
|
16956
|
+
if (!structureId) ({
|
|
16957
|
+
structureId
|
|
16958
|
+
} = structure);
|
|
16943
16959
|
|
|
16944
16960
|
if (!matchUpsMap) {
|
|
16945
16961
|
matchUpsMap = getMatchUpsMap({
|
|
@@ -17147,10 +17163,10 @@ function advanceDrawPosition({
|
|
|
17147
17163
|
loserTargetDrawPosition
|
|
17148
17164
|
}
|
|
17149
17165
|
} = positionTargets({
|
|
17150
|
-
|
|
17151
|
-
structure,
|
|
17166
|
+
inContextDrawMatchUps,
|
|
17152
17167
|
drawDefinition,
|
|
17153
|
-
|
|
17168
|
+
matchUpId,
|
|
17169
|
+
structure
|
|
17154
17170
|
}); // only handling situation where winningMatchUp is in same structure
|
|
17155
17171
|
|
|
17156
17172
|
if (winnerMatchUp && winnerMatchUp.structureId === structure.structureId) {
|
|
@@ -17181,10 +17197,10 @@ function advanceDrawPosition({
|
|
|
17181
17197
|
if (result.error) return result;
|
|
17182
17198
|
} else {
|
|
17183
17199
|
assignFedDrawPositionBye({
|
|
17200
|
+
loserTargetDrawPosition,
|
|
17201
|
+
loserTargetLink,
|
|
17184
17202
|
drawDefinition,
|
|
17185
17203
|
loserMatchUp,
|
|
17186
|
-
loserTargetLink,
|
|
17187
|
-
loserTargetDrawPosition,
|
|
17188
17204
|
matchUpsMap
|
|
17189
17205
|
});
|
|
17190
17206
|
}
|
|
@@ -30630,7 +30646,7 @@ function getOrderedByePositions({
|
|
|
30630
30646
|
// In CONTAINER/ROUND_ROBIN structures drawPositions are duplicated
|
|
30631
30647
|
// and therefore must placed in drawOrder within Groups
|
|
30632
30648
|
const matchUpDrawPositionPairs = relevantMatchUps.map(matchUp => matchUp.drawPositions);
|
|
30633
|
-
const consideredDrawPositionPairs = matchUpDrawPositionPairs.map(pair => pair.sort((a, b) => a - b)).filter(pair => pair[0] + 1 === pair[1]); // sort seededMatchUps so that pairedPositions represent seed order
|
|
30649
|
+
const consideredDrawPositionPairs = matchUpDrawPositionPairs.map(pair => pair === null || pair === void 0 ? void 0 : pair.sort((a, b) => a - b)).filter(pair => (pair === null || pair === void 0 ? void 0 : pair[0]) + 1 === (pair === null || pair === void 0 ? void 0 : pair[1])); // sort seededMatchUps so that pairedPositions represent seed order
|
|
30634
30650
|
|
|
30635
30651
|
const seedOrderSortedDrawPositionPairs = orderedSeedDrawPositions.map(drawPosition => consideredDrawPositionPairs.find(drawPositions => drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(drawPosition))).filter(Boolean);
|
|
30636
30652
|
const orderedByePositions = seedOrderSortedDrawPositionPairs.map(drawPositions => {
|
|
@@ -30760,7 +30776,7 @@ function getUnseededByePositions({
|
|
|
30760
30776
|
} // for Round Robins pairs need to be reduced to pairs in drawPosition order
|
|
30761
30777
|
|
|
30762
30778
|
|
|
30763
|
-
const matchUpPairedDrawPositions = relevantMatchUps.map(matchUp => matchUp.drawPositions).map(pair => pair.sort((a, b) => a - b)).filter(pair => pair[0] + 1 === pair[1]);
|
|
30779
|
+
const matchUpPairedDrawPositions = relevantMatchUps.map(matchUp => matchUp.drawPositions).map(pair => pair === null || pair === void 0 ? void 0 : pair.sort((a, b) => a - b)).filter(pair => (pair === null || pair === void 0 ? void 0 : pair[0]) + 1 === (pair === null || pair === void 0 ? void 0 : pair[1]));
|
|
30764
30780
|
|
|
30765
30781
|
const findDrawPositionPair = drawPosition => {
|
|
30766
30782
|
return matchUpPairedDrawPositions.reduce((pair, candidate) => {
|
|
@@ -30916,9 +30932,10 @@ function positionByes({
|
|
|
30916
30932
|
for (const drawPosition of byeDrawPositions) {
|
|
30917
30933
|
const result = assignDrawPositionBye$1({
|
|
30918
30934
|
drawDefinition,
|
|
30919
|
-
structureId,
|
|
30920
30935
|
drawPosition,
|
|
30921
|
-
matchUpsMap
|
|
30936
|
+
matchUpsMap,
|
|
30937
|
+
structureId,
|
|
30938
|
+
structure
|
|
30922
30939
|
});
|
|
30923
30940
|
if (result !== null && result !== void 0 && result.error) return result;
|
|
30924
30941
|
}
|
|
@@ -30965,6 +30982,8 @@ function positionQualifiers(params) {
|
|
|
30965
30982
|
positionAssignments.forEach(assignment => {
|
|
30966
30983
|
if (assignment.drawPosition === drawPosition) {
|
|
30967
30984
|
assignment.qualifier = true;
|
|
30985
|
+
delete assignment.participantId;
|
|
30986
|
+
delete assignment.bye;
|
|
30968
30987
|
}
|
|
30969
30988
|
});
|
|
30970
30989
|
});
|
|
@@ -30996,27 +31015,27 @@ function getQualifiersData({
|
|
|
30996
31015
|
} = structure;
|
|
30997
31016
|
const qualifiersCount = getStageQualifiersCount({
|
|
30998
31017
|
drawDefinition,
|
|
30999
|
-
|
|
31000
|
-
|
|
31018
|
+
stageSequence,
|
|
31019
|
+
stage
|
|
31001
31020
|
});
|
|
31002
31021
|
const unplacedQualifiersCount = qualifiersCount - assignedQualifierPositions.length;
|
|
31003
31022
|
const placedQualifiersCount = assignedQualifierPositions.length;
|
|
31004
31023
|
return {
|
|
31005
|
-
|
|
31006
|
-
qualifiersCount,
|
|
31024
|
+
unplacedQualifiersCount,
|
|
31007
31025
|
placedQualifiersCount,
|
|
31008
|
-
|
|
31026
|
+
positionAssignments,
|
|
31027
|
+
qualifiersCount
|
|
31009
31028
|
};
|
|
31010
31029
|
}
|
|
31011
31030
|
|
|
31012
31031
|
function positionSeedBlocks({
|
|
31032
|
+
inContextDrawMatchUps,
|
|
31013
31033
|
drawDefinition,
|
|
31014
31034
|
participants,
|
|
31015
31035
|
groupsCount,
|
|
31016
31036
|
structureId,
|
|
31017
|
-
structure,
|
|
31018
31037
|
matchUpsMap,
|
|
31019
|
-
|
|
31038
|
+
structure
|
|
31020
31039
|
}) {
|
|
31021
31040
|
const errors = [];
|
|
31022
31041
|
let placedSeedBlocks = 0;
|
|
@@ -31047,11 +31066,11 @@ function positionSeedBlocks({
|
|
|
31047
31066
|
generateRange(0, groupsCount).forEach(() => {
|
|
31048
31067
|
if (placedSeedBlocks < groupsCount) {
|
|
31049
31068
|
const result = positionSeedBlock({
|
|
31069
|
+
inContextDrawMatchUps,
|
|
31050
31070
|
drawDefinition,
|
|
31051
31071
|
participants,
|
|
31052
31072
|
structureId,
|
|
31053
|
-
matchUpsMap
|
|
31054
|
-
inContextDrawMatchUps
|
|
31073
|
+
matchUpsMap
|
|
31055
31074
|
});
|
|
31056
31075
|
if (result && result.success) placedSeedBlocks++;
|
|
31057
31076
|
|
|
@@ -31099,13 +31118,13 @@ function positionSeedBlock({
|
|
|
31099
31118
|
error: MISSING_DRAW_POSITION
|
|
31100
31119
|
};
|
|
31101
31120
|
const result = assignDrawPosition$1({
|
|
31121
|
+
automaticPlacement: true,
|
|
31122
|
+
inContextDrawMatchUps,
|
|
31102
31123
|
drawDefinition,
|
|
31103
|
-
structureId,
|
|
31104
|
-
drawPosition,
|
|
31105
31124
|
participantId,
|
|
31106
|
-
|
|
31125
|
+
drawPosition,
|
|
31107
31126
|
matchUpsMap,
|
|
31108
|
-
|
|
31127
|
+
structureId
|
|
31109
31128
|
});
|
|
31110
31129
|
if (!result.success) return result;
|
|
31111
31130
|
}
|
|
@@ -31114,6 +31133,7 @@ function positionSeedBlock({
|
|
|
31114
31133
|
}
|
|
31115
31134
|
|
|
31116
31135
|
function automatedPositioning$1({
|
|
31136
|
+
applyPositioning = true,
|
|
31117
31137
|
inContextDrawMatchUps,
|
|
31118
31138
|
drawDefinition,
|
|
31119
31139
|
candidatesCount,
|
|
@@ -31124,6 +31144,24 @@ function automatedPositioning$1({
|
|
|
31124
31144
|
drawType,
|
|
31125
31145
|
event
|
|
31126
31146
|
}) {
|
|
31147
|
+
//-----------------------------------------------------------
|
|
31148
|
+
// handle notification state for all exit conditions
|
|
31149
|
+
if (!applyPositioning) {
|
|
31150
|
+
disableNotifications();
|
|
31151
|
+
drawDefinition = makeDeepCopy(drawDefinition, false, true);
|
|
31152
|
+
}
|
|
31153
|
+
|
|
31154
|
+
const handleErrorCondition = result => {
|
|
31155
|
+
if (!applyPositioning) enableNotifications();
|
|
31156
|
+
return result;
|
|
31157
|
+
};
|
|
31158
|
+
|
|
31159
|
+
const handleSuccessCondition = result => {
|
|
31160
|
+
if (!applyPositioning) enableNotifications();
|
|
31161
|
+
return result;
|
|
31162
|
+
}; //-----------------------------------------------------------
|
|
31163
|
+
|
|
31164
|
+
|
|
31127
31165
|
const {
|
|
31128
31166
|
structure,
|
|
31129
31167
|
error
|
|
@@ -31131,9 +31169,9 @@ function automatedPositioning$1({
|
|
|
31131
31169
|
drawDefinition,
|
|
31132
31170
|
structureId
|
|
31133
31171
|
});
|
|
31134
|
-
if (error) return {
|
|
31172
|
+
if (error) return handleErrorCondition({
|
|
31135
31173
|
error
|
|
31136
|
-
};
|
|
31174
|
+
});
|
|
31137
31175
|
const entryStatuses = [DIRECT_ACCEPTANCE, WILDCARD];
|
|
31138
31176
|
const entries = getStageEntries$1({
|
|
31139
31177
|
stageSequence: structure.stageSequence,
|
|
@@ -31142,7 +31180,8 @@ function automatedPositioning$1({
|
|
|
31142
31180
|
entryStatuses,
|
|
31143
31181
|
structureId
|
|
31144
31182
|
});
|
|
31145
|
-
if (!(entries !== null && entries !== void 0 && entries.length)) return SUCCESS
|
|
31183
|
+
if (!(entries !== null && entries !== void 0 && entries.length)) return handleSuccessCondition({ ...SUCCESS
|
|
31184
|
+
});
|
|
31146
31185
|
const {
|
|
31147
31186
|
seedingProfile
|
|
31148
31187
|
} = structure;
|
|
@@ -31171,7 +31210,7 @@ function automatedPositioning$1({
|
|
|
31171
31210
|
seedsOnly,
|
|
31172
31211
|
event
|
|
31173
31212
|
});
|
|
31174
|
-
if (result.error) return result;
|
|
31213
|
+
if (result.error) return handleErrorCondition(result);
|
|
31175
31214
|
result = positionSeedBlocks({
|
|
31176
31215
|
inContextDrawMatchUps,
|
|
31177
31216
|
drawDefinition,
|
|
@@ -31179,7 +31218,7 @@ function automatedPositioning$1({
|
|
|
31179
31218
|
matchUpsMap,
|
|
31180
31219
|
structure
|
|
31181
31220
|
});
|
|
31182
|
-
if (result.error) return result;
|
|
31221
|
+
if (result.error) return handleErrorCondition(result);
|
|
31183
31222
|
} else {
|
|
31184
31223
|
// otherwise... seeds need to be placed first so that BYEs
|
|
31185
31224
|
// can follow the seedValues of placed seeds
|
|
@@ -31191,7 +31230,7 @@ function automatedPositioning$1({
|
|
|
31191
31230
|
matchUpsMap,
|
|
31192
31231
|
structure
|
|
31193
31232
|
});
|
|
31194
|
-
if (result.error) return result;
|
|
31233
|
+
if (result.error) return handleErrorCondition(result);
|
|
31195
31234
|
}
|
|
31196
31235
|
|
|
31197
31236
|
const result = positionByes({
|
|
@@ -31202,7 +31241,7 @@ function automatedPositioning$1({
|
|
|
31202
31241
|
seedsOnly,
|
|
31203
31242
|
event
|
|
31204
31243
|
});
|
|
31205
|
-
if (result.error) return result;
|
|
31244
|
+
if (result.error) return handleErrorCondition(result);
|
|
31206
31245
|
}
|
|
31207
31246
|
|
|
31208
31247
|
const conflicts = {};
|
|
@@ -31216,25 +31255,37 @@ function automatedPositioning$1({
|
|
|
31216
31255
|
matchUpsMap,
|
|
31217
31256
|
structure
|
|
31218
31257
|
});
|
|
31219
|
-
if (result.error) return result;
|
|
31258
|
+
if (result.error) return handleErrorCondition(result);
|
|
31220
31259
|
if (result.conflicts) conflicts.unseededConflicts = result.conflicts;
|
|
31221
31260
|
result = positionQualifiers({
|
|
31261
|
+
inContextDrawMatchUps,
|
|
31222
31262
|
drawDefinition,
|
|
31223
31263
|
participants,
|
|
31224
|
-
structure,
|
|
31225
31264
|
matchUpsMap,
|
|
31226
|
-
|
|
31265
|
+
structure
|
|
31227
31266
|
});
|
|
31228
|
-
if (result.error) return result;
|
|
31267
|
+
if (result.error) return handleErrorCondition(result);
|
|
31229
31268
|
if (result.conflicts) conflicts.qualifierConflicts = result.conflicts;
|
|
31230
31269
|
}
|
|
31231
31270
|
|
|
31271
|
+
const {
|
|
31272
|
+
positionAssignments
|
|
31273
|
+
} = getPositionAssignments$1({
|
|
31274
|
+
drawDefinition,
|
|
31275
|
+
structure
|
|
31276
|
+
});
|
|
31232
31277
|
modifyDrawNotice({
|
|
31233
31278
|
drawDefinition,
|
|
31234
31279
|
structureIds: [structureId]
|
|
31235
|
-
});
|
|
31280
|
+
}); //-----------------------------------------------------------
|
|
31281
|
+
// re-enable notifications, if they have been disabled
|
|
31282
|
+
|
|
31283
|
+
if (!applyPositioning) enableNotifications(); //-----------------------------------------------------------
|
|
31284
|
+
|
|
31236
31285
|
return {
|
|
31237
|
-
|
|
31286
|
+
positionAssignments,
|
|
31287
|
+
conflicts,
|
|
31288
|
+
...SUCCESS
|
|
31238
31289
|
};
|
|
31239
31290
|
}
|
|
31240
31291
|
|
|
@@ -34815,15 +34866,15 @@ function getSeedsCount({
|
|
|
34815
34866
|
}
|
|
34816
34867
|
|
|
34817
34868
|
function initializeStructureSeedAssignments({
|
|
34818
|
-
tournamentRecord,
|
|
34819
|
-
drawDefinition,
|
|
34820
|
-
event,
|
|
34821
34869
|
requireParticipantCount = true,
|
|
34822
34870
|
enforcePolicyLimits = true,
|
|
34823
34871
|
drawSizeProgression,
|
|
34872
|
+
tournamentRecord,
|
|
34824
34873
|
participantCount,
|
|
34874
|
+
drawDefinition,
|
|
34825
34875
|
structureId,
|
|
34826
|
-
seedsCount
|
|
34876
|
+
seedsCount,
|
|
34877
|
+
event
|
|
34827
34878
|
}) {
|
|
34828
34879
|
const {
|
|
34829
34880
|
structure,
|
|
@@ -35172,6 +35223,110 @@ function alternateDrawPositionAssignment$1({
|
|
|
35172
35223
|
});
|
|
35173
35224
|
}
|
|
35174
35225
|
|
|
35226
|
+
function setPositionAssignments$1({
|
|
35227
|
+
structurePositionAssignments,
|
|
35228
|
+
drawDefinition
|
|
35229
|
+
}) {
|
|
35230
|
+
if (!drawDefinition) return {
|
|
35231
|
+
error: MISSING_DRAW_DEFINITION
|
|
35232
|
+
};
|
|
35233
|
+
if (!Array.isArray(structurePositionAssignments)) return {
|
|
35234
|
+
error: INVALID_VALUES
|
|
35235
|
+
};
|
|
35236
|
+
|
|
35237
|
+
for (const structureAssignments of structurePositionAssignments) {
|
|
35238
|
+
var _structure$positionAs;
|
|
35239
|
+
|
|
35240
|
+
const {
|
|
35241
|
+
structureId,
|
|
35242
|
+
positionAssignments
|
|
35243
|
+
} = structureAssignments;
|
|
35244
|
+
const result = findStructure({
|
|
35245
|
+
drawDefinition,
|
|
35246
|
+
structureId
|
|
35247
|
+
});
|
|
35248
|
+
if (result.error) return result;
|
|
35249
|
+
const structure = result.structure;
|
|
35250
|
+
if (!structure) return {
|
|
35251
|
+
error: STRUCTURE_NOT_FOUND
|
|
35252
|
+
};
|
|
35253
|
+
if (structure.structures) return {
|
|
35254
|
+
error: INVALID_STRUCTURE,
|
|
35255
|
+
message: 'cannot be Round Robin group container'
|
|
35256
|
+
};
|
|
35257
|
+
const structureDrawPositions = (_structure$positionAs = structure.positionAssignments) === null || _structure$positionAs === void 0 ? void 0 : _structure$positionAs.map(({
|
|
35258
|
+
drawPosition
|
|
35259
|
+
}) => drawPosition);
|
|
35260
|
+
const submittedDrawPositions = positionAssignments.map(({
|
|
35261
|
+
drawPosition
|
|
35262
|
+
}) => drawPosition);
|
|
35263
|
+
if (intersection(structureDrawPositions, submittedDrawPositions).length !== structureDrawPositions.length) return {
|
|
35264
|
+
error: INVALID_VALUES,
|
|
35265
|
+
message: 'drawPositions do not match'
|
|
35266
|
+
};
|
|
35267
|
+
const matchUpsMap = getMatchUpsMap({
|
|
35268
|
+
drawDefinition
|
|
35269
|
+
});
|
|
35270
|
+
const {
|
|
35271
|
+
matchUps: inContextDrawMatchUps
|
|
35272
|
+
} = getAllDrawMatchUps({
|
|
35273
|
+
includeByeMatchUps: true,
|
|
35274
|
+
inContext: true,
|
|
35275
|
+
drawDefinition,
|
|
35276
|
+
matchUpsMap
|
|
35277
|
+
});
|
|
35278
|
+
|
|
35279
|
+
for (const assignment of positionAssignments) {
|
|
35280
|
+
const {
|
|
35281
|
+
drawPosition,
|
|
35282
|
+
participantId,
|
|
35283
|
+
bye,
|
|
35284
|
+
qualifier
|
|
35285
|
+
} = assignment;
|
|
35286
|
+
|
|
35287
|
+
if (bye) {
|
|
35288
|
+
const result = assignDrawPositionBye$1({
|
|
35289
|
+
drawDefinition,
|
|
35290
|
+
drawPosition,
|
|
35291
|
+
matchUpsMap,
|
|
35292
|
+
structureId,
|
|
35293
|
+
structure
|
|
35294
|
+
});
|
|
35295
|
+
if (result !== null && result !== void 0 && result.error) return result;
|
|
35296
|
+
} else if (qualifier) {
|
|
35297
|
+
positionAssignments.forEach(assignment => {
|
|
35298
|
+
if (assignment.drawPosition === drawPosition) {
|
|
35299
|
+
assignment.qualifier = true;
|
|
35300
|
+
delete assignment.participantId;
|
|
35301
|
+
delete assignment.bye;
|
|
35302
|
+
}
|
|
35303
|
+
});
|
|
35304
|
+
} else if (participantId) {
|
|
35305
|
+
const result = assignDrawPosition$1({
|
|
35306
|
+
automaticPlacement: true,
|
|
35307
|
+
inContextDrawMatchUps,
|
|
35308
|
+
drawDefinition,
|
|
35309
|
+
participantId,
|
|
35310
|
+
drawPosition,
|
|
35311
|
+
matchUpsMap,
|
|
35312
|
+
structureId
|
|
35313
|
+
});
|
|
35314
|
+
if (result !== null && result !== void 0 && result.error) return result;
|
|
35315
|
+
}
|
|
35316
|
+
}
|
|
35317
|
+
}
|
|
35318
|
+
|
|
35319
|
+
const structureIds = structurePositionAssignments.map(({
|
|
35320
|
+
structureId
|
|
35321
|
+
}) => structureId);
|
|
35322
|
+
modifyDrawNotice({
|
|
35323
|
+
drawDefinition,
|
|
35324
|
+
structureIds
|
|
35325
|
+
});
|
|
35326
|
+
return { ...SUCCESS
|
|
35327
|
+
};
|
|
35328
|
+
}
|
|
35329
|
+
|
|
35175
35330
|
// optionally filter to included only specified stages
|
|
35176
35331
|
|
|
35177
35332
|
function getAssignedParticipantIds({
|
|
@@ -36724,12 +36879,11 @@ function setSubOrder({
|
|
|
36724
36879
|
};
|
|
36725
36880
|
}
|
|
36726
36881
|
|
|
36727
|
-
// import { assignCollectionPosition, assignDrawPosition } from './positionAssignment';
|
|
36728
36882
|
const positionGovernor = {
|
|
36729
36883
|
setSubOrder,
|
|
36730
36884
|
clearDrawPosition,
|
|
36731
36885
|
assignDrawPosition: assignDrawPosition$1,
|
|
36732
|
-
|
|
36886
|
+
setPositionAssignments: setPositionAssignments$1,
|
|
36733
36887
|
automatedPositioning: automatedPositioning$1,
|
|
36734
36888
|
assignDrawPositionBye: assignDrawPositionBye$1,
|
|
36735
36889
|
swapDrawPositionAssignments: swapDrawPositionAssignments$1,
|
|
@@ -38851,7 +39005,7 @@ function modifySeedAssignment$1({
|
|
|
38851
39005
|
if (!structure) return {
|
|
38852
39006
|
error: STRUCTURE_NOT_FOUND
|
|
38853
39007
|
};
|
|
38854
|
-
const validValue = !validation || isNumeric(seedValue) || typeof seedValue === 'string' && seedValue.split('-').every(isNumeric);
|
|
39008
|
+
const validValue = !validation || isNumeric(seedValue) || [undefined, ''].includes(seedValue) || typeof seedValue === 'string' && seedValue.split('-').every(v => isNumeric(v) && v > 0);
|
|
38855
39009
|
if (!validValue) return {
|
|
38856
39010
|
error: INVALID_VALUES
|
|
38857
39011
|
};
|
|
@@ -38865,7 +39019,8 @@ function modifySeedAssignment$1({
|
|
|
38865
39019
|
const existingAssginment = seedAssignments.find(assignment => assignment.participantId === participantId);
|
|
38866
39020
|
|
|
38867
39021
|
if (existingAssginment) {
|
|
38868
|
-
|
|
39022
|
+
const newValue = typeof seedValue === 'string' ? seedValue.includes('-') ? seedValue.split('-').map(v => parseInt(v)).join('-') : seedValue > 0 ? parseInt(seedValue) : '' : seedValue > 0 ? parseInt(seedValue) : '';
|
|
39023
|
+
existingAssginment.seedValue = newValue;
|
|
38869
39024
|
} else {
|
|
38870
39025
|
const seedNumber = Math.max(0, ...seedNumbers) + 1;
|
|
38871
39026
|
structure.seedAssignments.push({
|
|
@@ -43209,14 +43364,13 @@ function addEvent({
|
|
|
43209
43364
|
*/
|
|
43210
43365
|
|
|
43211
43366
|
function automatedPositioning({
|
|
43367
|
+
applyPositioning = true,
|
|
43212
43368
|
tournamentRecord,
|
|
43213
43369
|
drawDefinition,
|
|
43214
43370
|
structureId,
|
|
43215
43371
|
seedsOnly,
|
|
43216
43372
|
event
|
|
43217
43373
|
}) {
|
|
43218
|
-
var _result$errors;
|
|
43219
|
-
|
|
43220
43374
|
if (!event) return {
|
|
43221
43375
|
error: EVENT_NOT_FOUND
|
|
43222
43376
|
};
|
|
@@ -43224,17 +43378,16 @@ function automatedPositioning({
|
|
|
43224
43378
|
error: DRAW_DEFINITION_NOT_FOUND
|
|
43225
43379
|
};
|
|
43226
43380
|
const participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
43227
|
-
|
|
43381
|
+
return automatedPositioning$1({
|
|
43382
|
+
applyPositioning,
|
|
43228
43383
|
drawDefinition,
|
|
43229
43384
|
participants,
|
|
43230
43385
|
structureId,
|
|
43231
43386
|
seedsOnly
|
|
43232
43387
|
});
|
|
43233
|
-
return result.error ? result : result !== null && result !== void 0 && (_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.length ? {
|
|
43234
|
-
error: result.errors
|
|
43235
|
-
} : SUCCESS;
|
|
43236
43388
|
}
|
|
43237
43389
|
function automatedPlayoffPositioning({
|
|
43390
|
+
applyPositioning = true,
|
|
43238
43391
|
candidatesCount = 1,
|
|
43239
43392
|
tournamentRecord,
|
|
43240
43393
|
drawDefinition,
|
|
@@ -43248,13 +43401,21 @@ function automatedPlayoffPositioning({
|
|
|
43248
43401
|
if (!drawDefinition) return {
|
|
43249
43402
|
error: DRAW_DEFINITION_NOT_FOUND
|
|
43250
43403
|
};
|
|
43251
|
-
const
|
|
43404
|
+
const structureIsComplete = isCompletedStructure({
|
|
43405
|
+
drawDefinition,
|
|
43406
|
+
structureId
|
|
43407
|
+
});
|
|
43408
|
+
if (!structureIsComplete) return {
|
|
43409
|
+
error: INCOMPLETE_SOURCE_STRUCTURE
|
|
43410
|
+
};
|
|
43252
43411
|
const {
|
|
43253
43412
|
playoffStructures
|
|
43254
43413
|
} = getPlayoffStructures({
|
|
43255
43414
|
drawDefinition,
|
|
43256
43415
|
structureId
|
|
43257
43416
|
});
|
|
43417
|
+
const structurePositionAssignments = [];
|
|
43418
|
+
const participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
|
|
43258
43419
|
|
|
43259
43420
|
if (playoffStructures) {
|
|
43260
43421
|
for (const structure of playoffStructures) {
|
|
@@ -43263,16 +43424,22 @@ function automatedPlayoffPositioning({
|
|
|
43263
43424
|
} = structure;
|
|
43264
43425
|
const result = automatedPositioning$1({
|
|
43265
43426
|
structureId: playoffStructureId,
|
|
43427
|
+
applyPositioning,
|
|
43266
43428
|
candidatesCount,
|
|
43267
43429
|
drawDefinition,
|
|
43268
43430
|
participants,
|
|
43269
43431
|
seedsOnly
|
|
43270
43432
|
});
|
|
43271
43433
|
if (result.error) return result;
|
|
43434
|
+
structurePositionAssignments.push({
|
|
43435
|
+
positionAssignments: result.positionAssignments,
|
|
43436
|
+
structureId: playoffStructureId
|
|
43437
|
+
});
|
|
43272
43438
|
}
|
|
43273
43439
|
}
|
|
43274
43440
|
|
|
43275
|
-
return { ...SUCCESS
|
|
43441
|
+
return { ...SUCCESS,
|
|
43442
|
+
structurePositionAssignments
|
|
43276
43443
|
};
|
|
43277
43444
|
}
|
|
43278
43445
|
|
|
@@ -45122,6 +45289,10 @@ function setEntryPositions({
|
|
|
45122
45289
|
};
|
|
45123
45290
|
}
|
|
45124
45291
|
|
|
45292
|
+
function setPositionAssignments(params) {
|
|
45293
|
+
return setPositionAssignments$1(params);
|
|
45294
|
+
}
|
|
45295
|
+
|
|
45125
45296
|
function addDrawDefinitionTimeItem({
|
|
45126
45297
|
drawDefinition,
|
|
45127
45298
|
timeItem
|
|
@@ -46367,6 +46538,7 @@ const eventGovernor = {
|
|
|
46367
46538
|
setDrawParticipantRepresentativeIds,
|
|
46368
46539
|
getDrawParticipantRepresentativeIds,
|
|
46369
46540
|
luckyLoserDrawPositionAssignment,
|
|
46541
|
+
setPositionAssignments,
|
|
46370
46542
|
automatedPositioning,
|
|
46371
46543
|
automatedPlayoffPositioning,
|
|
46372
46544
|
checkInParticipant,
|
|
@@ -52255,7 +52427,8 @@ function generateEventWithDraw({
|
|
|
52255
52427
|
tournamentRecord,
|
|
52256
52428
|
drawDefinition,
|
|
52257
52429
|
event
|
|
52258
|
-
});
|
|
52430
|
+
}); // ignore when positioning cannot occur because of incomplete source structure
|
|
52431
|
+
|
|
52259
52432
|
const playoffCompletionGoal = completionGoal ? completionGoal - completedCount : undefined;
|
|
52260
52433
|
result = completeDrawMatchUps({
|
|
52261
52434
|
completionGoal: completionGoal ? playoffCompletionGoal : undefined,
|
|
@@ -52642,16 +52815,16 @@ function generateSchedulingProfile({
|
|
|
52642
52815
|
let structureId = targetMatchUp.structureId;
|
|
52643
52816
|
|
|
52644
52817
|
if (roundNumber && !winnerFinishingPositionRange) {
|
|
52645
|
-
structureId = Object.keys(containedStructures).find(containingStructureId => containedStructures[containingStructureId].includes(structureId));
|
|
52818
|
+
structureId = Object.keys(containedStructures).find(containingStructureId => containedStructures[containingStructureId].includes(structureId)) || structureId;
|
|
52646
52819
|
}
|
|
52647
52820
|
|
|
52648
52821
|
const roundToSchedule = {
|
|
52649
52822
|
tournamentId,
|
|
52650
|
-
eventId,
|
|
52651
|
-
drawId,
|
|
52652
52823
|
structureId,
|
|
52653
52824
|
roundNumber,
|
|
52654
|
-
roundSegment
|
|
52825
|
+
roundSegment,
|
|
52826
|
+
eventId,
|
|
52827
|
+
drawId
|
|
52655
52828
|
};
|
|
52656
52829
|
let result = addSchedulingProfileRound({
|
|
52657
52830
|
tournamentRecords: {
|
|
@@ -53011,7 +53184,9 @@ const venueConstants = {
|
|
|
53011
53184
|
};
|
|
53012
53185
|
|
|
53013
53186
|
const factoryConstants = {
|
|
53187
|
+
activeMatchUpStatuses,
|
|
53014
53188
|
auditConstants,
|
|
53189
|
+
directingMatchUpStatuses,
|
|
53015
53190
|
drawDefinitionConstants,
|
|
53016
53191
|
entryStatusConstants,
|
|
53017
53192
|
errorConditionConstants,
|
|
@@ -53023,13 +53198,16 @@ const factoryConstants = {
|
|
|
53023
53198
|
matchUpActionConstants,
|
|
53024
53199
|
matchUpStatusConstants,
|
|
53025
53200
|
matchUpTypes,
|
|
53201
|
+
nonDirectingMatchUpStatuses,
|
|
53026
53202
|
participantConstants,
|
|
53027
53203
|
participantRoles,
|
|
53204
|
+
particicipantsRequiredMatchUpStatuses,
|
|
53028
53205
|
participantTypes,
|
|
53029
53206
|
penaltyConstants,
|
|
53030
53207
|
policyConstants,
|
|
53031
53208
|
positionActionConstants,
|
|
53032
53209
|
ratingConstants,
|
|
53210
|
+
recoveryTimeRequiredMatchUpStatuses,
|
|
53033
53211
|
requestConstants,
|
|
53034
53212
|
resultConstants,
|
|
53035
53213
|
scaleConstants,
|
|
@@ -53038,6 +53216,8 @@ const factoryConstants = {
|
|
|
53038
53216
|
tieFormatConstants,
|
|
53039
53217
|
timeItemConstants,
|
|
53040
53218
|
topicConstants,
|
|
53219
|
+
upcomingMatchUpStatuses,
|
|
53220
|
+
validMatchUpStatuses,
|
|
53041
53221
|
venueConstants
|
|
53042
53222
|
};
|
|
53043
53223
|
|