tods-competition-factory 1.8.12 → 1.8.14
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.mjs +8 -8
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +21 -13
- package/dist/forge/query.mjs +28 -23
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +42 -27
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs +4 -4
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +318 -162
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +582 -314
- 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 +4 -4
|
@@ -99,98 +99,6 @@ function tiebreakFormat(tieobject) {
|
|
|
99
99
|
return undefined;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
function ensureInt(val) {
|
|
103
|
-
if (typeof val === 'number')
|
|
104
|
-
return parseInt(val.toString());
|
|
105
|
-
return parseInt(val);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function isPowerOf2(n) {
|
|
109
|
-
if (isNaN(n))
|
|
110
|
-
return false;
|
|
111
|
-
return n && (n & (n - 1)) === 0;
|
|
112
|
-
}
|
|
113
|
-
function deriveExponent(n) {
|
|
114
|
-
if (!isPowerOf2(n))
|
|
115
|
-
return false;
|
|
116
|
-
var m = n;
|
|
117
|
-
var i = 1;
|
|
118
|
-
while (m !== 2) {
|
|
119
|
-
i += 1;
|
|
120
|
-
m = m / 2;
|
|
121
|
-
}
|
|
122
|
-
return i;
|
|
123
|
-
}
|
|
124
|
-
function coerceEven(n) {
|
|
125
|
-
return isNaN(n) ? 0 : (n % 2 && n + 1) || n;
|
|
126
|
-
}
|
|
127
|
-
function nearestPowerOf2(val) {
|
|
128
|
-
return Math.pow(2, Math.round(Math.log(val) / Math.log(2)));
|
|
129
|
-
}
|
|
130
|
-
function isNumeric(value) {
|
|
131
|
-
return !isNaN(parseFloat(value));
|
|
132
|
-
}
|
|
133
|
-
function isOdd(num) {
|
|
134
|
-
var numInt = ensureInt(num);
|
|
135
|
-
if (isNaN(numInt))
|
|
136
|
-
return undefined;
|
|
137
|
-
if (numInt === 0)
|
|
138
|
-
return false;
|
|
139
|
-
return (numInt & -numInt) === 1;
|
|
140
|
-
}
|
|
141
|
-
function nextPowerOf2(n) {
|
|
142
|
-
if (isNaN(n))
|
|
143
|
-
return false;
|
|
144
|
-
while (!isPowerOf2(n)) {
|
|
145
|
-
n++;
|
|
146
|
-
}
|
|
147
|
-
return n;
|
|
148
|
-
}
|
|
149
|
-
function randomInt(min, max) {
|
|
150
|
-
min = Math.ceil(min);
|
|
151
|
-
max = Math.floor(max);
|
|
152
|
-
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
153
|
-
}
|
|
154
|
-
// does accept e.e. '1.0'
|
|
155
|
-
function isConvertableInteger(n) {
|
|
156
|
-
return Number.isSafeInteger(typeof n === 'string' ? +n : n);
|
|
157
|
-
}
|
|
158
|
-
// produces an approximated normal distribution between 0 and max
|
|
159
|
-
function weightedRandom(max, weight, round) {
|
|
160
|
-
if (max === void 0) { max = 1; }
|
|
161
|
-
if (weight === void 0) { weight = 3; }
|
|
162
|
-
if (round === void 0) { round = true; }
|
|
163
|
-
var num = 0;
|
|
164
|
-
for (var i = 0; i < weight; i++) {
|
|
165
|
-
num += Math.random() * (max / weight);
|
|
166
|
-
}
|
|
167
|
-
return round && max > 1 ? Math.round(num) : num;
|
|
168
|
-
}
|
|
169
|
-
// round to nearest step, e.g. 0.25
|
|
170
|
-
function stepRound(value, step) {
|
|
171
|
-
step || (step = 1.0);
|
|
172
|
-
var inv = 1.0 / step;
|
|
173
|
-
return Math.round(value * inv) / inv;
|
|
174
|
-
}
|
|
175
|
-
function skewedDistribution(min, max, skew, step, significantDecimals) {
|
|
176
|
-
if (significantDecimals === void 0) { significantDecimals = 2; }
|
|
177
|
-
var u = 1 - Math.random();
|
|
178
|
-
var v = 1 - Math.random();
|
|
179
|
-
var num = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
|
180
|
-
num = num / 10.0 + 0.5;
|
|
181
|
-
if (num > 1 || num < 0) {
|
|
182
|
-
num = skewedDistribution(min, max, skew);
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
num = Math.pow(num, skew);
|
|
186
|
-
num *= max - min;
|
|
187
|
-
num += min;
|
|
188
|
-
}
|
|
189
|
-
if (step)
|
|
190
|
-
num = stepRound(num, step);
|
|
191
|
-
return parseFloat(num.toFixed(significantDecimals));
|
|
192
|
-
}
|
|
193
|
-
|
|
194
102
|
/******************************************************************************
|
|
195
103
|
Copyright (c) Microsoft Corporation.
|
|
196
104
|
|
|
@@ -392,6 +300,109 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
392
300
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
393
301
|
};
|
|
394
302
|
|
|
303
|
+
function numericSort(a, b) {
|
|
304
|
+
return a - b;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function ensureInt(val) {
|
|
308
|
+
if (typeof val === 'number')
|
|
309
|
+
return parseInt(val.toString());
|
|
310
|
+
return parseInt(val);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
function isPowerOf2(n) {
|
|
314
|
+
if (isNaN(n))
|
|
315
|
+
return false;
|
|
316
|
+
return n && (n & (n - 1)) === 0;
|
|
317
|
+
}
|
|
318
|
+
function median(arr) {
|
|
319
|
+
if (!arr.length)
|
|
320
|
+
return undefined;
|
|
321
|
+
var s = __spreadArray([], __read(arr), false).sort(numericSort);
|
|
322
|
+
var mid = Math.floor(s.length / 2);
|
|
323
|
+
return s.length % 2 ? s[mid] : (s[mid - 1] + s[mid]) / 2;
|
|
324
|
+
}
|
|
325
|
+
function deriveExponent(n) {
|
|
326
|
+
if (!isPowerOf2(n))
|
|
327
|
+
return false;
|
|
328
|
+
var m = n;
|
|
329
|
+
var i = 1;
|
|
330
|
+
while (m !== 2) {
|
|
331
|
+
i += 1;
|
|
332
|
+
m = m / 2;
|
|
333
|
+
}
|
|
334
|
+
return i;
|
|
335
|
+
}
|
|
336
|
+
function coerceEven(n) {
|
|
337
|
+
return isNaN(n) ? 0 : (n % 2 && n + 1) || n;
|
|
338
|
+
}
|
|
339
|
+
function nearestPowerOf2(val) {
|
|
340
|
+
return Math.pow(2, Math.round(Math.log(val) / Math.log(2)));
|
|
341
|
+
}
|
|
342
|
+
function isNumeric(value) {
|
|
343
|
+
return !isNaN(parseFloat(value));
|
|
344
|
+
}
|
|
345
|
+
function isOdd(num) {
|
|
346
|
+
var numInt = ensureInt(num);
|
|
347
|
+
if (isNaN(numInt))
|
|
348
|
+
return undefined;
|
|
349
|
+
if (numInt === 0)
|
|
350
|
+
return false;
|
|
351
|
+
return (numInt & -numInt) === 1;
|
|
352
|
+
}
|
|
353
|
+
function nextPowerOf2(n) {
|
|
354
|
+
if (isNaN(n))
|
|
355
|
+
return false;
|
|
356
|
+
while (!isPowerOf2(n)) {
|
|
357
|
+
n++;
|
|
358
|
+
}
|
|
359
|
+
return n;
|
|
360
|
+
}
|
|
361
|
+
function randomInt(min, max) {
|
|
362
|
+
min = Math.ceil(min);
|
|
363
|
+
max = Math.floor(max);
|
|
364
|
+
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
365
|
+
}
|
|
366
|
+
// does accept e.e. '1.0'
|
|
367
|
+
function isConvertableInteger(n) {
|
|
368
|
+
return Number.isSafeInteger(typeof n === 'string' ? +n : n);
|
|
369
|
+
}
|
|
370
|
+
// produces an approximated normal distribution between 0 and max
|
|
371
|
+
function weightedRandom(max, weight, round) {
|
|
372
|
+
if (max === void 0) { max = 1; }
|
|
373
|
+
if (weight === void 0) { weight = 3; }
|
|
374
|
+
if (round === void 0) { round = true; }
|
|
375
|
+
var num = 0;
|
|
376
|
+
for (var i = 0; i < weight; i++) {
|
|
377
|
+
num += Math.random() * (max / weight);
|
|
378
|
+
}
|
|
379
|
+
return round && max > 1 ? Math.round(num) : num;
|
|
380
|
+
}
|
|
381
|
+
// round to nearest step, e.g. 0.25
|
|
382
|
+
function stepRound(value, step) {
|
|
383
|
+
step || (step = 1.0);
|
|
384
|
+
var inv = 1.0 / step;
|
|
385
|
+
return Math.round(value * inv) / inv;
|
|
386
|
+
}
|
|
387
|
+
function skewedDistribution(min, max, skew, step, significantDecimals) {
|
|
388
|
+
if (significantDecimals === void 0) { significantDecimals = 2; }
|
|
389
|
+
var u = 1 - Math.random();
|
|
390
|
+
var v = 1 - Math.random();
|
|
391
|
+
var num = Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v);
|
|
392
|
+
num = num / 10.0 + 0.5;
|
|
393
|
+
if (num > 1 || num < 0) {
|
|
394
|
+
num = skewedDistribution(min, max, skew);
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
num = Math.pow(num, skew);
|
|
398
|
+
num *= max - min;
|
|
399
|
+
num += min;
|
|
400
|
+
}
|
|
401
|
+
if (step)
|
|
402
|
+
num = stepRound(num, step);
|
|
403
|
+
return parseFloat(num.toFixed(significantDecimals));
|
|
404
|
+
}
|
|
405
|
+
|
|
395
406
|
// returns only unique values within an array
|
|
396
407
|
function unique(arr) {
|
|
397
408
|
return arr.filter(function (item, i, s) { return s.lastIndexOf(item) === i; });
|
|
@@ -2491,10 +2502,6 @@ function generateTimeCode(index) {
|
|
|
2491
2502
|
return uidate.getTime().toString(36).slice(-6).toUpperCase();
|
|
2492
2503
|
}
|
|
2493
2504
|
|
|
2494
|
-
function numericSort(a, b) {
|
|
2495
|
-
return a - b;
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
2505
|
/**
|
|
2499
2506
|
*
|
|
2500
2507
|
* @param {object[]} arrayOfJSON - JSON objects array
|
|
@@ -2898,7 +2905,7 @@ var matchUpFormatCode = {
|
|
|
2898
2905
|
};
|
|
2899
2906
|
|
|
2900
2907
|
function factoryVersion() {
|
|
2901
|
-
return '1.8.
|
|
2908
|
+
return '1.8.14';
|
|
2902
2909
|
}
|
|
2903
2910
|
|
|
2904
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -6173,41 +6180,6 @@ function getFlightProfile(_a) {
|
|
|
6173
6180
|
return { flightProfile: flightProfile };
|
|
6174
6181
|
}
|
|
6175
6182
|
|
|
6176
|
-
function getEvent(_a) {
|
|
6177
|
-
var _b;
|
|
6178
|
-
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, event = _a.event, context = _a.context;
|
|
6179
|
-
if (!tournamentRecord)
|
|
6180
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
6181
|
-
if (!event)
|
|
6182
|
-
return { error: MISSING_EVENT };
|
|
6183
|
-
var eventCopy = makeDeepCopy(event);
|
|
6184
|
-
if (context)
|
|
6185
|
-
Object.assign(eventCopy, context);
|
|
6186
|
-
var drawDefinitionCopy = drawDefinition &&
|
|
6187
|
-
((_b = eventCopy.drawDefinitions) === null || _b === void 0 ? void 0 : _b.find(function (_a) {
|
|
6188
|
-
var drawId = _a.drawId;
|
|
6189
|
-
return drawDefinition.drawId === drawId;
|
|
6190
|
-
}));
|
|
6191
|
-
return definedAttributes({
|
|
6192
|
-
event: eventCopy,
|
|
6193
|
-
drawDefinition: drawDefinitionCopy,
|
|
6194
|
-
});
|
|
6195
|
-
}
|
|
6196
|
-
function getEvents(_a) {
|
|
6197
|
-
var tournamentRecord = _a.tournamentRecord, context = _a.context, inContext = _a.inContext;
|
|
6198
|
-
if (!tournamentRecord)
|
|
6199
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
6200
|
-
var tournamentId = tournamentRecord.tournamentId;
|
|
6201
|
-
var eventCopies = (tournamentRecord.events || []).map(function (event) {
|
|
6202
|
-
var eventCopy = makeDeepCopy(event);
|
|
6203
|
-
if (context)
|
|
6204
|
-
Object.assign(eventCopy, context);
|
|
6205
|
-
if (inContext)
|
|
6206
|
-
Object.assign(eventCopy, { tournamentId: tournamentId });
|
|
6207
|
-
return eventCopy;
|
|
6208
|
-
});
|
|
6209
|
-
return { events: eventCopies };
|
|
6210
|
-
}
|
|
6211
6183
|
function findEvent(_a) {
|
|
6212
6184
|
var _b;
|
|
6213
6185
|
var tournamentRecord = _a.tournamentRecord, eventId = _a.eventId, drawId = _a.drawId;
|
|
@@ -6254,27 +6226,6 @@ function findEvent(_a) {
|
|
|
6254
6226
|
stack: stack,
|
|
6255
6227
|
}));
|
|
6256
6228
|
}
|
|
6257
|
-
function getDrawDefinition$2(_a) {
|
|
6258
|
-
var tournamentRecord = _a.tournamentRecord, drawId = _a.drawId;
|
|
6259
|
-
if (!tournamentRecord)
|
|
6260
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
6261
|
-
if (!drawId) {
|
|
6262
|
-
return { error: MISSING_DRAW_ID };
|
|
6263
|
-
}
|
|
6264
|
-
var target = (tournamentRecord.events || []).reduce(function (target, event) {
|
|
6265
|
-
var candidate = (event.drawDefinitions || []).reduce(function (drawDefinition, candidate) {
|
|
6266
|
-
return candidate.drawId === drawId ? candidate : drawDefinition;
|
|
6267
|
-
}, undefined);
|
|
6268
|
-
return candidate && candidate.drawId === drawId
|
|
6269
|
-
? { event: event, drawDefinition: candidate }
|
|
6270
|
-
: target;
|
|
6271
|
-
}, undefined);
|
|
6272
|
-
return target
|
|
6273
|
-
? __assign(__assign({}, target), { SUCCESS: SUCCESS }) : decorateResult({
|
|
6274
|
-
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
6275
|
-
stack: 'getDrawDefinition',
|
|
6276
|
-
});
|
|
6277
|
-
}
|
|
6278
6229
|
|
|
6279
6230
|
function addExtension$1(params) {
|
|
6280
6231
|
var _a;
|
|
@@ -18234,8 +18185,9 @@ function getMatchUpDependencies(params) {
|
|
|
18234
18185
|
tournamentRecords = (_a = {}, _a[tournamentRecord.tournamentId] = tournamentRecord, _a);
|
|
18235
18186
|
var allTournamentRecords = Object.values(tournamentRecords);
|
|
18236
18187
|
var allLinks = allTournamentRecords.reduce(function (allLinks, tournamentRecord) {
|
|
18188
|
+
var _a;
|
|
18237
18189
|
return allLinks
|
|
18238
|
-
.concat(tournamentRecord.events
|
|
18190
|
+
.concat((_a = tournamentRecord.events) !== null && _a !== void 0 ? _a : [])
|
|
18239
18191
|
.map(function (event) {
|
|
18240
18192
|
return (event.drawDefinitions || []).map(function (drawDefinition) { return drawDefinition.links || []; });
|
|
18241
18193
|
})
|
|
@@ -18277,7 +18229,7 @@ function getMatchUpDependencies(params) {
|
|
|
18277
18229
|
finally { if (e_1) throw e_1.error; }
|
|
18278
18230
|
}
|
|
18279
18231
|
try {
|
|
18280
|
-
for (var _j = __values(matchUps
|
|
18232
|
+
for (var _j = __values(matchUps !== null && matchUps !== void 0 ? matchUps : []), _k = _j.next(); !_k.done; _k = _j.next()) {
|
|
18281
18233
|
var matchUp = _k.value;
|
|
18282
18234
|
// pertains to Round Robins and e.g. Swiss rounds; Round Robins require hoisting to containing structure
|
|
18283
18235
|
var sourceStructureId = matchUp.containerStructureId || matchUp.structureId;
|
|
@@ -18980,6 +18932,27 @@ function removeExtraneousAttributes(matchUps, matchUpFormatMap) {
|
|
|
18980
18932
|
}
|
|
18981
18933
|
}
|
|
18982
18934
|
|
|
18935
|
+
function getAssignedParticipantIds(_a) {
|
|
18936
|
+
var drawDefinition = _a.drawDefinition, stages = _a.stages;
|
|
18937
|
+
if (!drawDefinition)
|
|
18938
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
18939
|
+
var stageStructures = ((drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || []).filter(function (structure) {
|
|
18940
|
+
return !(stages === null || stages === void 0 ? void 0 : stages.length) || (structure.stage && stages.includes(structure.stage));
|
|
18941
|
+
});
|
|
18942
|
+
var assignedParticipantIds = unique(stageStructures
|
|
18943
|
+
.map(function (structure) {
|
|
18944
|
+
var positionAssignments = getPositionAssignments$1({
|
|
18945
|
+
structure: structure,
|
|
18946
|
+
}).positionAssignments;
|
|
18947
|
+
return positionAssignments
|
|
18948
|
+
? positionAssignments.map(extractAttributes('participantId'))
|
|
18949
|
+
: [];
|
|
18950
|
+
})
|
|
18951
|
+
.flat()
|
|
18952
|
+
.filter(Boolean));
|
|
18953
|
+
return __assign(__assign({}, SUCCESS), { assignedParticipantIds: assignedParticipantIds });
|
|
18954
|
+
}
|
|
18955
|
+
|
|
18983
18956
|
function participantScaleItem(_a) {
|
|
18984
18957
|
var _b, _c;
|
|
18985
18958
|
var requireTimeStamp = _a.requireTimeStamp, scaleAttributes = _a.scaleAttributes, participant = _a.participant;
|
|
@@ -22545,10 +22518,80 @@ function addMatchUpResumeTime$2(_a) {
|
|
|
22545
22518
|
}
|
|
22546
22519
|
}
|
|
22547
22520
|
|
|
22521
|
+
// Returns arrays of all drawIds and eventIds across tournamentRecords
|
|
22522
|
+
// Returns an combined array of drawIds and eventIds for each tournamentId
|
|
22523
|
+
function getEventIdsAndDrawIds(_a) {
|
|
22524
|
+
var tournamentRecords = _a.tournamentRecords;
|
|
22525
|
+
if (!tournamentRecords)
|
|
22526
|
+
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
22527
|
+
var tournamentIds = Object.keys(tournamentRecords);
|
|
22528
|
+
return tournamentIds.reduce(function (aggregator, tournamentId) {
|
|
22529
|
+
var _a, _b, _c;
|
|
22530
|
+
aggregator.tournamentIdMap[tournamentId] = [];
|
|
22531
|
+
var tournamentRecord = tournamentRecords[tournamentId];
|
|
22532
|
+
var events = tournamentRecord.events || [];
|
|
22533
|
+
var eventIds = events.map(function (_a) {
|
|
22534
|
+
var eventId = _a.eventId;
|
|
22535
|
+
return eventId;
|
|
22536
|
+
});
|
|
22537
|
+
var drawIds = events
|
|
22538
|
+
.map(function (event) {
|
|
22539
|
+
return (event.drawDefinitions || []).map(function (_a) {
|
|
22540
|
+
var drawId = _a.drawId;
|
|
22541
|
+
return drawId;
|
|
22542
|
+
});
|
|
22543
|
+
})
|
|
22544
|
+
.flat();
|
|
22545
|
+
(_a = aggregator.tournamentIdMap[tournamentId]).push.apply(_a, __spreadArray(__spreadArray([], __read(eventIds), false), __read(drawIds), false));
|
|
22546
|
+
(_b = aggregator.eventIds).push.apply(_b, __spreadArray([], __read(eventIds), false));
|
|
22547
|
+
(_c = aggregator.drawIds).push.apply(_c, __spreadArray([], __read(drawIds), false));
|
|
22548
|
+
return aggregator;
|
|
22549
|
+
}, { eventIds: [], drawIds: [], tournamentIdMap: {} });
|
|
22550
|
+
}
|
|
22551
|
+
|
|
22552
|
+
function findTournamentId(_a) {
|
|
22553
|
+
var tournamentRecords = _a.tournamentRecords, eventId = _a.eventId, drawId = _a.drawId;
|
|
22554
|
+
var tournamentIdMap = getEventIdsAndDrawIds({ tournamentRecords: tournamentRecords }).tournamentIdMap;
|
|
22555
|
+
var tournamentIds = tournamentIdMap
|
|
22556
|
+
? Object.keys(tournamentIdMap)
|
|
22557
|
+
: [];
|
|
22558
|
+
return tournamentIds.find(function (tournamentId) {
|
|
22559
|
+
return (eventId && (tournamentIdMap === null || tournamentIdMap === void 0 ? void 0 : tournamentIdMap[tournamentId].includes(eventId))) ||
|
|
22560
|
+
(drawId && (tournamentIdMap === null || tournamentIdMap === void 0 ? void 0 : tournamentIdMap[tournamentId].includes(drawId)));
|
|
22561
|
+
});
|
|
22562
|
+
}
|
|
22563
|
+
|
|
22564
|
+
function getDrawDefinition$1(_a) {
|
|
22565
|
+
var tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, tournamentId = _a.tournamentId, drawId = _a.drawId;
|
|
22566
|
+
if (!tournamentRecord && !tournamentRecords)
|
|
22567
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22568
|
+
if (!drawId)
|
|
22569
|
+
return { error: MISSING_DRAW_ID };
|
|
22570
|
+
if (!tournamentRecord && tournamentRecords) {
|
|
22571
|
+
if (typeof tournamentId !== 'string') {
|
|
22572
|
+
// find tournamentId by brute force if not provided
|
|
22573
|
+
tournamentId = findTournamentId({ tournamentRecords: tournamentRecords, drawId: drawId });
|
|
22574
|
+
if (!tournamentId)
|
|
22575
|
+
return { error: MISSING_TOURNAMENT_ID };
|
|
22576
|
+
}
|
|
22577
|
+
tournamentRecord = tournamentRecords[tournamentId];
|
|
22578
|
+
if (!tournamentRecord)
|
|
22579
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22580
|
+
}
|
|
22581
|
+
var result = tournamentRecord && findEvent({ tournamentRecord: tournamentRecord, drawId: drawId });
|
|
22582
|
+
if (!(result === null || result === void 0 ? void 0 : result.drawDefinition)) {
|
|
22583
|
+
return decorateResult({
|
|
22584
|
+
result: { error: DRAW_DEFINITION_NOT_FOUND },
|
|
22585
|
+
stack: 'getDrawDefinition',
|
|
22586
|
+
});
|
|
22587
|
+
}
|
|
22588
|
+
return __assign({ drawDefinition: result.drawDefinition, event: result.event, tournamentRecord: tournamentRecord }, SUCCESS);
|
|
22589
|
+
}
|
|
22590
|
+
|
|
22548
22591
|
function bulkScheduleMatchUps$1(_a) {
|
|
22549
22592
|
var e_1, _b, e_2, _c;
|
|
22550
|
-
var _d, _e, _f;
|
|
22551
|
-
var
|
|
22593
|
+
var _d, _e, _f, _g;
|
|
22594
|
+
var _h = _a.errorOnAnachronism, errorOnAnachronism = _h === void 0 ? false : _h, _j = _a.checkChronology, checkChronology = _j === void 0 ? true : _j, matchUpDependencies = _a.matchUpDependencies, tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, matchUpDetails = _a.matchUpDetails, matchUpIds = _a.matchUpIds, schedule = _a.schedule;
|
|
22552
22595
|
if (!tournamentRecord)
|
|
22553
22596
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22554
22597
|
if (!matchUpDetails && (!matchUpIds || !Array.isArray(matchUpIds)))
|
|
@@ -22569,9 +22612,9 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22569
22612
|
// if inContextMatchUps retrieved in previous step, skip this step
|
|
22570
22613
|
if (!inContextMatchUps) {
|
|
22571
22614
|
inContextMatchUps =
|
|
22572
|
-
((_d = allTournamentMatchUps({
|
|
22615
|
+
(_e = (_d = allTournamentMatchUps({
|
|
22573
22616
|
tournamentRecord: tournamentRecord,
|
|
22574
|
-
})) === null || _d === void 0 ? void 0 : _d.matchUps)
|
|
22617
|
+
})) === null || _d === void 0 ? void 0 : _d.matchUps) !== null && _e !== void 0 ? _e : [];
|
|
22575
22618
|
}
|
|
22576
22619
|
// first organize matchUpIds by drawId
|
|
22577
22620
|
var drawIdMap = inContextMatchUps.reduce(function (drawIdMap, matchUp) {
|
|
@@ -22586,22 +22629,22 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22586
22629
|
}, {});
|
|
22587
22630
|
var detailMatchUpIds = matchUpDetails === null || matchUpDetails === void 0 ? void 0 : matchUpDetails.map(function (detail) { return detail.matchUpId; });
|
|
22588
22631
|
try {
|
|
22589
|
-
for (var
|
|
22590
|
-
var drawId =
|
|
22591
|
-
var drawDefinition = getDrawDefinition$
|
|
22632
|
+
for (var _k = __values(Object.keys(drawIdMap)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
22633
|
+
var drawId = _l.value;
|
|
22634
|
+
var drawDefinition = getDrawDefinition$1({
|
|
22592
22635
|
tournamentRecord: tournamentRecord,
|
|
22593
22636
|
drawId: drawId,
|
|
22594
22637
|
}).drawDefinition;
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
});
|
|
22638
|
+
if (!drawDefinition)
|
|
22639
|
+
continue;
|
|
22640
|
+
var drawMatchUpIds = drawIdMap[drawId].filter(function (matchUpId) { var _a; return (_a = matchUpIds === null || matchUpIds === void 0 ? void 0 : matchUpIds.includes(matchUpId)) !== null && _a !== void 0 ? _a : detailMatchUpIds === null || detailMatchUpIds === void 0 ? void 0 : detailMatchUpIds.includes(matchUpId); });
|
|
22598
22641
|
// optimize matchUp retrieval
|
|
22599
22642
|
var drawMatchUps = allDrawMatchUps$1({
|
|
22600
22643
|
inContext: false,
|
|
22601
22644
|
drawDefinition: drawDefinition,
|
|
22602
22645
|
}).matchUps;
|
|
22603
22646
|
var _loop_1 = function (matchUpId) {
|
|
22604
|
-
var matchUpSchedule = ((
|
|
22647
|
+
var matchUpSchedule = ((_f = matchUpDetails === null || matchUpDetails === void 0 ? void 0 : matchUpDetails.find(function (details) { return details.matchUpId === matchUpId; })) === null || _f === void 0 ? void 0 : _f.schedule) || schedule;
|
|
22605
22648
|
var result = addMatchUpScheduleItems$2({
|
|
22606
22649
|
schedule: matchUpSchedule,
|
|
22607
22650
|
matchUpDependencies: matchUpDependencies,
|
|
@@ -22614,7 +22657,7 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22614
22657
|
drawMatchUps: drawMatchUps,
|
|
22615
22658
|
matchUpId: matchUpId,
|
|
22616
22659
|
});
|
|
22617
|
-
if ((
|
|
22660
|
+
if ((_g = result === null || result === void 0 ? void 0 : result.warnings) === null || _g === void 0 ? void 0 : _g.length)
|
|
22618
22661
|
warnings.push.apply(warnings, __spreadArray([], __read(result.warnings), false));
|
|
22619
22662
|
if (result === null || result === void 0 ? void 0 : result.success)
|
|
22620
22663
|
scheduled += 1;
|
|
@@ -22641,7 +22684,7 @@ function bulkScheduleMatchUps$1(_a) {
|
|
|
22641
22684
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22642
22685
|
finally {
|
|
22643
22686
|
try {
|
|
22644
|
-
if (
|
|
22687
|
+
if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
|
|
22645
22688
|
}
|
|
22646
22689
|
finally { if (e_1) throw e_1.error; }
|
|
22647
22690
|
}
|
|
@@ -22706,49 +22749,6 @@ function bulkScheduleMatchUps(_a) {
|
|
|
22706
22749
|
? __assign(__assign({}, SUCCESS), { scheduled: scheduled, warnings: warnings }) : __assign(__assign({}, SUCCESS), { scheduled: scheduled });
|
|
22707
22750
|
}
|
|
22708
22751
|
|
|
22709
|
-
// Returns arrays of all drawIds and eventIds across tournamentRecords
|
|
22710
|
-
// Returns an combined array of drawIds and eventIds for each tournamentId
|
|
22711
|
-
function getEventIdsAndDrawIds(_a) {
|
|
22712
|
-
var tournamentRecords = _a.tournamentRecords;
|
|
22713
|
-
if (!tournamentRecords)
|
|
22714
|
-
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
22715
|
-
var tournamentIds = Object.keys(tournamentRecords);
|
|
22716
|
-
return tournamentIds.reduce(function (aggregator, tournamentId) {
|
|
22717
|
-
var _a, _b, _c;
|
|
22718
|
-
aggregator.tournamentIdMap[tournamentId] = [];
|
|
22719
|
-
var tournamentRecord = tournamentRecords[tournamentId];
|
|
22720
|
-
var events = tournamentRecord.events || [];
|
|
22721
|
-
var eventIds = events.map(function (_a) {
|
|
22722
|
-
var eventId = _a.eventId;
|
|
22723
|
-
return eventId;
|
|
22724
|
-
});
|
|
22725
|
-
var drawIds = events
|
|
22726
|
-
.map(function (event) {
|
|
22727
|
-
return (event.drawDefinitions || []).map(function (_a) {
|
|
22728
|
-
var drawId = _a.drawId;
|
|
22729
|
-
return drawId;
|
|
22730
|
-
});
|
|
22731
|
-
})
|
|
22732
|
-
.flat();
|
|
22733
|
-
(_a = aggregator.tournamentIdMap[tournamentId]).push.apply(_a, __spreadArray(__spreadArray([], __read(eventIds), false), __read(drawIds), false));
|
|
22734
|
-
(_b = aggregator.eventIds).push.apply(_b, __spreadArray([], __read(eventIds), false));
|
|
22735
|
-
(_c = aggregator.drawIds).push.apply(_c, __spreadArray([], __read(drawIds), false));
|
|
22736
|
-
return aggregator;
|
|
22737
|
-
}, { eventIds: [], drawIds: [], tournamentIdMap: {} });
|
|
22738
|
-
}
|
|
22739
|
-
|
|
22740
|
-
function findTournamentId(_a) {
|
|
22741
|
-
var tournamentRecords = _a.tournamentRecords, eventId = _a.eventId, drawId = _a.drawId;
|
|
22742
|
-
var tournamentIdMap = getEventIdsAndDrawIds({ tournamentRecords: tournamentRecords }).tournamentIdMap;
|
|
22743
|
-
var tournamentIds = tournamentIdMap
|
|
22744
|
-
? Object.keys(tournamentIdMap)
|
|
22745
|
-
: [];
|
|
22746
|
-
return tournamentIds.find(function (tournamentId) {
|
|
22747
|
-
return (eventId && (tournamentIdMap === null || tournamentIdMap === void 0 ? void 0 : tournamentIdMap[tournamentId].includes(eventId))) ||
|
|
22748
|
-
(drawId && (tournamentIdMap === null || tournamentIdMap === void 0 ? void 0 : tournamentIdMap[tournamentId].includes(drawId)));
|
|
22749
|
-
});
|
|
22750
|
-
}
|
|
22751
|
-
|
|
22752
22752
|
function getProjectedDualWinningSide(_a) {
|
|
22753
22753
|
var e_1, _b;
|
|
22754
22754
|
var _c;
|
|
@@ -35587,7 +35587,7 @@ function jinnScheduler(_a) {
|
|
|
35587
35587
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
35588
35588
|
if (tournamentRecord) {
|
|
35589
35589
|
Object.keys(matchUpMap[tournamentId]).forEach(function (drawId) {
|
|
35590
|
-
var drawDefinition = getDrawDefinition$
|
|
35590
|
+
var drawDefinition = getDrawDefinition$1({
|
|
35591
35591
|
tournamentRecord: tournamentRecord,
|
|
35592
35592
|
drawId: drawId,
|
|
35593
35593
|
}).drawDefinition;
|
|
@@ -36090,7 +36090,7 @@ function proScheduler(_a) {
|
|
|
36090
36090
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
36091
36091
|
if (tournamentRecord) {
|
|
36092
36092
|
Object.keys(matchUpMap[tournamentId]).forEach(function (drawId) {
|
|
36093
|
-
var drawDefinition = getDrawDefinition$
|
|
36093
|
+
var drawDefinition = getDrawDefinition$1({
|
|
36094
36094
|
tournamentRecord: tournamentRecord,
|
|
36095
36095
|
drawId: drawId,
|
|
36096
36096
|
}).drawDefinition;
|
|
@@ -36914,7 +36914,7 @@ function toggleParticipantCheckInState(params) {
|
|
|
36914
36914
|
if (!tournamentRecords || !tournamentId || !participantId || !matchUpId)
|
|
36915
36915
|
return { error: MISSING_VALUE, stack: 'toggleParticipantCheckInState' };
|
|
36916
36916
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
36917
|
-
var _a = getDrawDefinition$
|
|
36917
|
+
var _a = getDrawDefinition$1({
|
|
36918
36918
|
tournamentRecord: tournamentRecord,
|
|
36919
36919
|
drawId: drawId,
|
|
36920
36920
|
}), drawDefinition = _a.drawDefinition, event = _a.event;
|
|
@@ -36923,7 +36923,7 @@ function toggleParticipantCheckInState(params) {
|
|
|
36923
36923
|
}
|
|
36924
36924
|
|
|
36925
36925
|
function removeMatchUpCourtAssignment$1(params) {
|
|
36926
|
-
var _a;
|
|
36926
|
+
var _a, _b;
|
|
36927
36927
|
var tournamentRecords = params.tournamentRecords;
|
|
36928
36928
|
if (!tournamentRecords)
|
|
36929
36929
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
@@ -36931,16 +36931,18 @@ function removeMatchUpCourtAssignment$1(params) {
|
|
|
36931
36931
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
36932
36932
|
if (!tournamentRecord)
|
|
36933
36933
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36934
|
-
var
|
|
36934
|
+
var _c = getDrawDefinition$1({
|
|
36935
36935
|
tournamentRecord: tournamentRecord,
|
|
36936
36936
|
drawId: drawId,
|
|
36937
|
-
}), drawDefinition =
|
|
36937
|
+
}), drawDefinition = _c.drawDefinition, event = _c.event;
|
|
36938
|
+
if (!drawDefinition)
|
|
36939
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
36938
36940
|
var result = findMatchUp$1({ drawDefinition: drawDefinition, event: event, matchUpId: matchUpId });
|
|
36939
36941
|
if (result.error)
|
|
36940
36942
|
return result;
|
|
36941
36943
|
if (((_a = result === null || result === void 0 ? void 0 : result.matchUp) === null || _a === void 0 ? void 0 : _a.matchUpType) === TEAM_MATCHUP) {
|
|
36942
36944
|
var allocatedCourts = latestVisibleTimeItemValue({
|
|
36943
|
-
timeItems: result.matchUp.timeItems
|
|
36945
|
+
timeItems: (_b = result.matchUp.timeItems) !== null && _b !== void 0 ? _b : [],
|
|
36944
36946
|
itemType: ALLOCATE_COURTS,
|
|
36945
36947
|
}).itemValue;
|
|
36946
36948
|
var itemValue = courtId && allocatedCourts.filter(function (court) { return court.courtId !== courtId; });
|
|
@@ -37053,12 +37055,13 @@ function bulkUpdateCourtAssignments(_a) {
|
|
|
37053
37055
|
* @returns scheduledMatchUpIds, individualParticipantProfiles
|
|
37054
37056
|
*/
|
|
37055
37057
|
function scheduleMatchUps(_a) {
|
|
37058
|
+
var _b;
|
|
37056
37059
|
var tournamentRecords = _a.tournamentRecords, competitionMatchUps = _a.competitionMatchUps, // optimization for scheduleProfileRounds to pass this is as it has already processed
|
|
37057
37060
|
matchUpDependencies = _a.matchUpDependencies, // optimization for scheduleProfileRounds to pass this is as it has already processed
|
|
37058
|
-
|
|
37059
|
-
allDateMatchUpIds =
|
|
37060
|
-
|
|
37061
|
-
matchUpPotentialParticipantIds =
|
|
37061
|
+
_c = _a.allDateMatchUpIds, // optimization for scheduleProfileRounds to pass this is as it has already processed
|
|
37062
|
+
allDateMatchUpIds = _c === void 0 ? [] : _c, _d = _a.averageMatchUpMinutes, averageMatchUpMinutes = _d === void 0 ? 90 : _d, _e = _a.recoveryMinutes, recoveryMinutes = _e === void 0 ? 0 : _e, recoveryMinutesMap = _a.recoveryMinutesMap, // for matchUpIds batched by averageMatchUpMinutes this enables varying recoveryMinutes
|
|
37063
|
+
_f = _a.matchUpPotentialParticipantIds, // for matchUpIds batched by averageMatchUpMinutes this enables varying recoveryMinutes
|
|
37064
|
+
matchUpPotentialParticipantIds = _f === void 0 ? {} : _f, _g = _a.individualParticipantProfiles, individualParticipantProfiles = _g === void 0 ? {} : _g, _h = _a.matchUpNotBeforeTimes, matchUpNotBeforeTimes = _h === void 0 ? {} : _h, _j = _a.matchUpDailyLimits, matchUpDailyLimits = _j === void 0 ? {} : _j, _k = _a.checkPotentialRequestConflicts, checkPotentialRequestConflicts = _k === void 0 ? true : _k, remainingScheduleTimes = _a.remainingScheduleTimes, clearScheduleDates = _a.clearScheduleDates, _l = _a.periodLength, periodLength = _l === void 0 ? 30 : _l, scheduleDate = _a.scheduleDate, matchUpIds = _a.matchUpIds, venueIds = _a.venueIds, startTime = _a.startTime, endTime = _a.endTime, dryRun = _a.dryRun;
|
|
37062
37065
|
if (!tournamentRecords)
|
|
37063
37066
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
37064
37067
|
if (!matchUpIds)
|
|
@@ -37103,7 +37106,7 @@ function scheduleMatchUps(_a) {
|
|
|
37103
37106
|
.filter(Boolean);
|
|
37104
37107
|
// determines court availability taking into account already scheduled matchUps on the scheduleDate
|
|
37105
37108
|
// optimization to pass already retrieved competitionMatchUps to avoid refetch (requires refactor)
|
|
37106
|
-
var
|
|
37109
|
+
var _m = calculateScheduleTimes({
|
|
37107
37110
|
tournamentRecords: tournamentRecords,
|
|
37108
37111
|
remainingScheduleTimes: remainingScheduleTimes,
|
|
37109
37112
|
startTime: extractTime(startTime),
|
|
@@ -37113,7 +37116,7 @@ function scheduleMatchUps(_a) {
|
|
|
37113
37116
|
clearScheduleDates: clearScheduleDates,
|
|
37114
37117
|
periodLength: periodLength,
|
|
37115
37118
|
venueIds: venueIds,
|
|
37116
|
-
}), venueId =
|
|
37119
|
+
}), venueId = _m.venueId, scheduleTimes = _m.scheduleTimes, dateScheduledMatchUpIds = _m.dateScheduledMatchUpIds;
|
|
37117
37120
|
var requestConflicts = {};
|
|
37118
37121
|
var skippedScheduleTimes = [];
|
|
37119
37122
|
var matchUpScheduleTimes = {};
|
|
@@ -37164,7 +37167,7 @@ function scheduleMatchUps(_a) {
|
|
|
37164
37167
|
});
|
|
37165
37168
|
// for optimization, build up an object for each tournament and an array for each draw with target matchUps
|
|
37166
37169
|
// keep track of matchUps counts per participant and don't add matchUps for participants beyond those limits
|
|
37167
|
-
var
|
|
37170
|
+
var _o = matchUpsToSchedule.reduce(function (aggregator, matchUp) {
|
|
37168
37171
|
var _a;
|
|
37169
37172
|
var drawId = matchUp.drawId, tournamentId = matchUp.tournamentId, matchUpType = matchUp.matchUpType;
|
|
37170
37173
|
var _b = checkDailyLimits({
|
|
@@ -37208,13 +37211,13 @@ function scheduleMatchUps(_a) {
|
|
|
37208
37211
|
matchUp: matchUp,
|
|
37209
37212
|
});
|
|
37210
37213
|
return aggregator;
|
|
37211
|
-
}, { matchUpMap: {}, overLimitMatchUpIds: [], participantIdsAtLimit: [] }), matchUpMap =
|
|
37214
|
+
}, { matchUpMap: {}, overLimitMatchUpIds: [], participantIdsAtLimit: [] }), matchUpMap = _o.matchUpMap, overLimitMatchUpIds = _o.overLimitMatchUpIds, participantIdsAtLimit = _o.participantIdsAtLimit;
|
|
37212
37215
|
matchUpsToSchedule = matchUpsToSchedule.filter(function (_a) {
|
|
37213
37216
|
var matchUpId = _a.matchUpId;
|
|
37214
37217
|
return !overLimitMatchUpIds.includes(matchUpId);
|
|
37215
37218
|
});
|
|
37216
37219
|
var iterations = 0;
|
|
37217
|
-
var failSafe = (scheduleTimes === null || scheduleTimes === void 0 ? void 0 : scheduleTimes.length)
|
|
37220
|
+
var failSafe = (_b = scheduleTimes === null || scheduleTimes === void 0 ? void 0 : scheduleTimes.length) !== null && _b !== void 0 ? _b : 0;
|
|
37218
37221
|
var personRequests = getPersonRequests({
|
|
37219
37222
|
tournamentRecords: tournamentRecords,
|
|
37220
37223
|
requestType: DO_NOT_SCHEDULE,
|
|
@@ -37308,7 +37311,7 @@ function scheduleMatchUps(_a) {
|
|
|
37308
37311
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
37309
37312
|
if (tournamentRecord) {
|
|
37310
37313
|
Object.keys(matchUpMap[tournamentId]).forEach(function (drawId) {
|
|
37311
|
-
var drawDefinition = getDrawDefinition$
|
|
37314
|
+
var drawDefinition = getDrawDefinition$1({
|
|
37312
37315
|
tournamentRecord: tournamentRecord,
|
|
37313
37316
|
drawId: drawId,
|
|
37314
37317
|
}).drawDefinition;
|
|
@@ -37347,10 +37350,6 @@ function scheduleMatchUps(_a) {
|
|
|
37347
37350
|
}
|
|
37348
37351
|
});
|
|
37349
37352
|
}
|
|
37350
|
-
else {
|
|
37351
|
-
if (getDevContext())
|
|
37352
|
-
console.log(MISSING_TOURNAMENT_ID);
|
|
37353
|
-
}
|
|
37354
37353
|
});
|
|
37355
37354
|
var noTimeMatchUpIds = getMatchUpIds(matchUpsToSchedule);
|
|
37356
37355
|
return __assign(__assign({}, SUCCESS), { requestConflicts: Object.values(requestConflicts), remainingScheduleTimes: scheduleTimes === null || scheduleTimes === void 0 ? void 0 : scheduleTimes.map(function (_a) {
|
|
@@ -37409,10 +37408,12 @@ function reorderUpcomingMatchUps(params) {
|
|
|
37409
37408
|
function assignMatchUpScheduledTime(_a) {
|
|
37410
37409
|
var tournamentId = _a.tournamentId, scheduledTime = _a.scheduledTime, matchUpId = _a.matchUpId, drawId = _a.drawId;
|
|
37411
37410
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
37412
|
-
var drawDefinition = getDrawDefinition$
|
|
37411
|
+
var drawDefinition = getDrawDefinition$1({
|
|
37413
37412
|
tournamentRecord: tournamentRecord,
|
|
37414
37413
|
drawId: drawId,
|
|
37415
37414
|
}).drawDefinition;
|
|
37415
|
+
if (!drawDefinition)
|
|
37416
|
+
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
37416
37417
|
return addMatchUpScheduledTime$2({
|
|
37417
37418
|
drawDefinition: drawDefinition,
|
|
37418
37419
|
scheduledTime: scheduledTime,
|
|
@@ -37677,6 +37678,7 @@ function addMatchUpOfficial$1(_a) {
|
|
|
37677
37678
|
*/
|
|
37678
37679
|
function bulkRescheduleMatchUps$1(_a) {
|
|
37679
37680
|
var e_1, _b, e_2, _c;
|
|
37681
|
+
var _d;
|
|
37680
37682
|
var tournamentRecord = _a.tournamentRecord, scheduleChange = _a.scheduleChange, matchUpIds = _a.matchUpIds, dryRun = _a.dryRun;
|
|
37681
37683
|
if (!tournamentRecord)
|
|
37682
37684
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -37722,9 +37724,9 @@ function bulkRescheduleMatchUps$1(_a) {
|
|
|
37722
37724
|
}, {});
|
|
37723
37725
|
var dayTotalMinutes = 1440;
|
|
37724
37726
|
try {
|
|
37725
|
-
for (var
|
|
37726
|
-
var drawId =
|
|
37727
|
-
var result = getDrawDefinition$
|
|
37727
|
+
for (var _e = __values(Object.keys(drawIdMap)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
37728
|
+
var drawId = _f.value;
|
|
37729
|
+
var result = getDrawDefinition$1({
|
|
37728
37730
|
tournamentRecord: tournamentRecord,
|
|
37729
37731
|
drawId: drawId,
|
|
37730
37732
|
});
|
|
@@ -37811,14 +37813,14 @@ function bulkRescheduleMatchUps$1(_a) {
|
|
|
37811
37813
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
37812
37814
|
finally {
|
|
37813
37815
|
try {
|
|
37814
|
-
if (
|
|
37816
|
+
if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
|
|
37815
37817
|
}
|
|
37816
37818
|
finally { if (e_1) throw e_1.error; }
|
|
37817
37819
|
}
|
|
37818
|
-
var updatedInContext = allTournamentMatchUps({
|
|
37820
|
+
var updatedInContext = (_d = allTournamentMatchUps({
|
|
37819
37821
|
matchUpFilters: { matchUpIds: matchUpIds },
|
|
37820
37822
|
tournamentRecord: tournamentRecord,
|
|
37821
|
-
}).matchUps
|
|
37823
|
+
}).matchUps) !== null && _d !== void 0 ? _d : [];
|
|
37822
37824
|
var rescheduled = updatedInContext.filter(function (_a) {
|
|
37823
37825
|
var matchUpId = _a.matchUpId;
|
|
37824
37826
|
return rescheduledMatchUpIds.includes(matchUpId);
|
|
@@ -38161,7 +38163,7 @@ function matchUpScheduleChange(params) {
|
|
|
38161
38163
|
function assignMatchUp(params) {
|
|
38162
38164
|
var tournamentRecords = params.tournamentRecords, tournamentId = params.tournamentId, matchUp = params.matchUp, drawId = params.drawId;
|
|
38163
38165
|
var tournamentRecord = tournamentRecords[tournamentId];
|
|
38164
|
-
var drawDefinition = getDrawDefinition$
|
|
38166
|
+
var drawDefinition = getDrawDefinition$1({
|
|
38165
38167
|
tournamentRecord: tournamentRecord,
|
|
38166
38168
|
drawId: drawId,
|
|
38167
38169
|
}).drawDefinition;
|
|
@@ -38557,29 +38559,6 @@ function addMatchUpCourtOrder(params) {
|
|
|
38557
38559
|
matchUpId: matchUpId,
|
|
38558
38560
|
});
|
|
38559
38561
|
}
|
|
38560
|
-
function getDrawDefinition$1(_a) {
|
|
38561
|
-
var tournamentRecords = _a.tournamentRecords, tournamentId = _a.tournamentId, drawId = _a.drawId;
|
|
38562
|
-
if (!tournamentRecords)
|
|
38563
|
-
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
38564
|
-
if (!drawId)
|
|
38565
|
-
return { error: MISSING_DRAW_ID };
|
|
38566
|
-
if (typeof tournamentId !== 'string') {
|
|
38567
|
-
// find tournamentId by brute force if not provided
|
|
38568
|
-
tournamentId = findTournamentId({ tournamentRecords: tournamentRecords, drawId: drawId });
|
|
38569
|
-
if (!tournamentId)
|
|
38570
|
-
return { error: MISSING_TOURNAMENT_ID };
|
|
38571
|
-
}
|
|
38572
|
-
var tournamentRecord = tournamentRecords[tournamentId];
|
|
38573
|
-
if (!tournamentRecord)
|
|
38574
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
38575
|
-
var result = findEvent({ tournamentRecord: tournamentRecord, drawId: drawId });
|
|
38576
|
-
if (result.error)
|
|
38577
|
-
return decorateResult({
|
|
38578
|
-
stack: 'addScheduleItems.getDrawDefinition',
|
|
38579
|
-
result: result,
|
|
38580
|
-
});
|
|
38581
|
-
return { drawDefinition: result.drawDefinition, tournamentRecord: tournamentRecord };
|
|
38582
|
-
}
|
|
38583
38562
|
|
|
38584
38563
|
var scheduleGovernor$1 = {
|
|
38585
38564
|
scheduleMatchUps: scheduleMatchUps,
|
|
@@ -40045,6 +40024,7 @@ function enableVenues(_a) {
|
|
|
40045
40024
|
}
|
|
40046
40025
|
|
|
40047
40026
|
function removeCourtAssignment(_a) {
|
|
40027
|
+
var _b;
|
|
40048
40028
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, drawId = _a.drawId;
|
|
40049
40029
|
var stack = 'removeCourtAssignment';
|
|
40050
40030
|
if (!matchUpId)
|
|
@@ -40063,8 +40043,7 @@ function removeCourtAssignment(_a) {
|
|
|
40063
40043
|
else {
|
|
40064
40044
|
if (!tournamentRecord)
|
|
40065
40045
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
40066
|
-
var matchUps = allTournamentMatchUps({ tournamentRecord: tournamentRecord, inContext: false }).matchUps
|
|
40067
|
-
[];
|
|
40046
|
+
var matchUps = (_b = allTournamentMatchUps({ tournamentRecord: tournamentRecord, inContext: false }).matchUps) !== null && _b !== void 0 ? _b : [];
|
|
40068
40047
|
(matchUp = getMatchUp$1({ matchUps: matchUps, matchUpId: matchUpId }).matchUp);
|
|
40069
40048
|
}
|
|
40070
40049
|
if (!matchUp)
|
|
@@ -44507,15 +44486,8 @@ function organizeDrawPositionOptions(_a) {
|
|
|
44507
44486
|
}
|
|
44508
44487
|
}
|
|
44509
44488
|
|
|
44510
|
-
/**
|
|
44511
|
-
*
|
|
44512
|
-
* @param {string[]} participantIds
|
|
44513
|
-
* @param {string[]} positionAssignments - assignment objects which associate drawPositions with participantIds
|
|
44514
|
-
*
|
|
44515
|
-
* Returns an array of participantsIds which have not been assigned
|
|
44516
|
-
*/
|
|
44517
44489
|
function getUnplacedParticipantIds(_a) {
|
|
44518
|
-
var
|
|
44490
|
+
var positionAssignments = _a.positionAssignments, participantIds = _a.participantIds;
|
|
44519
44491
|
var assignedParticipantIds = positionAssignments.map(function (assignment) { return assignment.participantId; });
|
|
44520
44492
|
return participantIds.filter(function (participantId) { return !assignedParticipantIds.includes(participantId); });
|
|
44521
44493
|
}
|
|
@@ -48313,23 +48285,6 @@ function setPositionAssignments$1(_a) {
|
|
|
48313
48285
|
return __assign({}, SUCCESS);
|
|
48314
48286
|
}
|
|
48315
48287
|
|
|
48316
|
-
function getAssignedParticipantIds(_a) {
|
|
48317
|
-
var drawDefinition = _a.drawDefinition, stages = _a.stages;
|
|
48318
|
-
var stageStructures = ((drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) || []).filter(function (structure) {
|
|
48319
|
-
return !(stages === null || stages === void 0 ? void 0 : stages.length) || (structure.stage && stages.includes(structure.stage));
|
|
48320
|
-
});
|
|
48321
|
-
return stageStructures
|
|
48322
|
-
.map(function (structure) {
|
|
48323
|
-
var positionAssignments = getPositionAssignments$1({
|
|
48324
|
-
structure: structure,
|
|
48325
|
-
}).positionAssignments;
|
|
48326
|
-
return positionAssignments
|
|
48327
|
-
? positionAssignments.map(extractAttributes('participantId'))
|
|
48328
|
-
: [];
|
|
48329
|
-
})
|
|
48330
|
-
.flat();
|
|
48331
|
-
}
|
|
48332
|
-
|
|
48333
48288
|
/**
|
|
48334
48289
|
*
|
|
48335
48290
|
* @param {object[]} entries - array of entry objects
|
|
@@ -48407,10 +48362,11 @@ function modifyEntriesStatus(_a) {
|
|
|
48407
48362
|
// build up an array of participantIds which are assigned positions in structures
|
|
48408
48363
|
var assignedParticipantIds = [];
|
|
48409
48364
|
(_d = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _d === void 0 ? void 0 : _d.forEach(function (drawDefinition) {
|
|
48410
|
-
var
|
|
48365
|
+
var _a;
|
|
48366
|
+
var participantIds = (_a = getAssignedParticipantIds({
|
|
48411
48367
|
stages: stage && [stage],
|
|
48412
48368
|
drawDefinition: drawDefinition,
|
|
48413
|
-
});
|
|
48369
|
+
}).assignedParticipantIds) !== null && _a !== void 0 ? _a : [];
|
|
48414
48370
|
assignedParticipantIds.push.apply(assignedParticipantIds, __spreadArray([], __read(participantIds), false));
|
|
48415
48371
|
});
|
|
48416
48372
|
var tournamentParticipants = (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) || [];
|
|
@@ -48922,7 +48878,7 @@ function removeEventEntries(_a) {
|
|
|
48922
48878
|
return decorateResult({ result: { error: INVALID_PARTICIPANT_ID }, stack: stack });
|
|
48923
48879
|
}
|
|
48924
48880
|
// do not filter by stages; must kmow all participantIds assigned to any stage!
|
|
48925
|
-
var assignedParticipantIds = ((_b = event.drawDefinitions) !== null && _b !== void 0 ? _b : []).flatMap(function (drawDefinition) { return getAssignedParticipantIds({ drawDefinition: drawDefinition }); });
|
|
48881
|
+
var assignedParticipantIds = ((_b = event.drawDefinitions) !== null && _b !== void 0 ? _b : []).flatMap(function (drawDefinition) { var _a; return (_a = getAssignedParticipantIds({ drawDefinition: drawDefinition }).assignedParticipantIds) !== null && _a !== void 0 ? _a : []; });
|
|
48926
48882
|
var statusParticipantIds = (((entryStatuses === null || entryStatuses === void 0 ? void 0 : entryStatuses.length) &&
|
|
48927
48883
|
((_c = event.entries) === null || _c === void 0 ? void 0 : _c.filter(function (entry) {
|
|
48928
48884
|
return entry.entryStatus && entryStatuses.includes(entry.entryStatus);
|
|
@@ -52010,8 +51966,8 @@ function getValidSwapAction(_a) {
|
|
|
52010
51966
|
}
|
|
52011
51967
|
|
|
52012
51968
|
function positionActions$1(params) {
|
|
52013
|
-
var _a, _b, _c;
|
|
52014
|
-
var specifiedPolicyDefinitions = params.policyDefinitions,
|
|
51969
|
+
var _a, _b, _c, _d;
|
|
51970
|
+
var specifiedPolicyDefinitions = params.policyDefinitions, _e = params.tournamentParticipants, tournamentParticipants = _e === void 0 ? [] : _e, _f = params.returnParticipants, returnParticipants = _f === void 0 ? true : _f, provisionalPositioning = params.provisionalPositioning, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, drawPosition = params.drawPosition, event = params.event;
|
|
52015
51971
|
if (!event)
|
|
52016
51972
|
return { error: MISSING_EVENT };
|
|
52017
51973
|
if (!drawDefinition)
|
|
@@ -52049,12 +52005,12 @@ function positionActions$1(params) {
|
|
|
52049
52005
|
event: event,
|
|
52050
52006
|
}).appliedPolicies) !== null && _a !== void 0 ? _a : {};
|
|
52051
52007
|
Object.assign(appliedPolicies, specifiedPolicyDefinitions !== null && specifiedPolicyDefinitions !== void 0 ? specifiedPolicyDefinitions : {});
|
|
52052
|
-
var
|
|
52008
|
+
var _g = getEnabledStructures({
|
|
52053
52009
|
actionType: POSITION_ACTION,
|
|
52054
52010
|
appliedPolicies: appliedPolicies,
|
|
52055
52011
|
drawDefinition: drawDefinition,
|
|
52056
52012
|
structure: structure,
|
|
52057
|
-
}), positionActionsPolicy =
|
|
52013
|
+
}), positionActionsPolicy = _g.actionsPolicy, enabledStructures = _g.enabledStructures, actionsDisabled = _g.actionsDisabled;
|
|
52058
52014
|
var activePositionOverrides = (positionActionsPolicy === null || positionActionsPolicy === void 0 ? void 0 : positionActionsPolicy.activePositionOverrides) || [];
|
|
52059
52015
|
// targetRoundNumber will be > 1 for fed positions
|
|
52060
52016
|
var positionSourceStructureIds = (getSourceStructureIdsAndRelevantLinks({
|
|
@@ -52086,7 +52042,7 @@ function positionActions$1(params) {
|
|
|
52086
52042
|
structure.stageSequence !== 1;
|
|
52087
52043
|
var drawId = drawDefinition.drawId;
|
|
52088
52044
|
var validActions = [];
|
|
52089
|
-
var
|
|
52045
|
+
var _h = structureAssignedDrawPositions({ structure: structure }), assignedPositions = _h.assignedPositions, positionAssignments = _h.positionAssignments;
|
|
52090
52046
|
var positionAssignment = assignedPositions === null || assignedPositions === void 0 ? void 0 : assignedPositions.find(function (assignment) { return assignment.drawPosition === drawPosition; });
|
|
52091
52047
|
var drawPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(function (assignment) { return assignment.drawPosition; });
|
|
52092
52048
|
if (!(drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(drawPosition)))
|
|
@@ -52106,10 +52062,10 @@ function positionActions$1(params) {
|
|
|
52106
52062
|
structureId: structureId,
|
|
52107
52063
|
stages: stages,
|
|
52108
52064
|
});
|
|
52109
|
-
var stageAssignedParticipantIds = getAssignedParticipantIds({
|
|
52065
|
+
var stageAssignedParticipantIds = (_b = getAssignedParticipantIds({
|
|
52110
52066
|
drawDefinition: drawDefinition,
|
|
52111
52067
|
stages: stages,
|
|
52112
|
-
});
|
|
52068
|
+
}).assignedParticipantIds) !== null && _b !== void 0 ? _b : [];
|
|
52113
52069
|
var unassignedParticipantIds = stageEntries
|
|
52114
52070
|
.filter(function (entry) { return !stageAssignedParticipantIds.includes(entry.participantId); })
|
|
52115
52071
|
.map(function (entry) { return entry.participantId; });
|
|
@@ -52208,7 +52164,7 @@ function positionActions$1(params) {
|
|
|
52208
52164
|
drawDefinition: drawDefinition,
|
|
52209
52165
|
structure: structure,
|
|
52210
52166
|
}).seedAssignments;
|
|
52211
|
-
var
|
|
52167
|
+
var _j = (_c = seedAssignments === null || seedAssignments === void 0 ? void 0 : seedAssignments.find(function (assignment) { return assignment.participantId === participantId; })) !== null && _c !== void 0 ? _c : {}, seedNumber = _j.seedNumber, seedValue = _j.seedValue;
|
|
52212
52168
|
validActions.push({
|
|
52213
52169
|
type: SEED_VALUE,
|
|
52214
52170
|
method: SEED_VALUE_METHOD,
|
|
@@ -52236,7 +52192,7 @@ function positionActions$1(params) {
|
|
|
52236
52192
|
drawDefinition: drawDefinition,
|
|
52237
52193
|
structure: structure,
|
|
52238
52194
|
}).seedAssignments;
|
|
52239
|
-
var seedNumber = ((
|
|
52195
|
+
var seedNumber = ((_d = seedAssignments === null || seedAssignments === void 0 ? void 0 : seedAssignments.find(function (assignment) { return assignment.participantId === participantId; })) !== null && _d !== void 0 ? _d : {}).seedNumber;
|
|
52240
52196
|
validActions.push({
|
|
52241
52197
|
method: REMOVE_SEED_METHOD,
|
|
52242
52198
|
type: REMOVE_SEED,
|
|
@@ -52461,15 +52417,16 @@ function modifySeedAssignment$1(_a) {
|
|
|
52461
52417
|
}
|
|
52462
52418
|
|
|
52463
52419
|
function removeEntry(_a) {
|
|
52464
|
-
var _b
|
|
52420
|
+
var _b;
|
|
52421
|
+
var _c = _a.autoEntryPositions, autoEntryPositions = _c === void 0 ? true : _c, drawDefinition = _a.drawDefinition, participantId = _a.participantId, stages = _a.stages;
|
|
52465
52422
|
if (!drawDefinition)
|
|
52466
52423
|
return { error: MISSING_DRAW_DEFINITION };
|
|
52467
52424
|
if (!participantId)
|
|
52468
52425
|
return { error: MISSING_PARTICIPANT_ID };
|
|
52469
|
-
var assignedParticipantIds = getAssignedParticipantIds({
|
|
52426
|
+
var assignedParticipantIds = (_b = getAssignedParticipantIds({
|
|
52470
52427
|
drawDefinition: drawDefinition,
|
|
52471
52428
|
stages: stages,
|
|
52472
|
-
});
|
|
52429
|
+
}).assignedParticipantIds) !== null && _b !== void 0 ? _b : [];
|
|
52473
52430
|
var isAssignedParticipant = assignedParticipantIds.includes(participantId);
|
|
52474
52431
|
if (isAssignedParticipant)
|
|
52475
52432
|
return { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
@@ -52492,6 +52449,7 @@ function removeEntry(_a) {
|
|
|
52492
52449
|
ensures entries may not be removed if draw stage is active
|
|
52493
52450
|
*/
|
|
52494
52451
|
var entryGovernor = {
|
|
52452
|
+
getAssignedParticipantIds: getAssignedParticipantIds,
|
|
52495
52453
|
setStageAlternatesCount: setStageAlternatesCount,
|
|
52496
52454
|
setStageWildcardsCount: setStageWildcardsCount,
|
|
52497
52455
|
setStageQualifiersCount: setStageQualifiersCount,
|
|
@@ -56256,8 +56214,8 @@ function setParticipantScaleItem(params) {
|
|
|
56256
56214
|
}
|
|
56257
56215
|
}
|
|
56258
56216
|
}
|
|
56259
|
-
return ((equivalentValue && __assign(__assign({}, SUCCESS), { info: VALUE_UNCHANGED, existingValue: scaleItem.scaleValue })) ||
|
|
56260
|
-
(participant && __assign(__assign({}, SUCCESS), { newValue: scaleItem.scaleValue })) || {
|
|
56217
|
+
return ((equivalentValue && __assign(__assign({}, SUCCESS), { info: VALUE_UNCHANGED, existingValue: scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue })) ||
|
|
56218
|
+
(participant && __assign(__assign({}, SUCCESS), { newValue: scaleItem === null || scaleItem === void 0 ? void 0 : scaleItem.scaleValue })) || {
|
|
56261
56219
|
error: PARTICIPANT_NOT_FOUND,
|
|
56262
56220
|
});
|
|
56263
56221
|
}
|
|
@@ -60228,14 +60186,14 @@ function deleteDrawDefinitions(_a) {
|
|
|
60228
60186
|
action: DELETE_DRAW_DEFINITIONS,
|
|
60229
60187
|
payload: {
|
|
60230
60188
|
drawDefinitions: [drawDefinition],
|
|
60231
|
-
eventId: eventId
|
|
60189
|
+
eventId: eventId !== null && eventId !== void 0 ? eventId : event === null || event === void 0 ? void 0 : event.eventId,
|
|
60232
60190
|
auditData: auditData,
|
|
60233
60191
|
},
|
|
60234
60192
|
};
|
|
60235
60193
|
auditTrail.push(audit);
|
|
60236
60194
|
deletedDrawsDetail.push(definedAttributes({
|
|
60237
60195
|
tournamentId: tournamentRecord.tournamentId,
|
|
60238
|
-
eventId: eventId
|
|
60196
|
+
eventId: eventId !== null && eventId !== void 0 ? eventId : event === null || event === void 0 ? void 0 : event.eventId,
|
|
60239
60197
|
qualifyingPositionAssignments: qualifyingPositionAssignments,
|
|
60240
60198
|
positionAssignments: positionAssignments,
|
|
60241
60199
|
auditData: auditData,
|
|
@@ -61411,18 +61369,18 @@ function modifyPairAssignment(_a) {
|
|
|
61411
61369
|
}
|
|
61412
61370
|
|
|
61413
61371
|
function removeDrawEntries(_a) {
|
|
61414
|
-
var _b;
|
|
61415
|
-
var
|
|
61372
|
+
var _b, _c;
|
|
61373
|
+
var _d = _a.autoEntryPositions, autoEntryPositions = _d === void 0 ? true : _d, participantIds = _a.participantIds, drawDefinition = _a.drawDefinition, drawId = _a.drawId, stages = _a.stages, event = _a.event;
|
|
61416
61374
|
if (!event)
|
|
61417
61375
|
return { error: MISSING_EVENT };
|
|
61418
61376
|
if (!drawId)
|
|
61419
61377
|
return { error: MISSING_DRAW_ID };
|
|
61420
61378
|
if (!(participantIds === null || participantIds === void 0 ? void 0 : participantIds.length))
|
|
61421
61379
|
return { error: MISSING_PARTICIPANT_IDS };
|
|
61422
|
-
var assignedParticipantIds = getAssignedParticipantIds({
|
|
61380
|
+
var assignedParticipantIds = (_b = getAssignedParticipantIds({
|
|
61423
61381
|
drawDefinition: drawDefinition,
|
|
61424
61382
|
stages: stages,
|
|
61425
|
-
});
|
|
61383
|
+
}).assignedParticipantIds) !== null && _b !== void 0 ? _b : [];
|
|
61426
61384
|
var someAssignedParticipantIds = overlap(assignedParticipantIds, participantIds);
|
|
61427
61385
|
if (someAssignedParticipantIds)
|
|
61428
61386
|
return { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT };
|
|
@@ -61431,7 +61389,7 @@ function removeDrawEntries(_a) {
|
|
|
61431
61389
|
return participantIds.includes(entryId) ? false : true;
|
|
61432
61390
|
};
|
|
61433
61391
|
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
61434
|
-
var flight = (
|
|
61392
|
+
var flight = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _c === void 0 ? void 0 : _c.find(function (flight) { return flight.drawId === drawId; });
|
|
61435
61393
|
if (flight === null || flight === void 0 ? void 0 : flight.drawEntries) {
|
|
61436
61394
|
flight.drawEntries = flight.drawEntries.filter(filterEntry);
|
|
61437
61395
|
if (autoEntryPositions) {
|
|
@@ -64250,6 +64208,7 @@ var eventGovernor = {
|
|
|
64250
64208
|
autoSeeding: autoSeeding,
|
|
64251
64209
|
getAvailablePlayoffRounds: getAvailablePlayoffProfiles,
|
|
64252
64210
|
getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
|
|
64211
|
+
getAssignedParticipantIds: getAssignedParticipantIds,
|
|
64253
64212
|
deleteDrawDefinitions: deleteDrawDefinitions,
|
|
64254
64213
|
addPlayoffStructures: addPlayoffStructures,
|
|
64255
64214
|
modifyDrawDefinition: modifyDrawDefinition,
|
|
@@ -64783,6 +64742,312 @@ function getMatchUpsStats(_a) {
|
|
|
64783
64742
|
return __assign({ competitiveBands: Object.assign.apply(Object, __spreadArray([{}], __read(competitiveBands), false)) }, SUCCESS);
|
|
64784
64743
|
}
|
|
64785
64744
|
|
|
64745
|
+
function getEvent(_a) {
|
|
64746
|
+
var _b;
|
|
64747
|
+
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, context = _a.context, event = _a.event;
|
|
64748
|
+
if (!tournamentRecord)
|
|
64749
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
64750
|
+
if (!event)
|
|
64751
|
+
return { error: MISSING_EVENT };
|
|
64752
|
+
var eventCopy = makeDeepCopy(event);
|
|
64753
|
+
if (context)
|
|
64754
|
+
Object.assign(eventCopy, context);
|
|
64755
|
+
var drawDefinitionCopy = drawDefinition &&
|
|
64756
|
+
((_b = eventCopy.drawDefinitions) === null || _b === void 0 ? void 0 : _b.find(function (_a) {
|
|
64757
|
+
var drawId = _a.drawId;
|
|
64758
|
+
return drawDefinition.drawId === drawId;
|
|
64759
|
+
}));
|
|
64760
|
+
return definedAttributes({
|
|
64761
|
+
drawDefinition: drawDefinitionCopy,
|
|
64762
|
+
event: eventCopy,
|
|
64763
|
+
});
|
|
64764
|
+
}
|
|
64765
|
+
function getEvents(_a) {
|
|
64766
|
+
var e_1, _b;
|
|
64767
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
64768
|
+
var tournamentRecord = _a.tournamentRecord, withScaleValues = _a.withScaleValues, scaleEventType = _a.scaleEventType, inContext = _a.inContext, eventIds = _a.eventIds, drawIds = _a.drawIds, context = _a.context;
|
|
64769
|
+
if (!tournamentRecord)
|
|
64770
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
64771
|
+
var tournamentId = tournamentRecord.tournamentId;
|
|
64772
|
+
var eventCopies = ((_c = tournamentRecord.events) !== null && _c !== void 0 ? _c : [])
|
|
64773
|
+
.filter(function (_a) {
|
|
64774
|
+
var eventId = _a.eventId;
|
|
64775
|
+
return !eventIds || (Array.isArray(eventIds) && eventIds.includes(eventId));
|
|
64776
|
+
})
|
|
64777
|
+
.map(function (event) {
|
|
64778
|
+
var eventCopy = makeDeepCopy(event);
|
|
64779
|
+
if (inContext)
|
|
64780
|
+
Object.assign(eventCopy, { tournamentId: tournamentId });
|
|
64781
|
+
if (context)
|
|
64782
|
+
Object.assign(eventCopy, context);
|
|
64783
|
+
return eventCopy;
|
|
64784
|
+
});
|
|
64785
|
+
var eventsMap = {};
|
|
64786
|
+
if (withScaleValues) {
|
|
64787
|
+
var participantMap_1 = getParticipants$1({
|
|
64788
|
+
withScaleValues: true,
|
|
64789
|
+
tournamentRecord: tournamentRecord,
|
|
64790
|
+
}).participantMap;
|
|
64791
|
+
var sum = function (values) {
|
|
64792
|
+
return values.reduce(function (total, value) { return total + parseFloat(value); }, 0);
|
|
64793
|
+
};
|
|
64794
|
+
var _loop_1 = function (event_1) {
|
|
64795
|
+
var e_2, _l, e_3, _m, e_4, _o, e_5, _p, e_6, _q, e_7, _r, e_8, _s;
|
|
64796
|
+
var eventType = scaleEventType !== null && scaleEventType !== void 0 ? scaleEventType : event_1.eventType;
|
|
64797
|
+
var eventId = event_1.eventId;
|
|
64798
|
+
if (!eventsMap[eventId])
|
|
64799
|
+
eventsMap[eventId] = {
|
|
64800
|
+
ratingsStats: {},
|
|
64801
|
+
ratings: {},
|
|
64802
|
+
ranking: {},
|
|
64803
|
+
draws: {},
|
|
64804
|
+
};
|
|
64805
|
+
var selectedEntries = ((_d = event_1.entries) !== null && _d !== void 0 ? _d : []).filter(function (_a) {
|
|
64806
|
+
var entryStatus = _a.entryStatus;
|
|
64807
|
+
return STRUCTURE_SELECTED_STATUSES.includes(entryStatus);
|
|
64808
|
+
});
|
|
64809
|
+
var participantIds = selectedEntries.map(extractAttributes('participantId'));
|
|
64810
|
+
var processParticipant = function (participant) {
|
|
64811
|
+
var e_9, _a;
|
|
64812
|
+
var _b, _c, _d, _e, _f;
|
|
64813
|
+
if ((_b = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _b === void 0 ? void 0 : _b[eventType]) {
|
|
64814
|
+
try {
|
|
64815
|
+
for (var _g = (e_9 = void 0, __values((_d = (_c = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _c === void 0 ? void 0 : _c[eventType]) !== null && _d !== void 0 ? _d : [])), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
64816
|
+
var rating = _h.value;
|
|
64817
|
+
var scaleName = rating.scaleName;
|
|
64818
|
+
if (!eventsMap[eventId].ratings[scaleName])
|
|
64819
|
+
eventsMap[eventId].ratings[scaleName] = [];
|
|
64820
|
+
var accessor = (_e = ratingsParameters[scaleName]) === null || _e === void 0 ? void 0 : _e.accessor;
|
|
64821
|
+
if (accessor) {
|
|
64822
|
+
var value = parseFloat((_f = rating.scaleValue) === null || _f === void 0 ? void 0 : _f[accessor]);
|
|
64823
|
+
if (value)
|
|
64824
|
+
eventsMap[eventId].ratings[scaleName].push(value);
|
|
64825
|
+
}
|
|
64826
|
+
}
|
|
64827
|
+
}
|
|
64828
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
64829
|
+
finally {
|
|
64830
|
+
try {
|
|
64831
|
+
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
|
|
64832
|
+
}
|
|
64833
|
+
finally { if (e_9) throw e_9.error; }
|
|
64834
|
+
}
|
|
64835
|
+
}
|
|
64836
|
+
};
|
|
64837
|
+
try {
|
|
64838
|
+
for (var participantIds_1 = (e_2 = void 0, __values(participantIds)), participantIds_1_1 = participantIds_1.next(); !participantIds_1_1.done; participantIds_1_1 = participantIds_1.next()) {
|
|
64839
|
+
var participantId = participantIds_1_1.value;
|
|
64840
|
+
var participant = (_e = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[participantId]) === null || _e === void 0 ? void 0 : _e.participant;
|
|
64841
|
+
if ((participant === null || participant === void 0 ? void 0 : participant.participantType) !== INDIVIDUAL) {
|
|
64842
|
+
try {
|
|
64843
|
+
for (var _t = (e_3 = void 0, __values((_f = participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) !== null && _f !== void 0 ? _f : [])), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
64844
|
+
var individualParticipantId = _u.value;
|
|
64845
|
+
var individualParticipant = (_g = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[individualParticipantId]) === null || _g === void 0 ? void 0 : _g.participant;
|
|
64846
|
+
processParticipant(individualParticipant);
|
|
64847
|
+
}
|
|
64848
|
+
}
|
|
64849
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
64850
|
+
finally {
|
|
64851
|
+
try {
|
|
64852
|
+
if (_u && !_u.done && (_m = _t.return)) _m.call(_t);
|
|
64853
|
+
}
|
|
64854
|
+
finally { if (e_3) throw e_3.error; }
|
|
64855
|
+
}
|
|
64856
|
+
}
|
|
64857
|
+
else {
|
|
64858
|
+
processParticipant(participant);
|
|
64859
|
+
}
|
|
64860
|
+
}
|
|
64861
|
+
}
|
|
64862
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64863
|
+
finally {
|
|
64864
|
+
try {
|
|
64865
|
+
if (participantIds_1_1 && !participantIds_1_1.done && (_l = participantIds_1.return)) _l.call(participantIds_1);
|
|
64866
|
+
}
|
|
64867
|
+
finally { if (e_2) throw e_2.error; }
|
|
64868
|
+
}
|
|
64869
|
+
// add stats for all event-level entries ratings
|
|
64870
|
+
var ratings = eventsMap[eventId].ratings;
|
|
64871
|
+
try {
|
|
64872
|
+
for (var _v = (e_4 = void 0, __values(Object.keys(ratings))), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
64873
|
+
var scaleName = _w.value;
|
|
64874
|
+
eventsMap[eventId].ratingsStats[scaleName] = {
|
|
64875
|
+
avg: sum(ratings[scaleName]) / ratings[scaleName].length,
|
|
64876
|
+
median: median(ratings[scaleName]),
|
|
64877
|
+
max: Math.max.apply(Math, __spreadArray([], __read(ratings[scaleName]), false)),
|
|
64878
|
+
min: Math.min.apply(Math, __spreadArray([], __read(ratings[scaleName]), false)),
|
|
64879
|
+
};
|
|
64880
|
+
}
|
|
64881
|
+
}
|
|
64882
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
64883
|
+
finally {
|
|
64884
|
+
try {
|
|
64885
|
+
if (_w && !_w.done && (_o = _v.return)) _o.call(_v);
|
|
64886
|
+
}
|
|
64887
|
+
finally { if (e_4) throw e_4.error; }
|
|
64888
|
+
}
|
|
64889
|
+
var processFlight = function (drawId, participantIds) {
|
|
64890
|
+
var e_10, _a, e_11, _b;
|
|
64891
|
+
var _c, _d, _e;
|
|
64892
|
+
var processParticipant = function (participant) {
|
|
64893
|
+
var e_12, _a;
|
|
64894
|
+
var _b, _c, _d, _e, _f;
|
|
64895
|
+
if ((_b = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _b === void 0 ? void 0 : _b[eventType]) {
|
|
64896
|
+
try {
|
|
64897
|
+
for (var _g = (e_12 = void 0, __values((_d = (_c = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _c === void 0 ? void 0 : _c[eventType]) !== null && _d !== void 0 ? _d : [])), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
64898
|
+
var rating = _h.value;
|
|
64899
|
+
var scaleName = rating.scaleName;
|
|
64900
|
+
if (!eventsMap[eventId].draws[drawId].ratings[scaleName])
|
|
64901
|
+
eventsMap[eventId].draws[drawId].ratings[scaleName] = [];
|
|
64902
|
+
var accessor = (_e = ratingsParameters[scaleName]) === null || _e === void 0 ? void 0 : _e.accessor;
|
|
64903
|
+
if (accessor) {
|
|
64904
|
+
var value = parseFloat((_f = rating.scaleValue) === null || _f === void 0 ? void 0 : _f[accessor]);
|
|
64905
|
+
if (value) {
|
|
64906
|
+
eventsMap[eventId].draws[drawId].ratings[scaleName].push(value);
|
|
64907
|
+
}
|
|
64908
|
+
}
|
|
64909
|
+
}
|
|
64910
|
+
}
|
|
64911
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
64912
|
+
finally {
|
|
64913
|
+
try {
|
|
64914
|
+
if (_h && !_h.done && (_a = _g.return)) _a.call(_g);
|
|
64915
|
+
}
|
|
64916
|
+
finally { if (e_12) throw e_12.error; }
|
|
64917
|
+
}
|
|
64918
|
+
}
|
|
64919
|
+
};
|
|
64920
|
+
try {
|
|
64921
|
+
for (var _f = (e_10 = void 0, __values(participantIds.filter(Boolean))), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
64922
|
+
var participantId = _g.value;
|
|
64923
|
+
var participant = (_c = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[participantId]) === null || _c === void 0 ? void 0 : _c.participant;
|
|
64924
|
+
if ((participant === null || participant === void 0 ? void 0 : participant.participantType) !== INDIVIDUAL) {
|
|
64925
|
+
try {
|
|
64926
|
+
for (var _h = (e_11 = void 0, __values((_d = participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) !== null && _d !== void 0 ? _d : [])), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
64927
|
+
var individualParticipantId = _j.value;
|
|
64928
|
+
var individualParticipant = (_e = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[individualParticipantId]) === null || _e === void 0 ? void 0 : _e.participant;
|
|
64929
|
+
processParticipant(individualParticipant);
|
|
64930
|
+
}
|
|
64931
|
+
}
|
|
64932
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
64933
|
+
finally {
|
|
64934
|
+
try {
|
|
64935
|
+
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
64936
|
+
}
|
|
64937
|
+
finally { if (e_11) throw e_11.error; }
|
|
64938
|
+
}
|
|
64939
|
+
}
|
|
64940
|
+
else {
|
|
64941
|
+
processParticipant(participant);
|
|
64942
|
+
}
|
|
64943
|
+
}
|
|
64944
|
+
}
|
|
64945
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
64946
|
+
finally {
|
|
64947
|
+
try {
|
|
64948
|
+
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
64949
|
+
}
|
|
64950
|
+
finally { if (e_10) throw e_10.error; }
|
|
64951
|
+
}
|
|
64952
|
+
};
|
|
64953
|
+
var processedDrawIds = [];
|
|
64954
|
+
var ignoreDrawId = function (drawId) {
|
|
64955
|
+
return ((drawIds === null || drawIds === void 0 ? void 0 : drawIds.length) && drawIds.includes(drawId)) ||
|
|
64956
|
+
processedDrawIds.includes(drawId);
|
|
64957
|
+
};
|
|
64958
|
+
try {
|
|
64959
|
+
for (var _x = (e_5 = void 0, __values((_h = event_1.drawDefinitions) !== null && _h !== void 0 ? _h : [])), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
64960
|
+
var drawDefinition = _y.value;
|
|
64961
|
+
var drawId = drawDefinition.drawId;
|
|
64962
|
+
if (ignoreDrawId(drawId))
|
|
64963
|
+
continue;
|
|
64964
|
+
var participantIds_2 = (_j = getAssignedParticipantIds({
|
|
64965
|
+
drawDefinition: drawDefinition,
|
|
64966
|
+
}).assignedParticipantIds) !== null && _j !== void 0 ? _j : [];
|
|
64967
|
+
if (!eventsMap[eventId].draws[drawId])
|
|
64968
|
+
eventsMap[eventId].draws[drawId] = {
|
|
64969
|
+
ratingsStats: {},
|
|
64970
|
+
ratings: {},
|
|
64971
|
+
ranking: {},
|
|
64972
|
+
};
|
|
64973
|
+
processedDrawIds.push(drawId);
|
|
64974
|
+
processFlight(drawId, participantIds_2);
|
|
64975
|
+
}
|
|
64976
|
+
}
|
|
64977
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
64978
|
+
finally {
|
|
64979
|
+
try {
|
|
64980
|
+
if (_y && !_y.done && (_p = _x.return)) _p.call(_x);
|
|
64981
|
+
}
|
|
64982
|
+
finally { if (e_5) throw e_5.error; }
|
|
64983
|
+
}
|
|
64984
|
+
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
64985
|
+
try {
|
|
64986
|
+
for (var _z = (e_6 = void 0, __values((_k = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) !== null && _k !== void 0 ? _k : [])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
64987
|
+
var flight = _0.value;
|
|
64988
|
+
var drawId = flight.drawId;
|
|
64989
|
+
if (ignoreDrawId(drawId))
|
|
64990
|
+
continue;
|
|
64991
|
+
var participantIds_3 = flight.drawEntries.map(extractAttributes('participantId'));
|
|
64992
|
+
processFlight(drawId, participantIds_3);
|
|
64993
|
+
}
|
|
64994
|
+
}
|
|
64995
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
64996
|
+
finally {
|
|
64997
|
+
try {
|
|
64998
|
+
if (_0 && !_0.done && (_q = _z.return)) _q.call(_z);
|
|
64999
|
+
}
|
|
65000
|
+
finally { if (e_6) throw e_6.error; }
|
|
65001
|
+
}
|
|
65002
|
+
try {
|
|
65003
|
+
for (var processedDrawIds_1 = (e_7 = void 0, __values(processedDrawIds)), processedDrawIds_1_1 = processedDrawIds_1.next(); !processedDrawIds_1_1.done; processedDrawIds_1_1 = processedDrawIds_1.next()) {
|
|
65004
|
+
var drawId = processedDrawIds_1_1.value;
|
|
65005
|
+
var ratings_1 = eventsMap[eventId].draws[drawId].ratings;
|
|
65006
|
+
try {
|
|
65007
|
+
for (var _1 = (e_8 = void 0, __values(Object.keys(ratings_1))), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
65008
|
+
var scaleName = _2.value;
|
|
65009
|
+
eventsMap[eventId].draws[drawId].ratingsStats[scaleName] = {
|
|
65010
|
+
avg: sum(ratings_1[scaleName]) / ratings_1[scaleName].length,
|
|
65011
|
+
max: Math.max.apply(Math, __spreadArray([], __read(ratings_1[scaleName]), false)),
|
|
65012
|
+
min: Math.min.apply(Math, __spreadArray([], __read(ratings_1[scaleName]), false)),
|
|
65013
|
+
median: median(ratings_1[scaleName]),
|
|
65014
|
+
};
|
|
65015
|
+
}
|
|
65016
|
+
}
|
|
65017
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
65018
|
+
finally {
|
|
65019
|
+
try {
|
|
65020
|
+
if (_2 && !_2.done && (_s = _1.return)) _s.call(_1);
|
|
65021
|
+
}
|
|
65022
|
+
finally { if (e_8) throw e_8.error; }
|
|
65023
|
+
}
|
|
65024
|
+
}
|
|
65025
|
+
}
|
|
65026
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
65027
|
+
finally {
|
|
65028
|
+
try {
|
|
65029
|
+
if (processedDrawIds_1_1 && !processedDrawIds_1_1.done && (_r = processedDrawIds_1.return)) _r.call(processedDrawIds_1);
|
|
65030
|
+
}
|
|
65031
|
+
finally { if (e_7) throw e_7.error; }
|
|
65032
|
+
}
|
|
65033
|
+
};
|
|
65034
|
+
try {
|
|
65035
|
+
for (var eventCopies_1 = __values(eventCopies), eventCopies_1_1 = eventCopies_1.next(); !eventCopies_1_1.done; eventCopies_1_1 = eventCopies_1.next()) {
|
|
65036
|
+
var event_1 = eventCopies_1_1.value;
|
|
65037
|
+
_loop_1(event_1);
|
|
65038
|
+
}
|
|
65039
|
+
}
|
|
65040
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
65041
|
+
finally {
|
|
65042
|
+
try {
|
|
65043
|
+
if (eventCopies_1_1 && !eventCopies_1_1.done && (_b = eventCopies_1.return)) _b.call(eventCopies_1);
|
|
65044
|
+
}
|
|
65045
|
+
finally { if (e_1) throw e_1.error; }
|
|
65046
|
+
}
|
|
65047
|
+
}
|
|
65048
|
+
return definedAttributes(__assign({ eventScaleValues: eventsMap, events: eventCopies }, SUCCESS));
|
|
65049
|
+
}
|
|
65050
|
+
|
|
64786
65051
|
/**
|
|
64787
65052
|
*
|
|
64788
65053
|
* @param {object} tournamentRecord - passed in automatically by tournamentEngine
|
|
@@ -64973,6 +65238,8 @@ function getDrawDefinition(_a) {
|
|
|
64973
65238
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition;
|
|
64974
65239
|
if (!tournamentRecord)
|
|
64975
65240
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
65241
|
+
if (!drawDefinition)
|
|
65242
|
+
return { error: MISSING_DRAW_ID };
|
|
64976
65243
|
return { drawDefinition: makeDeepCopy(drawDefinition) };
|
|
64977
65244
|
}
|
|
64978
65245
|
var queryGovernor = {
|
|
@@ -69904,6 +70171,7 @@ var utilities = {
|
|
|
69904
70171
|
generateRange: generateRange,
|
|
69905
70172
|
generateScoreString: generateScoreString,
|
|
69906
70173
|
generateTimeCode: generateTimeCode,
|
|
70174
|
+
getAssignedParticipantIds: getAssignedParticipantIds,
|
|
69907
70175
|
getCategoryAgeDetails: getCategoryAgeDetails,
|
|
69908
70176
|
getScaleValues: getScaleValues,
|
|
69909
70177
|
getTimeItem: getTimeItem,
|