tods-competition-factory 1.7.6 → 1.7.7
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 +19 -6
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +12 -4
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +14 -6
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +192 -54
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +196 -52
- 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 +3 -3
|
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
|
|
|
362
362
|
};
|
|
363
363
|
|
|
364
364
|
function factoryVersion() {
|
|
365
|
-
return '1.7.
|
|
365
|
+
return '1.7.7';
|
|
366
366
|
}
|
|
367
367
|
|
|
368
368
|
/******************************************************************************
|
|
@@ -2017,6 +2017,9 @@ function handleCaughtError(_a) {
|
|
|
2017
2017
|
});
|
|
2018
2018
|
}
|
|
2019
2019
|
|
|
2020
|
+
function isString(obj) {
|
|
2021
|
+
return typeof obj === 'string';
|
|
2022
|
+
}
|
|
2020
2023
|
function isObject(obj) {
|
|
2021
2024
|
return typeof obj === 'object';
|
|
2022
2025
|
}
|
|
@@ -5341,9 +5344,10 @@ function getCollectionPositionMatchUps(_a) {
|
|
|
5341
5344
|
|
|
5342
5345
|
var add = function (a, b) { return (a || 0) + (b || 0); };
|
|
5343
5346
|
function getBand(spread, bandProfiles) {
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
(
|
|
5347
|
+
var spreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
5348
|
+
return ((isNaN(spreadValue) && WALKOVER$1) ||
|
|
5349
|
+
(spreadValue <= bandProfiles[DECISIVE] && DECISIVE) ||
|
|
5350
|
+
(spreadValue <= bandProfiles[ROUTINE] && ROUTINE) ||
|
|
5347
5351
|
COMPETITIVE);
|
|
5348
5352
|
}
|
|
5349
5353
|
function getScoreComponents(_a) {
|
|
@@ -5412,7 +5416,8 @@ function getMatchUpCompetitiveProfile(_a) {
|
|
|
5412
5416
|
var scoreComponents = getScoreComponents({ score: score });
|
|
5413
5417
|
var spread = pctSpread([scoreComponents]);
|
|
5414
5418
|
var competitiveness = getBand(spread, bandProfiles);
|
|
5415
|
-
|
|
5419
|
+
var pctSpreadValue = Array.isArray(spread) ? spread[0] : spread;
|
|
5420
|
+
return __assign(__assign({}, SUCCESS), { competitiveness: competitiveness, pctSpread: pctSpreadValue });
|
|
5416
5421
|
}
|
|
5417
5422
|
|
|
5418
5423
|
function findMatchupFormatAverageTimes(params) {
|
|
@@ -9016,6 +9021,9 @@ var _a$h, _b$4;
|
|
|
9016
9021
|
var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
|
|
9017
9022
|
_a$h[POLICY_TYPE_ROUND_NAMING] = {
|
|
9018
9023
|
policyName: 'Round Naming Default',
|
|
9024
|
+
namingConventions: {
|
|
9025
|
+
round: 'Round',
|
|
9026
|
+
},
|
|
9019
9027
|
abbreviatedRoundNamingMap: {
|
|
9020
9028
|
// key is matchUpsCount for the round
|
|
9021
9029
|
1: 'F',
|
|
@@ -9056,6 +9064,10 @@ function getRoundContextProfile(_a) {
|
|
|
9056
9064
|
defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
|
|
9057
9065
|
{};
|
|
9058
9066
|
var roundNamePrefix = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) || defaultRoundNamingPolicy.affixes;
|
|
9067
|
+
var roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
|
|
9068
|
+
var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
|
|
9069
|
+
defaultRoundNamingPolicy.namingConventions;
|
|
9070
|
+
var roundNameFallback = namingConventions.round;
|
|
9059
9071
|
var stageInitial = stage && stage !== MAIN && stage[0];
|
|
9060
9072
|
var stageConstants = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.stageConstants;
|
|
9061
9073
|
var stageConstant = (stage && (stageConstants === null || stageConstants === void 0 ? void 0 : stageConstants[stage])) || stageInitial;
|
|
@@ -9063,8 +9075,8 @@ function getRoundContextProfile(_a) {
|
|
|
9063
9075
|
if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
|
|
9064
9076
|
Object.assign.apply(Object, __spreadArray([roundNamingProfile], __read(roundProfileKeys.map(function (key) {
|
|
9065
9077
|
var _a;
|
|
9066
|
-
var roundName = "
|
|
9067
|
-
var abbreviatedRoundName = "
|
|
9078
|
+
var roundName = "".concat(roundNameFallback, " ").concat(key);
|
|
9079
|
+
var abbreviatedRoundName = "".concat(roundNumberAffix).concat(key);
|
|
9068
9080
|
return _a = {}, _a[key] = { roundName: roundName, abbreviatedRoundName: abbreviatedRoundName }, _a;
|
|
9069
9081
|
})), false));
|
|
9070
9082
|
}
|
|
@@ -28572,8 +28584,8 @@ function modifyMatchUpFormatTiming$1(_a) {
|
|
|
28572
28584
|
var tournamentScheduling = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
|
|
28573
28585
|
var value = modifyScheduling(__assign(__assign({}, tournamentScheduling), { matchUpFormat: matchUpFormat, averageTimes: averageTimes, recoveryTimes: recoveryTimes }));
|
|
28574
28586
|
addTournamentExtension({
|
|
28575
|
-
tournamentRecord: tournamentRecord,
|
|
28576
28587
|
extension: { name: name, value: value },
|
|
28588
|
+
tournamentRecord: tournamentRecord,
|
|
28577
28589
|
});
|
|
28578
28590
|
}
|
|
28579
28591
|
return __assign({}, SUCCESS);
|
|
@@ -51389,8 +51401,10 @@ function attachPolicies(_a) {
|
|
|
51389
51401
|
if (!drawDefinition.extensions)
|
|
51390
51402
|
drawDefinition.extensions = [];
|
|
51391
51403
|
var appliedPolicies = (_c = (_b = getAppliedPolicies({ drawDefinition: drawDefinition })) === null || _b === void 0 ? void 0 : _b.appliedPolicies) !== null && _c !== void 0 ? _c : {};
|
|
51404
|
+
var validReplacements = [POLICY_TYPE_ROUND_NAMING, POLICY_TYPE_DISPLAY];
|
|
51392
51405
|
var applied = Object.keys(policyDefinitions).every(function (policyType) {
|
|
51393
|
-
if (!appliedPolicies[policyType]
|
|
51406
|
+
if (!appliedPolicies[policyType] ||
|
|
51407
|
+
validReplacements.includes(policyType)) {
|
|
51394
51408
|
appliedPolicies[policyType] = policyDefinitions[policyType];
|
|
51395
51409
|
return true;
|
|
51396
51410
|
}
|
|
@@ -61158,13 +61172,6 @@ function deleteFlightAndFlightDraw(_a) {
|
|
|
61158
61172
|
return refreshEventDrawOrder({ tournamentRecord: tournamentRecord, event: event });
|
|
61159
61173
|
}
|
|
61160
61174
|
|
|
61161
|
-
function generateAdHocMatchUps(params) {
|
|
61162
|
-
return generateAdHocMatchUps$1(params);
|
|
61163
|
-
}
|
|
61164
|
-
function addAdHocMatchUps(params) {
|
|
61165
|
-
return addAdHocMatchUps$1(params);
|
|
61166
|
-
}
|
|
61167
|
-
|
|
61168
61175
|
function attachFlightProfile(_a) {
|
|
61169
61176
|
var _b;
|
|
61170
61177
|
var deleteExisting = _a.deleteExisting, event = _a.event, flightProfile = _a.flightProfile;
|
|
@@ -61362,6 +61369,85 @@ function deleteAdHocMatchUps(params) {
|
|
|
61362
61369
|
return deleteAdHocMatchUps$1(params);
|
|
61363
61370
|
}
|
|
61364
61371
|
|
|
61372
|
+
function modifyDrawName(_a) {
|
|
61373
|
+
var _b;
|
|
61374
|
+
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, flightProfile = _a.flightProfile, drawName = _a.drawName, drawId = _a.drawId, event = _a.event;
|
|
61375
|
+
if (!drawName || typeof drawName !== 'string')
|
|
61376
|
+
return decorateResult({
|
|
61377
|
+
result: { error: INVALID_VALUES },
|
|
61378
|
+
context: { drawName: drawName },
|
|
61379
|
+
});
|
|
61380
|
+
if (!flightProfile) {
|
|
61381
|
+
flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
61382
|
+
}
|
|
61383
|
+
var flight = (_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; });
|
|
61384
|
+
if (flight) {
|
|
61385
|
+
flight.drawName = drawName;
|
|
61386
|
+
var extension = {
|
|
61387
|
+
name: FLIGHT_PROFILE,
|
|
61388
|
+
value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
|
|
61389
|
+
};
|
|
61390
|
+
addEventExtension$1({ event: event, extension: extension });
|
|
61391
|
+
}
|
|
61392
|
+
if (drawDefinition) {
|
|
61393
|
+
drawDefinition.drawName = drawName;
|
|
61394
|
+
modifyDrawNotice({
|
|
61395
|
+
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
61396
|
+
drawDefinition: drawDefinition,
|
|
61397
|
+
});
|
|
61398
|
+
}
|
|
61399
|
+
if (!flight && !drawDefinition) {
|
|
61400
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
61401
|
+
}
|
|
61402
|
+
return __assign(__assign({}, SUCCESS), { flight: flight });
|
|
61403
|
+
}
|
|
61404
|
+
|
|
61405
|
+
function modifyDrawDefinition(_a) {
|
|
61406
|
+
var _b;
|
|
61407
|
+
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, drawUpdates = _a.drawUpdates, drawId = _a.drawId, event = _a.event;
|
|
61408
|
+
if (!isObject(drawUpdates))
|
|
61409
|
+
return { error: INVALID_END_TIME };
|
|
61410
|
+
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
61411
|
+
var nameResult = drawUpdates.drawName &&
|
|
61412
|
+
modifyDrawName({
|
|
61413
|
+
drawName: drawUpdates.drawName,
|
|
61414
|
+
tournamentRecord: tournamentRecord,
|
|
61415
|
+
drawDefinition: drawDefinition,
|
|
61416
|
+
flightProfile: flightProfile,
|
|
61417
|
+
drawId: drawId,
|
|
61418
|
+
event: event,
|
|
61419
|
+
});
|
|
61420
|
+
if (nameResult === null || nameResult === void 0 ? void 0 : nameResult.error)
|
|
61421
|
+
return nameResult === null || nameResult === void 0 ? void 0 : nameResult.error;
|
|
61422
|
+
var flight = (nameResult === null || nameResult === void 0 ? void 0 : nameResult.flight) ||
|
|
61423
|
+
((_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; }));
|
|
61424
|
+
if (!flight && !drawDefinition) {
|
|
61425
|
+
return { error: MISSING_DRAW_DEFINITION };
|
|
61426
|
+
}
|
|
61427
|
+
if (flight) {
|
|
61428
|
+
// TODO: any relevant changes to flightProfile
|
|
61429
|
+
var extension = {
|
|
61430
|
+
name: FLIGHT_PROFILE,
|
|
61431
|
+
value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
|
|
61432
|
+
};
|
|
61433
|
+
addEventExtension$1({ event: event, extension: extension });
|
|
61434
|
+
}
|
|
61435
|
+
if (drawDefinition) {
|
|
61436
|
+
if (drawUpdates.policyDefinitions) {
|
|
61437
|
+
attachPolicies({
|
|
61438
|
+
policyDefinitions: drawUpdates.policyDefinitions,
|
|
61439
|
+
drawDefinition: drawDefinition,
|
|
61440
|
+
});
|
|
61441
|
+
}
|
|
61442
|
+
// TODO: any relevant changes to drawDefinition
|
|
61443
|
+
modifyDrawNotice({
|
|
61444
|
+
tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
|
|
61445
|
+
drawDefinition: drawDefinition,
|
|
61446
|
+
});
|
|
61447
|
+
}
|
|
61448
|
+
return __assign({}, SUCCESS);
|
|
61449
|
+
}
|
|
61450
|
+
|
|
61365
61451
|
function resetDrawDefinition(_a) {
|
|
61366
61452
|
var e_1, _b, e_2, _c;
|
|
61367
61453
|
var _d;
|
|
@@ -61567,31 +61653,6 @@ function setOrderOfFinish(params) {
|
|
|
61567
61653
|
return setOrderOfFinish$1(params);
|
|
61568
61654
|
}
|
|
61569
61655
|
|
|
61570
|
-
function modifyDrawName(_a) {
|
|
61571
|
-
var _b;
|
|
61572
|
-
var event = _a.event, drawId = _a.drawId, drawDefinition = _a.drawDefinition, drawName = _a.drawName;
|
|
61573
|
-
if (!drawName || typeof drawName !== 'string')
|
|
61574
|
-
return { error: INVALID_VALUES, drawName: drawName };
|
|
61575
|
-
var flightProfile = getFlightProfile({ event: event }).flightProfile;
|
|
61576
|
-
var flight = (_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; });
|
|
61577
|
-
if (flight) {
|
|
61578
|
-
flight.drawName = drawName;
|
|
61579
|
-
var extension = {
|
|
61580
|
-
name: FLIGHT_PROFILE,
|
|
61581
|
-
value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
|
|
61582
|
-
};
|
|
61583
|
-
addEventExtension$1({ event: event, extension: extension });
|
|
61584
|
-
}
|
|
61585
|
-
if (drawDefinition) {
|
|
61586
|
-
drawDefinition.drawName = drawName;
|
|
61587
|
-
modifyDrawNotice({ drawDefinition: drawDefinition });
|
|
61588
|
-
}
|
|
61589
|
-
if (!flight && !drawDefinition) {
|
|
61590
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
61591
|
-
}
|
|
61592
|
-
return __assign({}, SUCCESS);
|
|
61593
|
-
}
|
|
61594
|
-
|
|
61595
61656
|
function modifyEventEntries(_a) {
|
|
61596
61657
|
var _b;
|
|
61597
61658
|
var _c = _a.entryStatus, entryStatus = _c === void 0 ? DIRECT_ACCEPTANCE : _c, _d = _a.unpairedParticipantIds, unpairedParticipantIds = _d === void 0 ? [] : _d, _e = _a.participantIdPairs, participantIdPairs = _e === void 0 ? [] : _e, _f = _a.entryStage, entryStage = _f === void 0 ? MAIN : _f, tournamentRecord = _a.tournamentRecord, event = _a.event;
|
|
@@ -61715,6 +61776,13 @@ function addFlight(_a) {
|
|
|
61715
61776
|
return addEventExtension$1({ event: event, extension: extension });
|
|
61716
61777
|
}
|
|
61717
61778
|
|
|
61779
|
+
function generateAdHocMatchUps(params) {
|
|
61780
|
+
return generateAdHocMatchUps$1(params);
|
|
61781
|
+
}
|
|
61782
|
+
function addAdHocMatchUps(params) {
|
|
61783
|
+
return addAdHocMatchUps$1(params);
|
|
61784
|
+
}
|
|
61785
|
+
|
|
61718
61786
|
function attachConsolationStructures(params) {
|
|
61719
61787
|
return attachStructures(__assign(__assign({}, params), { itemType: 'attachConsolationStructures' }));
|
|
61720
61788
|
}
|
|
@@ -63040,6 +63108,71 @@ function enableTieAutoCalc(params) {
|
|
|
63040
63108
|
return enableTieAutoCalc$1(params);
|
|
63041
63109
|
}
|
|
63042
63110
|
|
|
63111
|
+
function modifyEvent(_a) {
|
|
63112
|
+
var _b;
|
|
63113
|
+
var tournamentRecord = _a.tournamentRecord, eventUpdates = _a.eventUpdates, eventId = _a.eventId, event = _a.event;
|
|
63114
|
+
if (!tournamentRecord)
|
|
63115
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63116
|
+
if (!isString(eventId) || !isObject(eventUpdates))
|
|
63117
|
+
return { error: INVALID_VALUES };
|
|
63118
|
+
var enteredParticipantIds = ((_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
|
|
63119
|
+
var entryStatus = _a.entryStatus;
|
|
63120
|
+
var status = entryStatus;
|
|
63121
|
+
return __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [ALTERNATE], false).includes(status);
|
|
63122
|
+
}).map(function (_a) {
|
|
63123
|
+
var participantId = _a.participantId;
|
|
63124
|
+
return participantId;
|
|
63125
|
+
})) || [];
|
|
63126
|
+
var enteredParticipants = enteredParticipantIds
|
|
63127
|
+
? getParticipants$1({
|
|
63128
|
+
participantFilters: { participantIds: enteredParticipantIds },
|
|
63129
|
+
withIndividualParticipants: true,
|
|
63130
|
+
tournamentRecord: tournamentRecord,
|
|
63131
|
+
}).participants || []
|
|
63132
|
+
: [];
|
|
63133
|
+
var genderAccumulator = [];
|
|
63134
|
+
var enteredParticipantTypes = enteredParticipants.reduce(function (types, participant) {
|
|
63135
|
+
var _a, _b;
|
|
63136
|
+
var genders = ((_a = participant.person) === null || _a === void 0 ? void 0 : _a.sex)
|
|
63137
|
+
? [participant.person.sex]
|
|
63138
|
+
: ((_b = participant.individualParticpants) === null || _b === void 0 ? void 0 : _b.map(function (p) { var _a; return (_a = p.person) === null || _a === void 0 ? void 0 : _a.sex; })) || [];
|
|
63139
|
+
genderAccumulator.push.apply(genderAccumulator, __spreadArray([], __read(genders), false));
|
|
63140
|
+
return !types.includes(participant.participantType)
|
|
63141
|
+
? types.concat(participant.participantType)
|
|
63142
|
+
: types;
|
|
63143
|
+
}, []);
|
|
63144
|
+
var enteredParticipantGenders = unique(genderAccumulator);
|
|
63145
|
+
var validGender = !enteredParticipantGenders.length ||
|
|
63146
|
+
[MIXED, ANY].includes(eventUpdates.gender || '') ||
|
|
63147
|
+
(enteredParticipantGenders.length === 1 &&
|
|
63148
|
+
enteredParticipantGenders[0] === eventUpdates.gender);
|
|
63149
|
+
if (eventUpdates.gender && !validGender)
|
|
63150
|
+
return decorateResult({
|
|
63151
|
+
context: { gender: eventUpdates.gender },
|
|
63152
|
+
result: { error: INVALID_VALUES },
|
|
63153
|
+
});
|
|
63154
|
+
var validEventTypes = (enteredParticipantTypes.includes(TEAM$1) && [TEAM$1]) ||
|
|
63155
|
+
(enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES]) ||
|
|
63156
|
+
(enteredParticipantTypes.includes(PAIR) && [DOUBLES]) || [
|
|
63157
|
+
DOUBLES,
|
|
63158
|
+
SINGLES,
|
|
63159
|
+
TEAM$1,
|
|
63160
|
+
];
|
|
63161
|
+
var validEventType = validEventTypes.includes(eventUpdates.eventType || '');
|
|
63162
|
+
if (eventUpdates.eventType && !validEventType)
|
|
63163
|
+
return decorateResult({
|
|
63164
|
+
context: { participantType: eventUpdates.eventType },
|
|
63165
|
+
result: { error: INVALID_VALUES },
|
|
63166
|
+
});
|
|
63167
|
+
if (eventUpdates.eventType)
|
|
63168
|
+
event.eventType === eventUpdates.eventType;
|
|
63169
|
+
if (eventUpdates.eventName)
|
|
63170
|
+
event.eventName = eventUpdates.eventName;
|
|
63171
|
+
if (eventUpdates.gender)
|
|
63172
|
+
event.gender = eventUpdates.gender;
|
|
63173
|
+
return __assign({}, SUCCESS);
|
|
63174
|
+
}
|
|
63175
|
+
|
|
63043
63176
|
var eventGovernor = {
|
|
63044
63177
|
generateQualifyingStructure: generateQualifyingStructure,
|
|
63045
63178
|
attachQualifyingStructure: attachQualifyingStructure,
|
|
@@ -63060,11 +63193,12 @@ var eventGovernor = {
|
|
|
63060
63193
|
modifyTieFormat: modifyTieFormat$1,
|
|
63061
63194
|
resetScorecard: resetScorecard,
|
|
63062
63195
|
resetTieFormat: resetTieFormat$1,
|
|
63063
|
-
addEvent: addEvent,
|
|
63064
|
-
deleteEvents: deleteEvents,
|
|
63065
|
-
setEventDates: setEventDates,
|
|
63066
63196
|
setEventStartDate: setEventStartDate,
|
|
63067
63197
|
setEventEndDate: setEventEndDate,
|
|
63198
|
+
setEventDates: setEventDates,
|
|
63199
|
+
deleteEvents: deleteEvents,
|
|
63200
|
+
modifyEvent: modifyEvent,
|
|
63201
|
+
addEvent: addEvent,
|
|
63068
63202
|
removeSeededParticipant: removeSeededParticipant,
|
|
63069
63203
|
removeScaleValues: removeScaleValues,
|
|
63070
63204
|
checkValidEntries: checkValidEntries,
|
|
@@ -63075,6 +63209,7 @@ var eventGovernor = {
|
|
|
63075
63209
|
getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
|
|
63076
63210
|
deleteDrawDefinitions: deleteDrawDefinitions,
|
|
63077
63211
|
addPlayoffStructures: addPlayoffStructures,
|
|
63212
|
+
modifyDrawDefinition: modifyDrawDefinition,
|
|
63078
63213
|
addDrawDefinition: addDrawDefinition$1,
|
|
63079
63214
|
removeStructure: removeStructure,
|
|
63080
63215
|
modifyDrawName: modifyDrawName,
|
|
@@ -63177,7 +63312,7 @@ function getMaxEntryPosition(params) {
|
|
|
63177
63312
|
function getPredictiveAccuracy(params) {
|
|
63178
63313
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
63179
63314
|
var matchUps = params.matchUps;
|
|
63180
|
-
var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType,
|
|
63315
|
+
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;
|
|
63181
63316
|
if (!tournamentRecord && !matchUps)
|
|
63182
63317
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63183
63318
|
if (matchUpType && ![SINGLES$1, DOUBLES$1].includes(matchUpType))
|
|
@@ -63187,6 +63322,12 @@ function getPredictiveAccuracy(params) {
|
|
|
63187
63322
|
var scaleProfile = ratingsParameters[scaleName];
|
|
63188
63323
|
var ascending = (_b = (_a = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.ascending) !== null && _a !== void 0 ? _a : params.ascending) !== null && _b !== void 0 ? _b : false;
|
|
63189
63324
|
var valueAccessor = (_c = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.accessor) !== null && _c !== void 0 ? _c : params.valueAccessor;
|
|
63325
|
+
var ratingsRangeDifference = Array.isArray(scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.range)
|
|
63326
|
+
? Math.abs(scaleProfile.range[0] - scaleProfile.range[1])
|
|
63327
|
+
: 0;
|
|
63328
|
+
var zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
|
|
63329
|
+
? (zonePct || 0 / 100) * ratingsRangeDifference
|
|
63330
|
+
: params.zoneMargin || ratingsRangeDifference;
|
|
63190
63331
|
var contextProfile = { withScaleValues: true, withCompetitiveness: true };
|
|
63191
63332
|
var contextFilters = {
|
|
63192
63333
|
matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
|
|
@@ -63233,7 +63374,7 @@ function getPredictiveAccuracy(params) {
|
|
|
63233
63374
|
}
|
|
63234
63375
|
var relevantMatchUps = matchUps.filter(function (_a) {
|
|
63235
63376
|
var winningSide = _a.winningSide, score = _a.score, sides = _a.sides, matchUpStatus = _a.matchUpStatus;
|
|
63236
|
-
return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus) &&
|
|
63377
|
+
return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus || '') &&
|
|
63237
63378
|
scoreHasValue({ score: score }) &&
|
|
63238
63379
|
(sides === null || sides === void 0 ? void 0 : sides.length) === 2 &&
|
|
63239
63380
|
winningSide;
|
|
@@ -63246,9 +63387,11 @@ function getPredictiveAccuracy(params) {
|
|
|
63246
63387
|
ascending: ascending,
|
|
63247
63388
|
scaleName: scaleName,
|
|
63248
63389
|
});
|
|
63249
|
-
var marginCalc = !zoneDoubling || matchUpType === SINGLES$1
|
|
63250
|
-
|
|
63251
|
-
|
|
63390
|
+
var marginCalc = !zoneDoubling || matchUpType === SINGLES$1
|
|
63391
|
+
? zoneMargin
|
|
63392
|
+
: (zoneMargin || 0) * 2;
|
|
63393
|
+
var zoneData = zoneMargin
|
|
63394
|
+
? relevantMatchUps
|
|
63252
63395
|
.map(function (_a) {
|
|
63253
63396
|
var competitiveProfile = _a.competitiveProfile, matchUpType = _a.matchUpType, score = _a.score, sides = _a.sides;
|
|
63254
63397
|
var sideValues = getSideValues({
|
|
@@ -63267,8 +63410,9 @@ function getPredictiveAccuracy(params) {
|
|
|
63267
63410
|
.filter(function (_a) {
|
|
63268
63411
|
var valuesGap = _a.valuesGap;
|
|
63269
63412
|
return valuesGap <= marginCalc;
|
|
63270
|
-
})
|
|
63271
|
-
|
|
63413
|
+
})
|
|
63414
|
+
: [];
|
|
63415
|
+
var zoneBands = getGroupingBands({ zoneData: zoneData });
|
|
63272
63416
|
var totalZoneMatchUps = zoneBands && [].concat(Object.values(zoneBands)).flat().length;
|
|
63273
63417
|
var zoneDistribution = totalZoneMatchUps && Object.assign.apply(Object, __spreadArray([{}], __read(Object.keys(zoneBands).map(function (key) {
|
|
63274
63418
|
var _a;
|
|
@@ -63441,7 +63585,7 @@ function getGroupingAccuracy(_a) {
|
|
|
63441
63585
|
continue;
|
|
63442
63586
|
}
|
|
63443
63587
|
var valuesGap = sideValues[winningIndex].value - sideValues[1 - winningIndex].value;
|
|
63444
|
-
var floatMargin = parseFloat(excludeMargin);
|
|
63588
|
+
var floatMargin = parseFloat(excludeMargin || 0);
|
|
63445
63589
|
var excludeGap = floatMargin && Math.abs(valuesGap) < floatMargin;
|
|
63446
63590
|
if (excludeGap) {
|
|
63447
63591
|
accuracy.excluded.push({
|