tods-competition-factory 1.8.14 → 1.8.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge/generate.d.ts +1 -0
- package/dist/forge/generate.mjs +103 -82
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +1 -2
- package/dist/forge/query.mjs +69 -58
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.d.ts +1 -0
- package/dist/forge/transform.mjs +51 -43
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +331 -100
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +470 -128
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2905,7 +2905,7 @@ var matchUpFormatCode = {
|
|
|
2905
2905
|
};
|
|
2906
2906
|
|
|
2907
2907
|
function factoryVersion() {
|
|
2908
|
-
return '1.8.
|
|
2908
|
+
return '1.8.16';
|
|
2909
2909
|
}
|
|
2910
2910
|
|
|
2911
2911
|
function getObjectTieFormat(obj) {
|
|
@@ -4190,12 +4190,13 @@ function countSets(_a) {
|
|
|
4190
4190
|
var _c;
|
|
4191
4191
|
var matchUpWinningSide = _a.winningSide, _d = _a.matchUpFormat, matchUpFormat = _d === void 0 ? FORMAT_STANDARD : _d, matchUpStatus = _a.matchUpStatus, tallyPolicy = _a.tallyPolicy, score = _a.score;
|
|
4192
4192
|
var setsTally = [0, 0];
|
|
4193
|
-
var sets =
|
|
4194
|
-
var matchUpWinnerIndex = matchUpWinningSide - 1;
|
|
4193
|
+
var sets = score === null || score === void 0 ? void 0 : score.sets;
|
|
4194
|
+
var matchUpWinnerIndex = typeof matchUpWinningSide === 'number' && matchUpWinningSide - 1;
|
|
4195
4195
|
var parsedMatchUpFormat = parse(matchUpFormat);
|
|
4196
4196
|
var setsToWin = getSetsToWin((_c = parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.bestOf) !== null && _c !== void 0 ? _c : 1);
|
|
4197
|
-
if (
|
|
4198
|
-
(matchUpStatus ===
|
|
4197
|
+
if (typeof matchUpWinnerIndex === 'number' &&
|
|
4198
|
+
((matchUpStatus === DEFAULTED && (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.setsCreditForDefaults)) ||
|
|
4199
|
+
(matchUpStatus === WALKOVER$2 && (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.setsCreditForWalkovers)))) {
|
|
4199
4200
|
// in the case of WALKOVER or DEFAULT, matchUp winner gets full sets to win value
|
|
4200
4201
|
setsTally[matchUpWinnerIndex] = setsToWin;
|
|
4201
4202
|
}
|
|
@@ -4216,7 +4217,7 @@ function countSets(_a) {
|
|
|
4216
4217
|
finally { if (e_1) throw e_1.error; }
|
|
4217
4218
|
}
|
|
4218
4219
|
}
|
|
4219
|
-
if (matchUpStatus === RETIRED$1) {
|
|
4220
|
+
if (typeof matchUpWinnerIndex === 'number' && matchUpStatus === RETIRED$1) {
|
|
4220
4221
|
// if the loser has setsToWin then last set was incomplete and needs to be subtracted from loser
|
|
4221
4222
|
if (+setsTally[1 - matchUpWinnerIndex] === setsToWin)
|
|
4222
4223
|
setsTally[1 - matchUpWinnerIndex] -= 1;
|
|
@@ -4232,14 +4233,15 @@ function countGames(_a) {
|
|
|
4232
4233
|
var sets = (score || {}).sets;
|
|
4233
4234
|
if (!sets)
|
|
4234
4235
|
return [0, 0];
|
|
4235
|
-
var matchUpWinnerIndex = matchUpWinningSide - 1;
|
|
4236
|
+
var matchUpWinnerIndex = typeof matchUpWinningSide === 'number' && matchUpWinningSide - 1;
|
|
4236
4237
|
var parsedMatchUpFormat = parse(matchUpFormat);
|
|
4237
4238
|
var bestOf = (_b = parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.bestOf) !== null && _b !== void 0 ? _b : 1;
|
|
4238
4239
|
var setsToWin = getSetsToWin(bestOf);
|
|
4239
4240
|
var tiebreakAt = ((_c = parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.setFormat) === null || _c === void 0 ? void 0 : _c.tiebreakAt) || 0;
|
|
4240
4241
|
var gamesTally = [[], []];
|
|
4241
|
-
if (
|
|
4242
|
-
(matchUpStatus ===
|
|
4242
|
+
if (typeof matchUpWinnerIndex === 'number' &&
|
|
4243
|
+
((matchUpStatus === DEFAULTED && (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.gamesCreditForDefaults)) ||
|
|
4244
|
+
(matchUpStatus === WALKOVER$2 && (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.gamesCreditForWalkovers)))) {
|
|
4243
4245
|
var gamesForSet = ((_d = parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.setFormat) === null || _d === void 0 ? void 0 : _d.setTo) || 0;
|
|
4244
4246
|
var minimumGameWins = setsToWin * gamesForSet;
|
|
4245
4247
|
gamesTally[matchUpWinnerIndex].push(minimumGameWins);
|
|
@@ -4258,18 +4260,6 @@ function countGames(_a) {
|
|
|
4258
4260
|
gamesTally[0].push(ensureInt(side1Score || 0));
|
|
4259
4261
|
gamesTally[1].push(ensureInt(side2Score || 0));
|
|
4260
4262
|
}
|
|
4261
|
-
// count a tiebreak as a game won
|
|
4262
|
-
/*
|
|
4263
|
-
*if (
|
|
4264
|
-
* !based &&
|
|
4265
|
-
* !isTiebreakSet &&
|
|
4266
|
-
* set.winningSide &&
|
|
4267
|
-
* (side1TiebreakScore || side2TiebreakScore) &&
|
|
4268
|
-
* tallyPolicy?.gamesCreditForTiebreaks !== false
|
|
4269
|
-
*) {
|
|
4270
|
-
* gamesTally[set.winningSide - 1].push(1);
|
|
4271
|
-
*}
|
|
4272
|
-
*/
|
|
4273
4263
|
// count a tiebreak set also as a game won
|
|
4274
4264
|
if (isTiebreakSet &&
|
|
4275
4265
|
set.winningSide &&
|
|
@@ -4278,7 +4268,7 @@ function countGames(_a) {
|
|
|
4278
4268
|
}
|
|
4279
4269
|
});
|
|
4280
4270
|
}
|
|
4281
|
-
if (matchUpStatus === RETIRED$1) {
|
|
4271
|
+
if (matchUpStatus === RETIRED$1 && typeof matchUpWinnerIndex === 'number') {
|
|
4282
4272
|
// setFormat must consider whether retirment occurred in a finalSet which has a different format
|
|
4283
4273
|
var whichFormat = sets.length > setsToWin && (parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.finalSetFormat)
|
|
4284
4274
|
? 'finalSetFormat'
|
|
@@ -4328,9 +4318,10 @@ function countGames(_a) {
|
|
|
4328
4318
|
function countPoints(_a) {
|
|
4329
4319
|
var _b, _c;
|
|
4330
4320
|
var matchUpFormat = _a.matchUpFormat, score = _a.score;
|
|
4331
|
-
var parsedMatchUpFormat = parse(matchUpFormat);
|
|
4321
|
+
var parsedMatchUpFormat = matchUpFormat ? parse(matchUpFormat) : undefined;
|
|
4332
4322
|
var bestOf = (_b = parsedMatchUpFormat === null || parsedMatchUpFormat === void 0 ? void 0 : parsedMatchUpFormat.bestOf) !== null && _b !== void 0 ? _b : 1;
|
|
4333
4323
|
var setsToWin = getSetsToWin(bestOf);
|
|
4324
|
+
var tiebreaksTally = [0, 0];
|
|
4334
4325
|
var pointsTally = [0, 0];
|
|
4335
4326
|
(_c = score === null || score === void 0 ? void 0 : score.sets) === null || _c === void 0 ? void 0 : _c.forEach(function (set, i) {
|
|
4336
4327
|
var _a;
|
|
@@ -4351,9 +4342,11 @@ function countPoints(_a) {
|
|
|
4351
4342
|
pointsTally[0] += ensureInt(set.side1TiebreakScore || 0);
|
|
4352
4343
|
if (set.side2TiebreakScore)
|
|
4353
4344
|
pointsTally[1] += ensureInt(set.side2TiebreakScore || 0);
|
|
4345
|
+
if ((set.side1TiebreakScore || set.side2TiebreakScore) && set.winningSide)
|
|
4346
|
+
tiebreaksTally[set.winningSide - 1] += 1;
|
|
4354
4347
|
}
|
|
4355
4348
|
});
|
|
4356
|
-
return pointsTally;
|
|
4349
|
+
return { pointsTally: pointsTally, tiebreaksTally: tiebreaksTally };
|
|
4357
4350
|
}
|
|
4358
4351
|
function getSetsToWin(bestOfGames) {
|
|
4359
4352
|
return (bestOfGames && Math.ceil(bestOfGames / 2)) || 1;
|
|
@@ -4436,7 +4429,7 @@ var matchUpTypes = {
|
|
|
4436
4429
|
|
|
4437
4430
|
function getParticipantResults(_a) {
|
|
4438
4431
|
var e_1, _b, e_2, _c, e_3, _d;
|
|
4439
|
-
var _e, _f, _g, _h;
|
|
4432
|
+
var _e, _f, _g, _h, _j, _k;
|
|
4440
4433
|
var participantIds = _a.participantIds, matchUpFormat = _a.matchUpFormat, tallyPolicy = _a.tallyPolicy, perPlayer = _a.perPlayer, matchUps = _a.matchUps;
|
|
4441
4434
|
var participantResults = {};
|
|
4442
4435
|
var excludeMatchUpStatuses = (tallyPolicy === null || tallyPolicy === void 0 ? void 0 : tallyPolicy.excludeMatchUpStatuses) || [];
|
|
@@ -4483,7 +4476,7 @@ function getParticipantResults(_a) {
|
|
|
4483
4476
|
var winningParticipantId = winningSide && getWinningSideId(matchUp);
|
|
4484
4477
|
var losingParticipantId = winningSide && getLosingSideId(matchUp);
|
|
4485
4478
|
if (!winningParticipantId && !losingParticipantId) {
|
|
4486
|
-
if (completedMatchUpStatuses.includes(matchUpStatus)) {
|
|
4479
|
+
if (matchUpStatus && completedMatchUpStatuses.includes(matchUpStatus)) {
|
|
4487
4480
|
var participantIdSide1 = getSideId(matchUp, 0);
|
|
4488
4481
|
var participantIdSide2 = getSideId(matchUp, 1);
|
|
4489
4482
|
if (participantIdSide1) {
|
|
@@ -4499,11 +4492,11 @@ function getParticipantResults(_a) {
|
|
|
4499
4492
|
perPlayer = 0; // if any matchUps are matchUpType: TEAM don't calculate perPlayer
|
|
4500
4493
|
var _loop_1 = function (tieMatchUp) {
|
|
4501
4494
|
if (tieMatchUp.winningSide) {
|
|
4502
|
-
var tieWinningParticipantId = (_e = sides.find(function (_a) {
|
|
4495
|
+
var tieWinningParticipantId = (_e = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
4503
4496
|
var sideNumber = _a.sideNumber;
|
|
4504
4497
|
return sideNumber === tieMatchUp.winningSide;
|
|
4505
4498
|
})) === null || _e === void 0 ? void 0 : _e.participantId;
|
|
4506
|
-
var tieLosingParticipantId = (_f = sides.find(function (_a) {
|
|
4499
|
+
var tieLosingParticipantId = (_f = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
4507
4500
|
var sideNumber = _a.sideNumber;
|
|
4508
4501
|
return sideNumber === tieMatchUp.winningSide;
|
|
4509
4502
|
})) === null || _f === void 0 ? void 0 : _f.participantId;
|
|
@@ -4645,22 +4638,26 @@ function getParticipantResults(_a) {
|
|
|
4645
4638
|
}
|
|
4646
4639
|
}
|
|
4647
4640
|
if (manualGamesOverride) {
|
|
4648
|
-
var side1participantId = (_g = sides.find(function (_a) {
|
|
4641
|
+
var side1participantId = (_g = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
4649
4642
|
var sideNumber = _a.sideNumber;
|
|
4650
4643
|
return sideNumber === 1;
|
|
4651
4644
|
})) === null || _g === void 0 ? void 0 : _g.participantId;
|
|
4652
|
-
var side2participantId = (_h = sides.find(function (_a) {
|
|
4645
|
+
var side2participantId = (_h = sides === null || sides === void 0 ? void 0 : sides.find(function (_a) {
|
|
4653
4646
|
var sideNumber = _a.sideNumber;
|
|
4654
4647
|
return sideNumber === 2;
|
|
4655
4648
|
})) === null || _h === void 0 ? void 0 : _h.participantId;
|
|
4656
4649
|
checkInitializeParticipant(participantResults, side1participantId);
|
|
4657
4650
|
checkInitializeParticipant(participantResults, side2participantId);
|
|
4658
|
-
var gamesWonSide1 = score.sets.reduce(function (total, set) { return total + set.side1Score; }, 0);
|
|
4659
|
-
var gamesWonSide2 = score.sets.reduce(function (total, set) { return total + set.side2Score; }, 0);
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4651
|
+
var gamesWonSide1 = (_j = score === null || score === void 0 ? void 0 : score.sets) === null || _j === void 0 ? void 0 : _j.reduce(function (total, set) { var _a; return total + ((_a = set === null || set === void 0 ? void 0 : set.side1Score) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
4652
|
+
var gamesWonSide2 = (_k = score === null || score === void 0 ? void 0 : score.sets) === null || _k === void 0 ? void 0 : _k.reduce(function (total, set) { var _a; return total + ((_a = set.side2Score) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
4653
|
+
if (side1participantId) {
|
|
4654
|
+
participantResults[side1participantId].gamesWon += gamesWonSide1;
|
|
4655
|
+
participantResults[side1participantId].gamesLost += gamesWonSide2;
|
|
4656
|
+
}
|
|
4657
|
+
if (side2participantId) {
|
|
4658
|
+
participantResults[side2participantId].gamesWon += gamesWonSide2;
|
|
4659
|
+
participantResults[side2participantId].gamesLost += gamesWonSide1;
|
|
4660
|
+
}
|
|
4664
4661
|
}
|
|
4665
4662
|
}
|
|
4666
4663
|
}
|
|
@@ -4792,7 +4789,7 @@ function processMatchUp$1(_a) {
|
|
|
4792
4789
|
winningSide: winningSide,
|
|
4793
4790
|
score: score,
|
|
4794
4791
|
});
|
|
4795
|
-
var pointsTally = countPoints({ score: score, matchUpFormat: matchUpFormat });
|
|
4792
|
+
var pointsTally = countPoints({ score: score, matchUpFormat: matchUpFormat }).pointsTally;
|
|
4796
4793
|
if (winningParticipantId) {
|
|
4797
4794
|
participantResults[winningParticipantId].setsWon +=
|
|
4798
4795
|
setsTally[winningSideIndex];
|
|
@@ -17237,6 +17234,42 @@ function addNationalityCode(_a) {
|
|
|
17237
17234
|
persons.forEach(annotatePerson);
|
|
17238
17235
|
}
|
|
17239
17236
|
|
|
17237
|
+
function addIndividualParticipants(_a) {
|
|
17238
|
+
var e_1, _b, e_2, _c;
|
|
17239
|
+
var _d;
|
|
17240
|
+
var participantMap = _a.participantMap;
|
|
17241
|
+
var participantObjects = Object.values(participantMap);
|
|
17242
|
+
try {
|
|
17243
|
+
for (var participantObjects_1 = __values(participantObjects), participantObjects_1_1 = participantObjects_1.next(); !participantObjects_1_1.done; participantObjects_1_1 = participantObjects_1.next()) {
|
|
17244
|
+
var participantObject = participantObjects_1_1.value;
|
|
17245
|
+
var participant = participantObject.participant;
|
|
17246
|
+
if ((_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.length) {
|
|
17247
|
+
participant.individualParticipants = [];
|
|
17248
|
+
try {
|
|
17249
|
+
for (var _e = (e_2 = void 0, __values(participant.individualParticipantIds)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
17250
|
+
var participantId = _f.value;
|
|
17251
|
+
participant.individualParticipants.push(participantMap[participantId].participant);
|
|
17252
|
+
}
|
|
17253
|
+
}
|
|
17254
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
17255
|
+
finally {
|
|
17256
|
+
try {
|
|
17257
|
+
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
17258
|
+
}
|
|
17259
|
+
finally { if (e_2) throw e_2.error; }
|
|
17260
|
+
}
|
|
17261
|
+
}
|
|
17262
|
+
}
|
|
17263
|
+
}
|
|
17264
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
17265
|
+
finally {
|
|
17266
|
+
try {
|
|
17267
|
+
if (participantObjects_1_1 && !participantObjects_1_1.done && (_b = participantObjects_1.return)) _b.call(participantObjects_1);
|
|
17268
|
+
}
|
|
17269
|
+
finally { if (e_1) throw e_1.error; }
|
|
17270
|
+
}
|
|
17271
|
+
}
|
|
17272
|
+
|
|
17240
17273
|
function getTimeItem(_a) {
|
|
17241
17274
|
var returnPreviousValues = _a.returnPreviousValues, itemSubTypes = _a.itemSubTypes, itemType = _a.itemType, element = _a.element;
|
|
17242
17275
|
if (!element)
|
|
@@ -17413,43 +17446,8 @@ function signedIn(participant) {
|
|
|
17413
17446
|
}).timeItem;
|
|
17414
17447
|
return (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === SIGNED_IN;
|
|
17415
17448
|
}
|
|
17416
|
-
function addIndividualParticipants(_a) {
|
|
17417
|
-
var e_3, _b, e_4, _c;
|
|
17418
|
-
var _d;
|
|
17419
|
-
var participantMap = _a.participantMap;
|
|
17420
|
-
var participantObjects = Object.values(participantMap);
|
|
17421
|
-
try {
|
|
17422
|
-
for (var participantObjects_1 = __values(participantObjects), participantObjects_1_1 = participantObjects_1.next(); !participantObjects_1_1.done; participantObjects_1_1 = participantObjects_1.next()) {
|
|
17423
|
-
var participantObject = participantObjects_1_1.value;
|
|
17424
|
-
var participant = participantObject.participant;
|
|
17425
|
-
if ((_d = participant.individualParticipantIds) === null || _d === void 0 ? void 0 : _d.length) {
|
|
17426
|
-
participant.individualParticipants = [];
|
|
17427
|
-
try {
|
|
17428
|
-
for (var _e = (e_4 = void 0, __values(participant.individualParticipantIds)), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
17429
|
-
var participantId = _f.value;
|
|
17430
|
-
participant.individualParticipants.push(participantMap[participantId].participant);
|
|
17431
|
-
}
|
|
17432
|
-
}
|
|
17433
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
17434
|
-
finally {
|
|
17435
|
-
try {
|
|
17436
|
-
if (_f && !_f.done && (_c = _e.return)) _c.call(_e);
|
|
17437
|
-
}
|
|
17438
|
-
finally { if (e_4) throw e_4.error; }
|
|
17439
|
-
}
|
|
17440
|
-
}
|
|
17441
|
-
}
|
|
17442
|
-
}
|
|
17443
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
17444
|
-
finally {
|
|
17445
|
-
try {
|
|
17446
|
-
if (participantObjects_1_1 && !participantObjects_1_1.done && (_b = participantObjects_1.return)) _b.call(participantObjects_1);
|
|
17447
|
-
}
|
|
17448
|
-
finally { if (e_3) throw e_3.error; }
|
|
17449
|
-
}
|
|
17450
|
-
}
|
|
17451
17449
|
function processIndividualParticipantIds(_a) {
|
|
17452
|
-
var
|
|
17450
|
+
var e_3, _b;
|
|
17453
17451
|
var individualParticipantIds = _a.individualParticipantIds, participantCopy = _a.participantCopy, participantMap = _a.participantMap, participantType = _a.participantType, participantId = _a.participantId;
|
|
17454
17452
|
var _loop_1 = function (individualParticipantId) {
|
|
17455
17453
|
var individualParticipant = participantMap[individualParticipantId].participant;
|
|
@@ -17479,12 +17477,12 @@ function processIndividualParticipantIds(_a) {
|
|
|
17479
17477
|
_loop_1(individualParticipantId);
|
|
17480
17478
|
}
|
|
17481
17479
|
}
|
|
17482
|
-
catch (
|
|
17480
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
17483
17481
|
finally {
|
|
17484
17482
|
try {
|
|
17485
17483
|
if (individualParticipantIds_1_1 && !individualParticipantIds_1_1.done && (_b = individualParticipantIds_1.return)) _b.call(individualParticipantIds_1);
|
|
17486
17484
|
}
|
|
17487
|
-
finally { if (
|
|
17485
|
+
finally { if (e_3) throw e_3.error; }
|
|
17488
17486
|
}
|
|
17489
17487
|
}
|
|
17490
17488
|
function initializeParticipantId(_a) {
|
|
@@ -17674,7 +17672,6 @@ function allEventMatchUps(params) {
|
|
|
17674
17672
|
if (!event)
|
|
17675
17673
|
return { error: MISSING_EVENT };
|
|
17676
17674
|
var eventId = event.eventId, eventName = event.eventName, endDate = event.endDate, category = event.category, gender = event.gender, matchUpFormat = event.matchUpFormat;
|
|
17677
|
-
var eventMatchUps = [];
|
|
17678
17675
|
var additionalContext = __assign(__assign({}, context), definedAttributes({
|
|
17679
17676
|
indoorOutDoor: (_a = event.indoorOutdoor) !== null && _a !== void 0 ? _a : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.indoorOutdoor,
|
|
17680
17677
|
surfaceCategory: (_b = event.surfaceCategory) !== null && _b !== void 0 ? _b : tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.surfaceCategory,
|
|
@@ -17714,7 +17711,7 @@ function allEventMatchUps(params) {
|
|
|
17714
17711
|
event: event,
|
|
17715
17712
|
}).scheduleTiming;
|
|
17716
17713
|
var matchUps = drawDefinitions.flatMap(function (drawDefinition) {
|
|
17717
|
-
var
|
|
17714
|
+
var matchUps = getAllDrawMatchUps({
|
|
17718
17715
|
tournamentParticipants: participants,
|
|
17719
17716
|
tournamentAppliedPolicies: tournamentAppliedPolicies,
|
|
17720
17717
|
scheduleVisibilityFilters: scheduleVisibilityFilters,
|
|
@@ -17733,12 +17730,10 @@ function allEventMatchUps(params) {
|
|
|
17733
17730
|
nextMatchUps: nextMatchUps,
|
|
17734
17731
|
inContext: inContext,
|
|
17735
17732
|
event: event,
|
|
17736
|
-
})
|
|
17737
|
-
if (matchUpsMap === null || matchUpsMap === void 0 ? void 0 : matchUpsMap.drawMatchUps)
|
|
17738
|
-
eventMatchUps.push.apply(eventMatchUps, __spreadArray([], __read(matchUpsMap.drawMatchUps), false));
|
|
17733
|
+
}).matchUps;
|
|
17739
17734
|
return matchUps !== null && matchUps !== void 0 ? matchUps : [];
|
|
17740
17735
|
});
|
|
17741
|
-
return { matchUps: matchUps
|
|
17736
|
+
return { matchUps: matchUps };
|
|
17742
17737
|
}
|
|
17743
17738
|
function tournamentMatchUps(params) {
|
|
17744
17739
|
var _a, _b, _c;
|
|
@@ -30155,14 +30150,15 @@ function getEventEntries(_a) {
|
|
|
30155
30150
|
}
|
|
30156
30151
|
|
|
30157
30152
|
function getParticipants$1(params) {
|
|
30158
|
-
var
|
|
30153
|
+
var e_1, _a, e_2, _b, e_3, _c;
|
|
30154
|
+
var _d;
|
|
30155
|
+
var withIndividualParticipants = params.withIndividualParticipants, _e = params.participantFilters, participantFilters = _e === void 0 ? {} : _e, withPotentialMatchUps = params.withPotentialMatchUps, withRankingProfile = params.withRankingProfile, convertExtensions = params.convertExtensions, policyDefinitions = params.policyDefinitions, withScheduleItems = params.withScheduleItems, tournamentRecord = params.tournamentRecord, scheduleAnalysis = params.scheduleAnalysis, withSignInStatus = params.withSignInStatus, withTeamMatchUps = params.withTeamMatchUps, withScaleValues = params.withScaleValues, usePublishState = params.usePublishState, contextProfile = params.contextProfile, withStatistics = params.withStatistics, withOpponents = params.withOpponents, withMatchUps = params.withMatchUps, internalUse = params.internalUse, withSeeding = params.withSeeding, withEvents = params.withEvents, withDraws = params.withDraws, withISO2 = params.withISO2, withIOC = params.withIOC;
|
|
30159
30156
|
if (!tournamentRecord)
|
|
30160
30157
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
30161
30158
|
if (withMatchUps || withRankingProfile) {
|
|
30162
30159
|
getMatchUpDependencies({ tournamentRecord: tournamentRecord }); // ensure goesTos are present
|
|
30163
30160
|
}
|
|
30164
30161
|
var participantMap = getParticipantMap({
|
|
30165
|
-
withIndividualParticipants: withIndividualParticipants,
|
|
30166
30162
|
convertExtensions: convertExtensions,
|
|
30167
30163
|
tournamentRecord: tournamentRecord,
|
|
30168
30164
|
withSignInStatus: withSignInStatus,
|
|
@@ -30195,7 +30191,7 @@ function getParticipants$1(params) {
|
|
|
30195
30191
|
var matchUps = entriesResult.matchUps;
|
|
30196
30192
|
participantMap = entriesResult.participantMap;
|
|
30197
30193
|
var nextMatchUps = scheduleAnalysis !== null && scheduleAnalysis !== void 0 ? scheduleAnalysis : withPotentialMatchUps;
|
|
30198
|
-
var
|
|
30194
|
+
var processParticipant = function (_a) {
|
|
30199
30195
|
var potentialMatchUps = _a.potentialMatchUps, scheduleConflicts = _a.scheduleConflicts, scheduleItems = _a.scheduleItems, participant = _a.participant, statistics = _a.statistics, opponents = _a.opponents, matchUps = _a.matchUps, events = _a.events, draws = _a.draws;
|
|
30200
30196
|
var participantDraws = Object.values(draws);
|
|
30201
30197
|
var participantOpponents = Object.values(opponents);
|
|
@@ -30204,14 +30200,27 @@ function getParticipants$1(params) {
|
|
|
30204
30200
|
draw.opponents = participantOpponents.filter(function (opponent) { return opponent.drawId === draw.drawId; });
|
|
30205
30201
|
});
|
|
30206
30202
|
}
|
|
30207
|
-
return definedAttributes(__assign(__assign({}, participant), { scheduleConflicts: scheduleAnalysis ? scheduleConflicts : undefined, draws: withDraws || withRankingProfile ? participantDraws : undefined, events: withEvents || withRankingProfile
|
|
30208
|
-
? Object.values(events)
|
|
30209
|
-
: undefined, matchUps: withMatchUps || withRankingProfile
|
|
30203
|
+
return definedAttributes(__assign(__assign({}, participant), { scheduleConflicts: scheduleAnalysis ? scheduleConflicts : undefined, draws: withDraws || withRankingProfile ? participantDraws : undefined, events: withEvents || withRankingProfile ? Object.values(events) : undefined, matchUps: withMatchUps || withRankingProfile
|
|
30210
30204
|
? Object.values(matchUps)
|
|
30211
30205
|
: undefined, opponents: withOpponents ? participantOpponents : undefined, potentialMatchUps: nextMatchUps
|
|
30212
30206
|
? Object.values(potentialMatchUps)
|
|
30213
30207
|
: undefined, statistics: withStatistics ? Object.values(statistics) : undefined, scheduleItems: withScheduleItems ? scheduleItems : undefined }), false, false, true);
|
|
30214
|
-
}
|
|
30208
|
+
};
|
|
30209
|
+
var ppMap = new Map();
|
|
30210
|
+
try {
|
|
30211
|
+
for (var _f = __values(Object.keys(participantMap)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
30212
|
+
var participantId = _g.value;
|
|
30213
|
+
ppMap.set(participantId, processParticipant(participantMap[participantId]));
|
|
30214
|
+
}
|
|
30215
|
+
}
|
|
30216
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
30217
|
+
finally {
|
|
30218
|
+
try {
|
|
30219
|
+
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
30220
|
+
}
|
|
30221
|
+
finally { if (e_1) throw e_1.error; }
|
|
30222
|
+
}
|
|
30223
|
+
var processedParticipants = __spreadArray([], __read(ppMap.values()), false);
|
|
30215
30224
|
var participantAttributes = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_PARTICIPANT];
|
|
30216
30225
|
var template = participantAttributes === null || participantAttributes === void 0 ? void 0 : participantAttributes.participant;
|
|
30217
30226
|
// filter must be last so attributes can be used for reporting & etc.
|
|
@@ -30220,6 +30229,35 @@ function getParticipants$1(params) {
|
|
|
30220
30229
|
participantFilters: participantFilters,
|
|
30221
30230
|
tournamentRecord: tournamentRecord,
|
|
30222
30231
|
});
|
|
30232
|
+
if (withIndividualParticipants) {
|
|
30233
|
+
try {
|
|
30234
|
+
for (var filteredParticipants_1 = __values(filteredParticipants), filteredParticipants_1_1 = filteredParticipants_1.next(); !filteredParticipants_1_1.done; filteredParticipants_1_1 = filteredParticipants_1.next()) {
|
|
30235
|
+
var participant = filteredParticipants_1_1.value;
|
|
30236
|
+
try {
|
|
30237
|
+
for (var _h = (e_3 = void 0, __values((_d = participant.individualParticipantIds) !== null && _d !== void 0 ? _d : [])), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
30238
|
+
var individualParticipantId = _j.value;
|
|
30239
|
+
if (!participant.individualParticipants)
|
|
30240
|
+
participant.individualParticipants = [];
|
|
30241
|
+
participant.individualParticipants.push(ppMap.get(individualParticipantId));
|
|
30242
|
+
}
|
|
30243
|
+
}
|
|
30244
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
30245
|
+
finally {
|
|
30246
|
+
try {
|
|
30247
|
+
if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
|
|
30248
|
+
}
|
|
30249
|
+
finally { if (e_3) throw e_3.error; }
|
|
30250
|
+
}
|
|
30251
|
+
}
|
|
30252
|
+
}
|
|
30253
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
30254
|
+
finally {
|
|
30255
|
+
try {
|
|
30256
|
+
if (filteredParticipants_1_1 && !filteredParticipants_1_1.done && (_b = filteredParticipants_1.return)) _b.call(filteredParticipants_1);
|
|
30257
|
+
}
|
|
30258
|
+
finally { if (e_2) throw e_2.error; }
|
|
30259
|
+
}
|
|
30260
|
+
}
|
|
30223
30261
|
var participants = template
|
|
30224
30262
|
? filteredParticipants.map(function (source) {
|
|
30225
30263
|
return attributeFilter({ source: source, template: template });
|
|
@@ -41164,7 +41202,7 @@ function engineLogging(_a) {
|
|
|
41164
41202
|
var result = _a.result, methodName = _a.methodName, elapsed = _a.elapsed, params = _a.params, engine = _a.engine;
|
|
41165
41203
|
var devContext = getDevContext();
|
|
41166
41204
|
var log = { method: methodName };
|
|
41167
|
-
var logError = result.error &&
|
|
41205
|
+
var logError = (result === null || result === void 0 ? void 0 : result.error) &&
|
|
41168
41206
|
(devContext.errors === true ||
|
|
41169
41207
|
(Array.isArray(devContext.errors) &&
|
|
41170
41208
|
devContext.errors.includes(methodName)));
|
|
@@ -41191,7 +41229,7 @@ function engineLogging(_a) {
|
|
|
41191
41229
|
}
|
|
41192
41230
|
if (Object.keys(log).length > 1)
|
|
41193
41231
|
console.log(engine, log);
|
|
41194
|
-
if (devContext.makeDeepCopy)
|
|
41232
|
+
if (result && devContext.makeDeepCopy)
|
|
41195
41233
|
result.deepCopyIterations = getDeepCopyIterations();
|
|
41196
41234
|
}
|
|
41197
41235
|
|
|
@@ -46977,7 +47015,7 @@ function buildDrawHierarchy(_a) {
|
|
|
46977
47015
|
var secondRoundEntries = secondRoundDrawPositions
|
|
46978
47016
|
.filter(function (drawPosition) { return !firstRoundDrawPositions.includes(drawPosition); })
|
|
46979
47017
|
.sort(drawPositionSort);
|
|
46980
|
-
var
|
|
47018
|
+
var secondRoundEntrySides = secondRoundMatchUps
|
|
46981
47019
|
.filter(function (matchUp) {
|
|
46982
47020
|
var _a;
|
|
46983
47021
|
return (_a = matchUp.drawPositions) === null || _a === void 0 ? void 0 : _a.reduce(function (p, c) { return secondRoundEntries.includes(c) || p; }, undefined);
|
|
@@ -46995,7 +47033,7 @@ function buildDrawHierarchy(_a) {
|
|
|
46995
47033
|
var missingPairs = secondRoundEntries.map(function (drawPosition, index) {
|
|
46996
47034
|
return [drawPosition, missingDrawPositions[index]].sort(drawPositionSort);
|
|
46997
47035
|
});
|
|
46998
|
-
var entrySides_1 = Object.assign.apply(Object, __spreadArray([{}], __read(
|
|
47036
|
+
var entrySides_1 = Object.assign.apply(Object, __spreadArray([{}], __read(secondRoundEntrySides), false));
|
|
46999
47037
|
var finishingRound_1 = makeDeepCopy(firstRoundMatchUps === null || firstRoundMatchUps === void 0 ? void 0 : firstRoundMatchUps[0].finishingRound, false, true);
|
|
47000
47038
|
var finishingPositionRange_1 = makeDeepCopy(firstRoundMatchUps === null || firstRoundMatchUps === void 0 ? void 0 : firstRoundMatchUps[0].finishingPositionRange, false, true);
|
|
47001
47039
|
missingMatchUps = missingPairs.map(function (drawPositions, index) {
|
|
@@ -59425,7 +59463,299 @@ function getPositionManipulations(_a) {
|
|
|
59425
59463
|
})) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.slice(1);
|
|
59426
59464
|
}
|
|
59427
59465
|
|
|
59428
|
-
|
|
59466
|
+
function getTeamStats(_a) {
|
|
59467
|
+
var e_1, _b, e_2, _c, e_3, _d, e_4, _e, e_5, _f, e_6, _g;
|
|
59468
|
+
var _h, _j, _k, _l;
|
|
59469
|
+
var opponentParticipantId = _a.opponentParticipantId, teamParticipantId = _a.teamParticipantId, tournamentRecord = _a.tournamentRecord, tallyPolicy = _a.tallyPolicy, matchUps = _a.matchUps;
|
|
59470
|
+
if (!tournamentRecord)
|
|
59471
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
59472
|
+
if (matchUps && !Array.isArray(matchUps))
|
|
59473
|
+
return { error: INVALID_MATCHUP };
|
|
59474
|
+
matchUps = matchUps || allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps;
|
|
59475
|
+
if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length))
|
|
59476
|
+
return { error: MISSING_MATCHUPS };
|
|
59477
|
+
var teamParticipantIds = [];
|
|
59478
|
+
if (opponentParticipantId)
|
|
59479
|
+
teamParticipantIds.push(opponentParticipantId);
|
|
59480
|
+
if (teamParticipantId)
|
|
59481
|
+
teamParticipantIds.push(teamParticipantId);
|
|
59482
|
+
var participantFilters = !teamParticipantIds.length
|
|
59483
|
+
? { participantTypes: [TEAM_PARTICIPANT] }
|
|
59484
|
+
: { participantIds: teamParticipantIds };
|
|
59485
|
+
var teamParticipants = (_h = getParticipants$1({ participantFilters: participantFilters, tournamentRecord: tournamentRecord }).participants) !== null && _h !== void 0 ? _h : [];
|
|
59486
|
+
if (!teamParticipants.every(function (_a) {
|
|
59487
|
+
var participantType = _a.participantType;
|
|
59488
|
+
return participantType === TEAM_PARTICIPANT;
|
|
59489
|
+
})) {
|
|
59490
|
+
return { error: INVALID_PARTICIPANT_IDS };
|
|
59491
|
+
}
|
|
59492
|
+
if (!teamParticipantIds.length)
|
|
59493
|
+
teamParticipantIds.push.apply(teamParticipantIds, __spreadArray([], __read(teamParticipants.map(extractAttributes('participantId'))), false));
|
|
59494
|
+
var teamStats = new Map();
|
|
59495
|
+
var teamMap = new Map();
|
|
59496
|
+
try {
|
|
59497
|
+
for (var teamParticipants_1 = __values(teamParticipants), teamParticipants_1_1 = teamParticipants_1.next(); !teamParticipants_1_1.done; teamParticipants_1_1 = teamParticipants_1.next()) {
|
|
59498
|
+
var teamParticipant = teamParticipants_1_1.value;
|
|
59499
|
+
var participantId = teamParticipant.participantId, individualParticipantIds = teamParticipant.individualParticipantIds;
|
|
59500
|
+
teamMap.set(participantId, individualParticipantIds !== null && individualParticipantIds !== void 0 ? individualParticipantIds : []);
|
|
59501
|
+
teamStats.set(participantId, {
|
|
59502
|
+
participantName: (_j = teamParticipant.participantName) !== null && _j !== void 0 ? _j : '',
|
|
59503
|
+
matchUpStatuses: {},
|
|
59504
|
+
competitorIds: [],
|
|
59505
|
+
tiebreaks: [0, 0],
|
|
59506
|
+
matchUps: [0, 0],
|
|
59507
|
+
points: [0, 0],
|
|
59508
|
+
participantId: participantId,
|
|
59509
|
+
games: [0, 0],
|
|
59510
|
+
sets: [0, 0],
|
|
59511
|
+
});
|
|
59512
|
+
}
|
|
59513
|
+
}
|
|
59514
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
59515
|
+
finally {
|
|
59516
|
+
try {
|
|
59517
|
+
if (teamParticipants_1_1 && !teamParticipants_1_1.done && (_b = teamParticipants_1.return)) _b.call(teamParticipants_1);
|
|
59518
|
+
}
|
|
59519
|
+
finally { if (e_1) throw e_1.error; }
|
|
59520
|
+
}
|
|
59521
|
+
if (teamParticipantId && !teamMap.get(teamParticipantId))
|
|
59522
|
+
return decorateResult({
|
|
59523
|
+
result: { error: PARTICIPANT_NOT_FOUND },
|
|
59524
|
+
context: { teamParticipantId: teamParticipantId },
|
|
59525
|
+
});
|
|
59526
|
+
if (opponentParticipantId && !teamMap.get(opponentParticipantId))
|
|
59527
|
+
return decorateResult({
|
|
59528
|
+
result: { error: PARTICIPANT_NOT_FOUND },
|
|
59529
|
+
context: { opponentParticipantId: opponentParticipantId },
|
|
59530
|
+
});
|
|
59531
|
+
var relevantMatchUps = [];
|
|
59532
|
+
var getTeamParticipantIds = function (sides) {
|
|
59533
|
+
var e_7, _a, e_8, _b, e_9, _c;
|
|
59534
|
+
var _d, _e;
|
|
59535
|
+
var sideTeamParticipantIds = [];
|
|
59536
|
+
var isTeamSide = function (side, individualParticipantIds) {
|
|
59537
|
+
var _a, _b, _c, _d, _e;
|
|
59538
|
+
return !!((side.participantId &&
|
|
59539
|
+
individualParticipantIds.includes(side.participantId)) ||
|
|
59540
|
+
(((_b = (_a = side.participant) === null || _a === void 0 ? void 0 : _a.individualParticipantIds) === null || _b === void 0 ? void 0 : _b.length) &&
|
|
59541
|
+
intersection(individualParticipantIds, (_c = side.participant) === null || _c === void 0 ? void 0 : _c.individualParticipantIds).length === ((_e = (_d = side.participant) === null || _d === void 0 ? void 0 : _d.individualParticipantIds) === null || _e === void 0 ? void 0 : _e.length)));
|
|
59542
|
+
};
|
|
59543
|
+
try {
|
|
59544
|
+
for (var teamMap_1 = __values(teamMap), teamMap_1_1 = teamMap_1.next(); !teamMap_1_1.done; teamMap_1_1 = teamMap_1.next()) {
|
|
59545
|
+
var _f = __read(teamMap_1_1.value, 2), teamParticipantId_1 = _f[0], individualParticipantIds = _f[1];
|
|
59546
|
+
try {
|
|
59547
|
+
for (var sides_1 = (e_8 = void 0, __values(sides)), sides_1_1 = sides_1.next(); !sides_1_1.done; sides_1_1 = sides_1.next()) {
|
|
59548
|
+
var side = sides_1_1.value;
|
|
59549
|
+
if (!side.participant)
|
|
59550
|
+
continue;
|
|
59551
|
+
if (isTeamSide(side, individualParticipantIds)) {
|
|
59552
|
+
var sideNumber = side.sideNumber;
|
|
59553
|
+
if (!sideNumber)
|
|
59554
|
+
continue;
|
|
59555
|
+
sideTeamParticipantIds[sideNumber - 1] = teamParticipantId_1;
|
|
59556
|
+
var competitorIds = ((_e = (_d = side.participant) === null || _d === void 0 ? void 0 : _d.individualParticipantIds) === null || _e === void 0 ? void 0 : _e.length)
|
|
59557
|
+
? side.participant.individualParticipantIds
|
|
59558
|
+
: [side.participant.participantId];
|
|
59559
|
+
var stats = teamStats.get(teamParticipantId_1);
|
|
59560
|
+
try {
|
|
59561
|
+
for (var competitorIds_1 = (e_9 = void 0, __values(competitorIds)), competitorIds_1_1 = competitorIds_1.next(); !competitorIds_1_1.done; competitorIds_1_1 = competitorIds_1.next()) {
|
|
59562
|
+
var id = competitorIds_1_1.value;
|
|
59563
|
+
if (stats && !stats.competitorIds.includes(id))
|
|
59564
|
+
stats.competitorIds.push(id);
|
|
59565
|
+
}
|
|
59566
|
+
}
|
|
59567
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
59568
|
+
finally {
|
|
59569
|
+
try {
|
|
59570
|
+
if (competitorIds_1_1 && !competitorIds_1_1.done && (_c = competitorIds_1.return)) _c.call(competitorIds_1);
|
|
59571
|
+
}
|
|
59572
|
+
finally { if (e_9) throw e_9.error; }
|
|
59573
|
+
}
|
|
59574
|
+
}
|
|
59575
|
+
}
|
|
59576
|
+
}
|
|
59577
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
59578
|
+
finally {
|
|
59579
|
+
try {
|
|
59580
|
+
if (sides_1_1 && !sides_1_1.done && (_b = sides_1.return)) _b.call(sides_1);
|
|
59581
|
+
}
|
|
59582
|
+
finally { if (e_8) throw e_8.error; }
|
|
59583
|
+
}
|
|
59584
|
+
}
|
|
59585
|
+
}
|
|
59586
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
59587
|
+
finally {
|
|
59588
|
+
try {
|
|
59589
|
+
if (teamMap_1_1 && !teamMap_1_1.done && (_a = teamMap_1.return)) _a.call(teamMap_1);
|
|
59590
|
+
}
|
|
59591
|
+
finally { if (e_7) throw e_7.error; }
|
|
59592
|
+
}
|
|
59593
|
+
return sideTeamParticipantIds;
|
|
59594
|
+
};
|
|
59595
|
+
var _loop_1 = function (matchUp) {
|
|
59596
|
+
if (!isObject(matchUp))
|
|
59597
|
+
return { value: { error: INVALID_MATCHUP } };
|
|
59598
|
+
var matchUpStatus = matchUp.matchUpStatus, matchUpFormat = matchUp.matchUpFormat, matchUpType = matchUp.matchUpType, winningSide = matchUp.winningSide, score = matchUp.score, sides = matchUp.sides;
|
|
59599
|
+
if (!sides ||
|
|
59600
|
+
!score ||
|
|
59601
|
+
matchUpType === TEAM_MATCHUP ||
|
|
59602
|
+
matchUpStatus === BYE)
|
|
59603
|
+
return "continue";
|
|
59604
|
+
var teamParticipantIds_1 = getTeamParticipantIds(sides);
|
|
59605
|
+
if (!teamParticipantIds_1.filter(Boolean).length)
|
|
59606
|
+
return "continue";
|
|
59607
|
+
relevantMatchUps.push(matchUp);
|
|
59608
|
+
var setsTally = countSets({
|
|
59609
|
+
matchUpStatus: matchUpStatus,
|
|
59610
|
+
matchUpFormat: matchUpFormat,
|
|
59611
|
+
tallyPolicy: tallyPolicy,
|
|
59612
|
+
winningSide: winningSide,
|
|
59613
|
+
score: score,
|
|
59614
|
+
});
|
|
59615
|
+
var gamesTally = countGames({
|
|
59616
|
+
matchUpStatus: matchUpStatus,
|
|
59617
|
+
matchUpFormat: matchUpFormat,
|
|
59618
|
+
tallyPolicy: tallyPolicy,
|
|
59619
|
+
winningSide: winningSide,
|
|
59620
|
+
score: score,
|
|
59621
|
+
});
|
|
59622
|
+
var _r = countPoints({
|
|
59623
|
+
matchUpFormat: matchUpFormat,
|
|
59624
|
+
score: score,
|
|
59625
|
+
}), pointsTally = _r.pointsTally, tiebreaksTally = _r.tiebreaksTally;
|
|
59626
|
+
teamParticipantIds_1.forEach(function (teamParticipantId, index) {
|
|
59627
|
+
if (teamParticipantId) {
|
|
59628
|
+
var stats_1 = teamStats.get(teamParticipantId);
|
|
59629
|
+
if (stats_1) {
|
|
59630
|
+
var teamSumTally = function (stat, tally) {
|
|
59631
|
+
return tally.forEach(function (t, i) { return (stats_1[stat][i] += t); });
|
|
59632
|
+
};
|
|
59633
|
+
var tiebreaks = index
|
|
59634
|
+
? __spreadArray([], __read(tiebreaksTally), false).reverse()
|
|
59635
|
+
: tiebreaksTally;
|
|
59636
|
+
var points = index ? __spreadArray([], __read(pointsTally), false).reverse() : pointsTally;
|
|
59637
|
+
var games = index ? __spreadArray([], __read(gamesTally), false).reverse() : gamesTally;
|
|
59638
|
+
var sets = index ? __spreadArray([], __read(setsTally), false).reverse() : setsTally;
|
|
59639
|
+
teamSumTally('tiebreaks', tiebreaks);
|
|
59640
|
+
teamSumTally('points', points);
|
|
59641
|
+
teamSumTally('games', games);
|
|
59642
|
+
teamSumTally('sets', sets);
|
|
59643
|
+
if (winningSide) {
|
|
59644
|
+
var tallyIndex = winningSide - 1 === index ? 0 : 1;
|
|
59645
|
+
stats_1.matchUps[tallyIndex] += 1;
|
|
59646
|
+
}
|
|
59647
|
+
if (matchUpStatus) {
|
|
59648
|
+
if (!stats_1.matchUpStatuses[matchUpStatus])
|
|
59649
|
+
stats_1.matchUpStatuses[matchUpStatus] = 0;
|
|
59650
|
+
stats_1.matchUpStatuses[matchUpStatus] += 1;
|
|
59651
|
+
}
|
|
59652
|
+
}
|
|
59653
|
+
}
|
|
59654
|
+
});
|
|
59655
|
+
};
|
|
59656
|
+
try {
|
|
59657
|
+
for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
|
|
59658
|
+
var matchUp = matchUps_1_1.value;
|
|
59659
|
+
var state_1 = _loop_1(matchUp);
|
|
59660
|
+
if (typeof state_1 === "object")
|
|
59661
|
+
return state_1.value;
|
|
59662
|
+
}
|
|
59663
|
+
}
|
|
59664
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
59665
|
+
finally {
|
|
59666
|
+
try {
|
|
59667
|
+
if (matchUps_1_1 && !matchUps_1_1.done && (_c = matchUps_1.return)) _c.call(matchUps_1);
|
|
59668
|
+
}
|
|
59669
|
+
finally { if (e_2) throw e_2.error; }
|
|
59670
|
+
}
|
|
59671
|
+
var attrs = ['tiebreaks', 'matchUps', 'points', 'games', 'sets'];
|
|
59672
|
+
var ratio = new Map();
|
|
59673
|
+
var add = function (a, b) { return (a !== null && a !== void 0 ? a : 0) + (b !== null && b !== void 0 ? b : 0); };
|
|
59674
|
+
try {
|
|
59675
|
+
for (var _m = __values(teamStats.values()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
59676
|
+
var stats = _o.value;
|
|
59677
|
+
try {
|
|
59678
|
+
for (var attrs_1 = (e_4 = void 0, __values(attrs)), attrs_1_1 = attrs_1.next(); !attrs_1_1.done; attrs_1_1 = attrs_1.next()) {
|
|
59679
|
+
var attr = attrs_1_1.value;
|
|
59680
|
+
var total = stats[attr].reduce(add);
|
|
59681
|
+
if (total) {
|
|
59682
|
+
var value = stats[attr][0] / total;
|
|
59683
|
+
var accessor = "".concat(attr, "Ratio");
|
|
59684
|
+
var fixedValue = parseFloat(value.toFixed(2));
|
|
59685
|
+
stats[accessor] = fixedValue;
|
|
59686
|
+
if (!ratio.has(accessor))
|
|
59687
|
+
ratio.set(accessor, []);
|
|
59688
|
+
(_k = ratio.get(accessor)) === null || _k === void 0 ? void 0 : _k.push(fixedValue);
|
|
59689
|
+
}
|
|
59690
|
+
}
|
|
59691
|
+
}
|
|
59692
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
59693
|
+
finally {
|
|
59694
|
+
try {
|
|
59695
|
+
if (attrs_1_1 && !attrs_1_1.done && (_e = attrs_1.return)) _e.call(attrs_1);
|
|
59696
|
+
}
|
|
59697
|
+
finally { if (e_4) throw e_4.error; }
|
|
59698
|
+
}
|
|
59699
|
+
}
|
|
59700
|
+
}
|
|
59701
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
59702
|
+
finally {
|
|
59703
|
+
try {
|
|
59704
|
+
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
59705
|
+
}
|
|
59706
|
+
finally { if (e_3) throw e_3.error; }
|
|
59707
|
+
}
|
|
59708
|
+
var highLowSort = function (a, b) { return b - a; };
|
|
59709
|
+
try {
|
|
59710
|
+
for (var _p = __values(teamStats.values()), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
59711
|
+
var stats = _q.value;
|
|
59712
|
+
try {
|
|
59713
|
+
for (var attrs_2 = (e_6 = void 0, __values(attrs)), attrs_2_1 = attrs_2.next(); !attrs_2_1.done; attrs_2_1 = attrs_2.next()) {
|
|
59714
|
+
var attr = attrs_2_1.value;
|
|
59715
|
+
var accessor = "".concat(attr, "Ratio");
|
|
59716
|
+
if (typeof stats[accessor] === 'number') {
|
|
59717
|
+
var index = (_l = ratio
|
|
59718
|
+
.get(accessor)) === null || _l === void 0 ? void 0 : _l.sort(highLowSort).indexOf(stats[accessor]);
|
|
59719
|
+
if (typeof index === 'number' && index >= 0) {
|
|
59720
|
+
var rankAccessor = "".concat(attr, "Rank");
|
|
59721
|
+
stats[rankAccessor] = index + 1;
|
|
59722
|
+
}
|
|
59723
|
+
}
|
|
59724
|
+
}
|
|
59725
|
+
}
|
|
59726
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
59727
|
+
finally {
|
|
59728
|
+
try {
|
|
59729
|
+
if (attrs_2_1 && !attrs_2_1.done && (_g = attrs_2.return)) _g.call(attrs_2);
|
|
59730
|
+
}
|
|
59731
|
+
finally { if (e_6) throw e_6.error; }
|
|
59732
|
+
}
|
|
59733
|
+
}
|
|
59734
|
+
}
|
|
59735
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
59736
|
+
finally {
|
|
59737
|
+
try {
|
|
59738
|
+
if (_q && !_q.done && (_f = _p.return)) _f.call(_p);
|
|
59739
|
+
}
|
|
59740
|
+
finally { if (e_5) throw e_5.error; }
|
|
59741
|
+
}
|
|
59742
|
+
var result = __assign({ relevantMatchUps: relevantMatchUps }, SUCCESS);
|
|
59743
|
+
if (teamParticipantId) {
|
|
59744
|
+
result.teamStats = teamStats.get(teamParticipantId);
|
|
59745
|
+
if (opponentParticipantId)
|
|
59746
|
+
result.opponentStats = teamStats.get(opponentParticipantId);
|
|
59747
|
+
}
|
|
59748
|
+
else {
|
|
59749
|
+
result.allTeamStats = __spreadArray([], __read(teamStats.values()), false);
|
|
59750
|
+
}
|
|
59751
|
+
return result;
|
|
59752
|
+
}
|
|
59753
|
+
|
|
59754
|
+
var reportGovernor = {
|
|
59755
|
+
getStructureReports: getStructureReports,
|
|
59756
|
+
getEntryStatusReports: getEntryStatusReports,
|
|
59757
|
+
getTeamStats: getTeamStats,
|
|
59758
|
+
};
|
|
59429
59759
|
|
|
59430
59760
|
function setDrawParticipantRepresentativeIds(_a) {
|
|
59431
59761
|
var representativeParticipantIds = _a.representativeParticipantIds, drawDefinition = _a.drawDefinition;
|
|
@@ -63994,7 +64324,7 @@ function aggregateTieFormats(_a) {
|
|
|
63994
64324
|
}
|
|
63995
64325
|
var setTieFormatId = function (matchUpId, tieFormatId) {
|
|
63996
64326
|
var _a;
|
|
63997
|
-
var matchUp = (_a = eventMatchUpResult.
|
|
64327
|
+
var matchUp = (_a = eventMatchUpResult.matchUps) === null || _a === void 0 ? void 0 : _a.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
|
|
63998
64328
|
if (matchUp) {
|
|
63999
64329
|
matchUp.tieFormatId = tieFormatId;
|
|
64000
64330
|
delete matchUp.tieFormat;
|
|
@@ -64314,7 +64644,7 @@ function getMaxEntryPosition(params) {
|
|
|
64314
64644
|
function getPredictiveAccuracy(params) {
|
|
64315
64645
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
64316
64646
|
var matchUps = params.matchUps;
|
|
64317
|
-
var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, scaleName = params.scaleName, eventId = params.eventId, zonePct = params.zonePct, drawId = params.drawId, event = params.event;
|
|
64647
|
+
var singlesForDoubles = params.singlesForDoubles, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, scaleName = params.scaleName, eventId = params.eventId, zonePct = params.zonePct, drawId = params.drawId, event = params.event;
|
|
64318
64648
|
if (!tournamentRecord && !matchUps)
|
|
64319
64649
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
64320
64650
|
if (matchUpType && ![SINGLES$1, DOUBLES$1].includes(matchUpType))
|
|
@@ -64397,6 +64727,7 @@ function getPredictiveAccuracy(params) {
|
|
|
64397
64727
|
.map(function (_a) {
|
|
64398
64728
|
var competitiveProfile = _a.competitiveProfile, matchUpType = _a.matchUpType, score = _a.score, sides = _a.sides;
|
|
64399
64729
|
var sideValues = getSideValues({
|
|
64730
|
+
singlesForDoubles: singlesForDoubles,
|
|
64400
64731
|
valueAccessor: valueAccessor,
|
|
64401
64732
|
matchUpType: matchUpType,
|
|
64402
64733
|
scaleName: scaleName,
|
|
@@ -64448,7 +64779,7 @@ function getGroupingBands(_a) {
|
|
|
64448
64779
|
return bands;
|
|
64449
64780
|
}
|
|
64450
64781
|
function getSideValues(_a) {
|
|
64451
|
-
var exclusionRule = _a.exclusionRule, valueAccessor = _a.valueAccessor, matchUpType = _a.matchUpType, scaleName = _a.scaleName, sides = _a.sides;
|
|
64782
|
+
var singlesForDoubles = _a.singlesForDoubles, exclusionRule = _a.exclusionRule, valueAccessor = _a.valueAccessor, matchUpType = _a.matchUpType, scaleName = _a.scaleName, sides = _a.sides;
|
|
64452
64783
|
var sortedRange = exclusionRule === null || exclusionRule === void 0 ? void 0 : exclusionRule.range.sort();
|
|
64453
64784
|
var checkExcludeParticipant = function (scaleValue) {
|
|
64454
64785
|
var exclusionValue = scaleValue === null || scaleValue === void 0 ? void 0 : scaleValue[exclusionRule === null || exclusionRule === void 0 ? void 0 : exclusionRule.valueAccessor];
|
|
@@ -64471,6 +64802,7 @@ function getSideValues(_a) {
|
|
|
64471
64802
|
for (var individualParticipants_1 = __values(individualParticipants), individualParticipants_1_1 = individualParticipants_1.next(); !individualParticipants_1_1.done; individualParticipants_1_1 = individualParticipants_1.next()) {
|
|
64472
64803
|
var participant_1 = individualParticipants_1_1.value;
|
|
64473
64804
|
var _c = getSideValue({
|
|
64805
|
+
singlesForDoubles: singlesForDoubles,
|
|
64474
64806
|
valueAccessor: valueAccessor,
|
|
64475
64807
|
participant: participant_1,
|
|
64476
64808
|
matchUpType: matchUpType,
|
|
@@ -64504,6 +64836,7 @@ function getSideValues(_a) {
|
|
|
64504
64836
|
}
|
|
64505
64837
|
else if (participant) {
|
|
64506
64838
|
var _e = getSideValue({
|
|
64839
|
+
singlesForDoubles: singlesForDoubles,
|
|
64507
64840
|
valueAccessor: valueAccessor,
|
|
64508
64841
|
matchUpType: matchUpType,
|
|
64509
64842
|
participant: participant,
|
|
@@ -64526,9 +64859,10 @@ function getSideValues(_a) {
|
|
|
64526
64859
|
}
|
|
64527
64860
|
function getSideValue(_a) {
|
|
64528
64861
|
var _b, _c, _d, _e, _f;
|
|
64529
|
-
var
|
|
64530
|
-
var
|
|
64531
|
-
var
|
|
64862
|
+
var singlesForDoubles = _a.singlesForDoubles, valueAccessor = _a.valueAccessor, matchUpType = _a.matchUpType, participant = _a.participant, scaleName = _a.scaleName;
|
|
64863
|
+
var type = singlesForDoubles ? SINGLES$1 : matchUpType;
|
|
64864
|
+
var ranking = (_c = (_b = participant === null || participant === void 0 ? void 0 : participant.rankings) === null || _b === void 0 ? void 0 : _b[type]) === null || _c === void 0 ? void 0 : _c.find(function (ranking) { return ranking.scaleName === scaleName; });
|
|
64865
|
+
var rating = (_e = (_d = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _d === void 0 ? void 0 : _d[type]) === null || _e === void 0 ? void 0 : _e.find(function (rating) { return rating.scaleName === scaleName; });
|
|
64532
64866
|
var scaleValue = (_f = (rating || ranking)) === null || _f === void 0 ? void 0 : _f.scaleValue;
|
|
64533
64867
|
var value = valueAccessor ? scaleValue === null || scaleValue === void 0 ? void 0 : scaleValue[valueAccessor] : scaleValue;
|
|
64534
64868
|
return { scaleValue: scaleValue, value: value };
|
|
@@ -64764,7 +65098,7 @@ function getEvent(_a) {
|
|
|
64764
65098
|
}
|
|
64765
65099
|
function getEvents(_a) {
|
|
64766
65100
|
var e_1, _b;
|
|
64767
|
-
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
65101
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
64768
65102
|
var tournamentRecord = _a.tournamentRecord, withScaleValues = _a.withScaleValues, scaleEventType = _a.scaleEventType, inContext = _a.inContext, eventIds = _a.eventIds, drawIds = _a.drawIds, context = _a.context;
|
|
64769
65103
|
if (!tournamentRecord)
|
|
64770
65104
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -64792,7 +65126,7 @@ function getEvents(_a) {
|
|
|
64792
65126
|
return values.reduce(function (total, value) { return total + parseFloat(value); }, 0);
|
|
64793
65127
|
};
|
|
64794
65128
|
var _loop_1 = function (event_1) {
|
|
64795
|
-
var e_2,
|
|
65129
|
+
var e_2, _o, e_3, _p, e_4, _q, e_5, _r, e_6, _s, e_7, _t, e_8, _u;
|
|
64796
65130
|
var eventType = scaleEventType !== null && scaleEventType !== void 0 ? scaleEventType : event_1.eventType;
|
|
64797
65131
|
var eventId = event_1.eventId;
|
|
64798
65132
|
if (!eventsMap[eventId])
|
|
@@ -64840,8 +65174,8 @@ function getEvents(_a) {
|
|
|
64840
65174
|
var participant = (_e = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[participantId]) === null || _e === void 0 ? void 0 : _e.participant;
|
|
64841
65175
|
if ((participant === null || participant === void 0 ? void 0 : participant.participantType) !== INDIVIDUAL) {
|
|
64842
65176
|
try {
|
|
64843
|
-
for (var
|
|
64844
|
-
var individualParticipantId =
|
|
65177
|
+
for (var _v = (e_3 = void 0, __values((_f = participant === null || participant === void 0 ? void 0 : participant.individualParticipantIds) !== null && _f !== void 0 ? _f : [])), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
65178
|
+
var individualParticipantId = _w.value;
|
|
64845
65179
|
var individualParticipant = (_g = participantMap_1 === null || participantMap_1 === void 0 ? void 0 : participantMap_1[individualParticipantId]) === null || _g === void 0 ? void 0 : _g.participant;
|
|
64846
65180
|
processParticipant(individualParticipant);
|
|
64847
65181
|
}
|
|
@@ -64849,7 +65183,7 @@ function getEvents(_a) {
|
|
|
64849
65183
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
64850
65184
|
finally {
|
|
64851
65185
|
try {
|
|
64852
|
-
if (
|
|
65186
|
+
if (_w && !_w.done && (_p = _v.return)) _p.call(_v);
|
|
64853
65187
|
}
|
|
64854
65188
|
finally { if (e_3) throw e_3.error; }
|
|
64855
65189
|
}
|
|
@@ -64862,27 +65196,31 @@ function getEvents(_a) {
|
|
|
64862
65196
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64863
65197
|
finally {
|
|
64864
65198
|
try {
|
|
64865
|
-
if (participantIds_1_1 && !participantIds_1_1.done && (
|
|
65199
|
+
if (participantIds_1_1 && !participantIds_1_1.done && (_o = participantIds_1.return)) _o.call(participantIds_1);
|
|
64866
65200
|
}
|
|
64867
65201
|
finally { if (e_2) throw e_2.error; }
|
|
64868
65202
|
}
|
|
64869
65203
|
// add stats for all event-level entries ratings
|
|
64870
65204
|
var ratings = eventsMap[eventId].ratings;
|
|
64871
65205
|
try {
|
|
64872
|
-
for (var
|
|
64873
|
-
var scaleName =
|
|
65206
|
+
for (var _x = (e_4 = void 0, __values(Object.keys(ratings))), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
65207
|
+
var scaleName = _y.value;
|
|
65208
|
+
var scaleRating = ratings[scaleName];
|
|
65209
|
+
if (!scaleRating.length)
|
|
65210
|
+
continue;
|
|
65211
|
+
var med = (_h = median(scaleRating)) === null || _h === void 0 ? void 0 : _h.toFixed(2);
|
|
64874
65212
|
eventsMap[eventId].ratingsStats[scaleName] = {
|
|
64875
|
-
avg: sum(
|
|
64876
|
-
median:
|
|
64877
|
-
max: Math.max.apply(Math, __spreadArray([], __read(
|
|
64878
|
-
min: Math.min.apply(Math, __spreadArray([], __read(
|
|
65213
|
+
avg: parseFloat((sum(scaleRating) / scaleRating.length).toFixed(2)),
|
|
65214
|
+
median: med ? parseFloat(med) : undefined,
|
|
65215
|
+
max: Math.max.apply(Math, __spreadArray([], __read(scaleRating), false)),
|
|
65216
|
+
min: Math.min.apply(Math, __spreadArray([], __read(scaleRating), false)),
|
|
64879
65217
|
};
|
|
64880
65218
|
}
|
|
64881
65219
|
}
|
|
64882
65220
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
64883
65221
|
finally {
|
|
64884
65222
|
try {
|
|
64885
|
-
if (
|
|
65223
|
+
if (_y && !_y.done && (_q = _x.return)) _q.call(_x);
|
|
64886
65224
|
}
|
|
64887
65225
|
finally { if (e_4) throw e_4.error; }
|
|
64888
65226
|
}
|
|
@@ -64956,14 +65294,14 @@ function getEvents(_a) {
|
|
|
64956
65294
|
processedDrawIds.includes(drawId);
|
|
64957
65295
|
};
|
|
64958
65296
|
try {
|
|
64959
|
-
for (var
|
|
64960
|
-
var drawDefinition =
|
|
65297
|
+
for (var _z = (e_5 = void 0, __values((_j = event_1.drawDefinitions) !== null && _j !== void 0 ? _j : [])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
65298
|
+
var drawDefinition = _0.value;
|
|
64961
65299
|
var drawId = drawDefinition.drawId;
|
|
64962
65300
|
if (ignoreDrawId(drawId))
|
|
64963
65301
|
continue;
|
|
64964
|
-
var participantIds_2 = (
|
|
65302
|
+
var participantIds_2 = (_k = getAssignedParticipantIds({
|
|
64965
65303
|
drawDefinition: drawDefinition,
|
|
64966
|
-
}).assignedParticipantIds) !== null &&
|
|
65304
|
+
}).assignedParticipantIds) !== null && _k !== void 0 ? _k : [];
|
|
64967
65305
|
if (!eventsMap[eventId].draws[drawId])
|
|
64968
65306
|
eventsMap[eventId].draws[drawId] = {
|
|
64969
65307
|
ratingsStats: {},
|
|
@@ -64977,14 +65315,14 @@ function getEvents(_a) {
|
|
|
64977
65315
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
64978
65316
|
finally {
|
|
64979
65317
|
try {
|
|
64980
|
-
if (
|
|
65318
|
+
if (_0 && !_0.done && (_r = _z.return)) _r.call(_z);
|
|
64981
65319
|
}
|
|
64982
65320
|
finally { if (e_5) throw e_5.error; }
|
|
64983
65321
|
}
|
|
64984
65322
|
var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
|
|
64985
65323
|
try {
|
|
64986
|
-
for (var
|
|
64987
|
-
var flight =
|
|
65324
|
+
for (var _1 = (e_6 = void 0, __values((_l = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) !== null && _l !== void 0 ? _l : [])), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
65325
|
+
var flight = _2.value;
|
|
64988
65326
|
var drawId = flight.drawId;
|
|
64989
65327
|
if (ignoreDrawId(drawId))
|
|
64990
65328
|
continue;
|
|
@@ -64995,7 +65333,7 @@ function getEvents(_a) {
|
|
|
64995
65333
|
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
64996
65334
|
finally {
|
|
64997
65335
|
try {
|
|
64998
|
-
if (
|
|
65336
|
+
if (_2 && !_2.done && (_s = _1.return)) _s.call(_1);
|
|
64999
65337
|
}
|
|
65000
65338
|
finally { if (e_6) throw e_6.error; }
|
|
65001
65339
|
}
|
|
@@ -65004,20 +65342,24 @@ function getEvents(_a) {
|
|
|
65004
65342
|
var drawId = processedDrawIds_1_1.value;
|
|
65005
65343
|
var ratings_1 = eventsMap[eventId].draws[drawId].ratings;
|
|
65006
65344
|
try {
|
|
65007
|
-
for (var
|
|
65008
|
-
var scaleName =
|
|
65345
|
+
for (var _3 = (e_8 = void 0, __values(Object.keys(ratings_1))), _4 = _3.next(); !_4.done; _4 = _3.next()) {
|
|
65346
|
+
var scaleName = _4.value;
|
|
65347
|
+
var scaleRating = ratings_1[scaleName];
|
|
65348
|
+
if (!scaleRating.length)
|
|
65349
|
+
continue;
|
|
65350
|
+
var med = (_m = median(scaleRating)) === null || _m === void 0 ? void 0 : _m.toFixed(2);
|
|
65009
65351
|
eventsMap[eventId].draws[drawId].ratingsStats[scaleName] = {
|
|
65010
|
-
avg: sum(
|
|
65011
|
-
|
|
65012
|
-
|
|
65013
|
-
|
|
65352
|
+
avg: parseFloat((sum(scaleRating) / scaleRating.length).toFixed(2)),
|
|
65353
|
+
median: med ? parseFloat(med) : undefined,
|
|
65354
|
+
max: Math.max.apply(Math, __spreadArray([], __read(scaleRating), false)),
|
|
65355
|
+
min: Math.min.apply(Math, __spreadArray([], __read(scaleRating), false)),
|
|
65014
65356
|
};
|
|
65015
65357
|
}
|
|
65016
65358
|
}
|
|
65017
65359
|
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
65018
65360
|
finally {
|
|
65019
65361
|
try {
|
|
65020
|
-
if (
|
|
65362
|
+
if (_4 && !_4.done && (_u = _3.return)) _u.call(_3);
|
|
65021
65363
|
}
|
|
65022
65364
|
finally { if (e_8) throw e_8.error; }
|
|
65023
65365
|
}
|
|
@@ -65026,7 +65368,7 @@ function getEvents(_a) {
|
|
|
65026
65368
|
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
65027
65369
|
finally {
|
|
65028
65370
|
try {
|
|
65029
|
-
if (processedDrawIds_1_1 && !processedDrawIds_1_1.done && (
|
|
65371
|
+
if (processedDrawIds_1_1 && !processedDrawIds_1_1.done && (_t = processedDrawIds_1.return)) _t.call(processedDrawIds_1);
|
|
65030
65372
|
}
|
|
65031
65373
|
finally { if (e_7) throw e_7.error; }
|
|
65032
65374
|
}
|