tods-competition-factory 2.0.0-beta.1 → 2.0.0-beta.2
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/README.md +17 -14
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.d.ts +51 -173
- package/dist/tods-competition-factory.development.cjs.js +127 -191
- 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 +6 -12
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.0-beta.
|
|
6
|
+
return '2.0.0-beta.2';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -2070,39 +2070,6 @@ function findExtension(_a) {
|
|
|
2070
2070
|
return { extension: extension, info: info };
|
|
2071
2071
|
}
|
|
2072
2072
|
|
|
2073
|
-
var DYNAMIC = 'DYNAMIC';
|
|
2074
|
-
var RANKING$1 = 'RANKING';
|
|
2075
|
-
var RATING$2 = 'RATING';
|
|
2076
|
-
var SCALE$1 = 'SCALE';
|
|
2077
|
-
var SEEDING$1 = 'SEEDING';
|
|
2078
|
-
var scaleConstants = {
|
|
2079
|
-
RANKING: RANKING$1,
|
|
2080
|
-
RATING: RATING$2,
|
|
2081
|
-
SCALE: SCALE$1,
|
|
2082
|
-
SEEDING: SEEDING$1,
|
|
2083
|
-
};
|
|
2084
|
-
|
|
2085
|
-
var SINGLES$1 = 'SINGLES';
|
|
2086
|
-
var SINGLES_EVENT = 'SINGLES';
|
|
2087
|
-
var DOUBLES$1 = 'DOUBLES';
|
|
2088
|
-
var DOUBLES_EVENT = 'DOUBLES';
|
|
2089
|
-
var TEAM$2 = 'TEAM';
|
|
2090
|
-
var TEAM_EVENT = 'TEAM';
|
|
2091
|
-
var AGE = 'AGE';
|
|
2092
|
-
var RATING$1 = 'RATING';
|
|
2093
|
-
var BOTH = 'BOTH';
|
|
2094
|
-
var eventConstants = {
|
|
2095
|
-
AGE: AGE,
|
|
2096
|
-
BOTH: BOTH,
|
|
2097
|
-
DOUBLES: DOUBLES$1,
|
|
2098
|
-
DOUBLES_EVENT: DOUBLES_EVENT,
|
|
2099
|
-
RATING: RATING$1,
|
|
2100
|
-
SINGLES: SINGLES$1,
|
|
2101
|
-
SINGLES_EVENT: SINGLES_EVENT,
|
|
2102
|
-
TEAM_EVENT: TEAM_EVENT,
|
|
2103
|
-
TEAM: TEAM$2,
|
|
2104
|
-
};
|
|
2105
|
-
|
|
2106
2073
|
var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
|
|
2107
2074
|
var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
|
|
2108
2075
|
var dateValidation = /^([\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1]))([ T](0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)?([.,][\d]{3})?Z?$/;
|
|
@@ -2886,6 +2853,39 @@ function checkValidation(value, validate) {
|
|
|
2886
2853
|
return true;
|
|
2887
2854
|
}
|
|
2888
2855
|
|
|
2856
|
+
var DYNAMIC = 'DYNAMIC';
|
|
2857
|
+
var RANKING$1 = 'RANKING';
|
|
2858
|
+
var RATING$2 = 'RATING';
|
|
2859
|
+
var SCALE$1 = 'SCALE';
|
|
2860
|
+
var SEEDING$1 = 'SEEDING';
|
|
2861
|
+
var scaleConstants = {
|
|
2862
|
+
RANKING: RANKING$1,
|
|
2863
|
+
RATING: RATING$2,
|
|
2864
|
+
SCALE: SCALE$1,
|
|
2865
|
+
SEEDING: SEEDING$1,
|
|
2866
|
+
};
|
|
2867
|
+
|
|
2868
|
+
var SINGLES$1 = 'SINGLES';
|
|
2869
|
+
var SINGLES_EVENT = 'SINGLES';
|
|
2870
|
+
var DOUBLES$1 = 'DOUBLES';
|
|
2871
|
+
var DOUBLES_EVENT = 'DOUBLES';
|
|
2872
|
+
var TEAM$2 = 'TEAM';
|
|
2873
|
+
var TEAM_EVENT = 'TEAM';
|
|
2874
|
+
var AGE = 'AGE';
|
|
2875
|
+
var RATING$1 = 'RATING';
|
|
2876
|
+
var BOTH = 'BOTH';
|
|
2877
|
+
var eventConstants = {
|
|
2878
|
+
AGE: AGE,
|
|
2879
|
+
BOTH: BOTH,
|
|
2880
|
+
DOUBLES: DOUBLES$1,
|
|
2881
|
+
DOUBLES_EVENT: DOUBLES_EVENT,
|
|
2882
|
+
RATING: RATING$1,
|
|
2883
|
+
SINGLES: SINGLES$1,
|
|
2884
|
+
SINGLES_EVENT: SINGLES_EVENT,
|
|
2885
|
+
TEAM_EVENT: TEAM_EVENT,
|
|
2886
|
+
TEAM: TEAM$2,
|
|
2887
|
+
};
|
|
2888
|
+
|
|
2889
2889
|
function getScaleValues(params) {
|
|
2890
2890
|
var e_1, _a;
|
|
2891
2891
|
var _b;
|
|
@@ -5642,8 +5642,7 @@ function getDrawPositionCollectionAssignment(_a) {
|
|
|
5642
5642
|
var teamParticipantId = (_d = positionAssignments.find(function (assignment) { return assignment.drawPosition === drawPosition; })) === null || _d === void 0 ? void 0 : _d.participantId;
|
|
5643
5643
|
var side = sideLineUps === null || sideLineUps === void 0 ? void 0 : sideLineUps.find(function (lineUp) { return (lineUp === null || lineUp === void 0 ? void 0 : lineUp.drawPosition) === drawPosition; });
|
|
5644
5644
|
var teamParticipant = (side === null || side === void 0 ? void 0 : side.teamParticipant) ||
|
|
5645
|
-
(teamParticipantId &&
|
|
5646
|
-
((_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _e === void 0 ? void 0 : _e.participant)) ||
|
|
5645
|
+
(teamParticipantId && ((_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _e === void 0 ? void 0 : _e.participant)) ||
|
|
5647
5646
|
(tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.find(function (_a) {
|
|
5648
5647
|
var participantId = _a.participantId;
|
|
5649
5648
|
return participantId === teamParticipantId;
|
|
@@ -5661,8 +5660,7 @@ function getDrawPositionCollectionAssignment(_a) {
|
|
|
5661
5660
|
if (matchUpType === DOUBLES) {
|
|
5662
5661
|
if ((assignedParticipantIds === null || assignedParticipantIds === void 0 ? void 0 : assignedParticipantIds.length) <= 2) {
|
|
5663
5662
|
var pairedParticipantId = (_h = (_g = participantMap === null || participantMap === void 0 ? void 0 : participantMap[assignedParticipantIds[0]]) === null || _g === void 0 ? void 0 : _g.pairIdMap) === null || _h === void 0 ? void 0 : _h[assignedParticipantIds[1]];
|
|
5664
|
-
var pairedParticipant = pairedParticipantId &&
|
|
5665
|
-
((_j = participantMap[pairedParticipantId]) === null || _j === void 0 ? void 0 : _j.participant);
|
|
5663
|
+
var pairedParticipant = pairedParticipantId && ((_j = participantMap[pairedParticipantId]) === null || _j === void 0 ? void 0 : _j.participant);
|
|
5666
5664
|
var participant = pairedParticipant ||
|
|
5667
5665
|
// resort to brute force
|
|
5668
5666
|
getPairedParticipant({
|
|
@@ -7127,10 +7125,12 @@ function matchUpEndTime(_a) {
|
|
|
7127
7125
|
return { endTime: endTime };
|
|
7128
7126
|
}
|
|
7129
7127
|
|
|
7130
|
-
function getMatchUpScheduleDetails(
|
|
7131
|
-
var _b, _c, _d, _e,
|
|
7132
|
-
var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t
|
|
7133
|
-
var
|
|
7128
|
+
function getMatchUpScheduleDetails(params) {
|
|
7129
|
+
var _a, _b, _c, _d, _e, e_1, _f;
|
|
7130
|
+
var _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
7131
|
+
var event = params.event;
|
|
7132
|
+
var matchUpType = params.matchUpType;
|
|
7133
|
+
var scheduleVisibilityFilters = params.scheduleVisibilityFilters, afterRecoveryTimes = params.afterRecoveryTimes, tournamentRecord = params.tournamentRecord, usePublishState = params.usePublishState, scheduleTiming = params.scheduleTiming, matchUpFormat = params.matchUpFormat, publishStatus = params.publishStatus, matchUp = params.matchUp;
|
|
7134
7134
|
if (!matchUp)
|
|
7135
7135
|
return { error: MISSING_MATCHUP };
|
|
7136
7136
|
// matchUpType is required to derive averageMatchUpMinutes and recoveryMinutes.
|
|
@@ -7138,31 +7138,32 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7138
7138
|
// ...attempt to derive by interrogating structure, draw, and event
|
|
7139
7139
|
if (afterRecoveryTimes &&
|
|
7140
7140
|
!matchUp.matchUpType &&
|
|
7141
|
-
!matchUpType &&
|
|
7141
|
+
!params.matchUpType &&
|
|
7142
7142
|
(event || tournamentRecord) &&
|
|
7143
7143
|
matchUp.drawId) {
|
|
7144
|
-
var drawDefinition = (
|
|
7144
|
+
var drawDefinition = (_g = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _g === void 0 ? void 0 : _g.find(function (drawDefinition) { return drawDefinition.drawId === matchUp.drawId; });
|
|
7145
7145
|
if (!drawDefinition && tournamentRecord) {
|
|
7146
|
-
(
|
|
7146
|
+
(_a = findEvent({
|
|
7147
7147
|
tournamentRecord: tournamentRecord,
|
|
7148
7148
|
drawId: matchUp.drawId,
|
|
7149
|
-
}), drawDefinition =
|
|
7149
|
+
}), drawDefinition = _a.drawDefinition, event = _a.event);
|
|
7150
7150
|
}
|
|
7151
7151
|
var structure = matchUp.structureId &&
|
|
7152
|
-
((
|
|
7152
|
+
((_h = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) === null || _h === void 0 ? void 0 : _h.find(function (_a) {
|
|
7153
7153
|
var structureId = _a.structureId;
|
|
7154
7154
|
return structureId === matchUp.structureId;
|
|
7155
7155
|
}));
|
|
7156
7156
|
matchUpType =
|
|
7157
|
-
|
|
7157
|
+
params.matchUpType ||
|
|
7158
|
+
(structure === null || structure === void 0 ? void 0 : structure.matchUpType) ||
|
|
7158
7159
|
(drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.matchUpType) ||
|
|
7159
7160
|
((event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 && (event === null || event === void 0 ? void 0 : event.eventType));
|
|
7160
7161
|
}
|
|
7161
|
-
var
|
|
7162
|
+
var _u = matchUpDuration({ matchUp: matchUp }), milliseconds = _u.milliseconds, time = _u.time;
|
|
7162
7163
|
var startTime = matchUpStartTime({ matchUp: matchUp }).startTime;
|
|
7163
7164
|
var endTime = matchUpEndTime({ matchUp: matchUp }).endTime;
|
|
7164
7165
|
var schedule;
|
|
7165
|
-
var
|
|
7166
|
+
var _v = scheduleVisibilityFilters !== null && scheduleVisibilityFilters !== void 0 ? scheduleVisibilityFilters : {}, visibilityThreshold = _v.visibilityThreshold, eventIds = _v.eventIds, drawIds = _v.drawIds;
|
|
7166
7167
|
if ((!eventIds || eventIds.includes(matchUp.eventId)) &&
|
|
7167
7168
|
(!drawIds || drawIds.includes(matchUp.drawId))) {
|
|
7168
7169
|
var scheduleSource = { matchUp: matchUp, visibilityThreshold: visibilityThreshold };
|
|
@@ -7174,13 +7175,13 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7174
7175
|
var courtOrder = matchUpCourtOrder(scheduleSource).courtOrder;
|
|
7175
7176
|
var timeModifiers = matchUpTimeModifiers(scheduleSource).timeModifiers;
|
|
7176
7177
|
var timeAfterRecovery = void 0, averageMinutes = void 0, recoveryMinutes = void 0, typeChangeRecoveryMinutes = void 0, typeChangeTimeAfterRecovery = void 0;
|
|
7177
|
-
var eventType = (
|
|
7178
|
+
var eventType = (_j = matchUp.matchUpType) !== null && _j !== void 0 ? _j : matchUpType;
|
|
7178
7179
|
if (scheduleTiming && scheduledTime_1 && afterRecoveryTimes && eventType) {
|
|
7179
|
-
var timingDetails = __assign({ matchUpFormat: (
|
|
7180
|
-
(
|
|
7180
|
+
var timingDetails = __assign({ matchUpFormat: (_k = matchUp.matchUpFormat) !== null && _k !== void 0 ? _k : matchUpFormat }, scheduleTiming);
|
|
7181
|
+
(_b = matchUpFormatTimes({
|
|
7181
7182
|
timingDetails: timingDetails,
|
|
7182
7183
|
eventType: eventType,
|
|
7183
|
-
}),
|
|
7184
|
+
}), _c = _b.averageMinutes, averageMinutes = _c === void 0 ? 0 : _c, _d = _b.recoveryMinutes, recoveryMinutes = _d === void 0 ? 0 : _d, _e = _b.typeChangeRecoveryMinutes, typeChangeRecoveryMinutes = _e === void 0 ? 0 : _e);
|
|
7184
7185
|
if (averageMinutes || recoveryMinutes) {
|
|
7185
7186
|
timeAfterRecovery = endTime
|
|
7186
7187
|
? addMinutesToTimeString(extractTime(endTime), recoveryMinutes)
|
|
@@ -7196,9 +7197,9 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7196
7197
|
scheduledDate_1 = extractDate(scheduledTime_1);
|
|
7197
7198
|
var isoDateString = getIsoDateString({ scheduledDate: scheduledDate_1, scheduledTime: scheduledTime_1 });
|
|
7198
7199
|
var venueDataMap = {};
|
|
7199
|
-
var venueData = ((
|
|
7200
|
+
var venueData = ((_l = (tournamentRecord &&
|
|
7200
7201
|
venueId &&
|
|
7201
|
-
getVenueData({ tournamentRecord: tournamentRecord, venueId: venueId }))) === null ||
|
|
7202
|
+
getVenueData({ tournamentRecord: tournamentRecord, venueId: venueId }))) === null || _l === void 0 ? void 0 : _l.venueData) || {};
|
|
7202
7203
|
if (venueId)
|
|
7203
7204
|
venueDataMap[venueId] = venueData;
|
|
7204
7205
|
var venueName = venueData.venueName, venueAbbreviation = venueData.venueAbbreviation, courtsInfo = venueData.courtsInfo;
|
|
@@ -7208,19 +7209,19 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7208
7209
|
if (!tournamentRecord)
|
|
7209
7210
|
return "break";
|
|
7210
7211
|
if (allocatedCourt.venueId && !venueDataMap[allocatedCourt.venueid]) {
|
|
7211
|
-
venueDataMap[allocatedCourt.venueId] = (
|
|
7212
|
+
venueDataMap[allocatedCourt.venueId] = (_m = getVenueData({
|
|
7212
7213
|
venueId: allocatedCourt.venueId,
|
|
7213
7214
|
tournamentRecord: tournamentRecord,
|
|
7214
|
-
})) === null ||
|
|
7215
|
+
})) === null || _m === void 0 ? void 0 : _m.venueData;
|
|
7215
7216
|
}
|
|
7216
7217
|
var vData = venueDataMap[allocatedCourt.venueId];
|
|
7217
7218
|
allocatedCourt.venueName = vData === null || vData === void 0 ? void 0 : vData.venueName;
|
|
7218
|
-
var courtInfo_1 = (
|
|
7219
|
+
var courtInfo_1 = (_o = vData === null || vData === void 0 ? void 0 : vData.courtsInfo) === null || _o === void 0 ? void 0 : _o.find(function (courtInfo) { return courtInfo.courtId === allocatedCourt.courtId; });
|
|
7219
7220
|
allocatedCourt.courtName = courtInfo_1 === null || courtInfo_1 === void 0 ? void 0 : courtInfo_1.courtName;
|
|
7220
7221
|
};
|
|
7221
7222
|
try {
|
|
7222
|
-
for (var
|
|
7223
|
-
var allocatedCourt =
|
|
7223
|
+
for (var _w = __values(allocatedCourts || []), _x = _w.next(); !_x.done; _x = _w.next()) {
|
|
7224
|
+
var allocatedCourt = _x.value;
|
|
7224
7225
|
var state_1 = _loop_1(allocatedCourt);
|
|
7225
7226
|
if (state_1 === "break")
|
|
7226
7227
|
break;
|
|
@@ -7229,7 +7230,7 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7229
7230
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
7230
7231
|
finally {
|
|
7231
7232
|
try {
|
|
7232
|
-
if (
|
|
7233
|
+
if (_x && !_x.done && (_f = _w.return)) _f.call(_w);
|
|
7233
7234
|
}
|
|
7234
7235
|
finally { if (e_1) throw e_1.error; }
|
|
7235
7236
|
}
|
|
@@ -7266,11 +7267,11 @@ function getMatchUpScheduleDetails(_a) {
|
|
|
7266
7267
|
}
|
|
7267
7268
|
var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
|
|
7268
7269
|
var scheduledTime = scheduledMatchUpTime({ matchUp: matchUp }).scheduledTime;
|
|
7269
|
-
if (usePublishState && ((
|
|
7270
|
+
if (usePublishState && ((_p = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.displaySettings) === null || _p === void 0 ? void 0 : _p.draws)) {
|
|
7270
7271
|
var drawSettings = publishStatus.displaySettings.draws;
|
|
7271
|
-
var scheduleDetails = (
|
|
7272
|
+
var scheduleDetails = (_r = ((_q = drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings[matchUp.drawId]) !== null && _q !== void 0 ? _q : drawSettings === null || drawSettings === void 0 ? void 0 : drawSettings.default)) === null || _r === void 0 ? void 0 : _r.scheduleDetails;
|
|
7272
7273
|
if (scheduleDetails) {
|
|
7273
|
-
var scheduleAttributes = (
|
|
7274
|
+
var scheduleAttributes = (_t = ((_s = scheduleDetails.find(function (details) { var _a; return scheduledDate && ((_a = details.dates) === null || _a === void 0 ? void 0 : _a.includes(scheduledDate)); })) !== null && _s !== void 0 ? _s : scheduleDetails.find(function (details) { var _a; return !((_a = details.dates) === null || _a === void 0 ? void 0 : _a.length); }))) === null || _t === void 0 ? void 0 : _t.attributes;
|
|
7274
7275
|
if (scheduleAttributes) {
|
|
7275
7276
|
// set all attributes to true
|
|
7276
7277
|
var template = Object.assign.apply(Object, __spreadArray(__spreadArray([{}], __read(Object.keys(schedule).map(function (key) {
|
|
@@ -13284,10 +13285,7 @@ function getPublishState(_a) {
|
|
|
13284
13285
|
}
|
|
13285
13286
|
return __assign(__assign({}, SUCCESS), { publishState: publishState });
|
|
13286
13287
|
}
|
|
13287
|
-
else if (!event &&
|
|
13288
|
-
(tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) &&
|
|
13289
|
-
Array.isArray(drawIds) &&
|
|
13290
|
-
drawIds.length) {
|
|
13288
|
+
else if (!event && (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.events) && Array.isArray(drawIds) && drawIds.length) {
|
|
13291
13289
|
var publishState = {};
|
|
13292
13290
|
try {
|
|
13293
13291
|
for (var _f = __values(tournamentRecord.events), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
@@ -13373,10 +13371,7 @@ function getPubStatus(_a) {
|
|
|
13373
13371
|
Object.assign(publishedSeeding, eventPubStatus.seeding);
|
|
13374
13372
|
}
|
|
13375
13373
|
var drawDetails = eventPubStatus.drawDetails;
|
|
13376
|
-
var publishedDrawIds = (drawDetails &&
|
|
13377
|
-
Object.keys(drawDetails).filter(function (drawId) {
|
|
13378
|
-
return getDrawPublishStatus({ drawDetails: drawDetails, drawId: drawId });
|
|
13379
|
-
})) ||
|
|
13374
|
+
var publishedDrawIds = (drawDetails && Object.keys(drawDetails).filter(function (drawId) { return getDrawPublishStatus({ drawDetails: drawDetails, drawId: drawId }); })) ||
|
|
13380
13375
|
eventPubStatus.drawIds ||
|
|
13381
13376
|
[];
|
|
13382
13377
|
return __assign({ publishState: {
|
|
@@ -16148,9 +16143,7 @@ function validateSchedulingProfile(_a) {
|
|
|
16148
16143
|
info = 'Invalid rounds';
|
|
16149
16144
|
var _d = roundSegment || {}, segmentNumber = _d.segmentNumber, segmentsCount = _d.segmentsCount;
|
|
16150
16145
|
var validSegment = !roundSegment ||
|
|
16151
|
-
(isConvertableInteger(segmentNumber) &&
|
|
16152
|
-
isPowerOf2(segmentsCount) &&
|
|
16153
|
-
segmentNumber <= segmentsCount);
|
|
16146
|
+
(isConvertableInteger(segmentNumber) && isPowerOf2(segmentsCount) && segmentNumber <= segmentsCount);
|
|
16154
16147
|
if (!validSegment)
|
|
16155
16148
|
info = 'Invalid segment';
|
|
16156
16149
|
return validRound && validSegment;
|
|
@@ -16192,10 +16185,7 @@ function tournamentRelevantSchedulingIds(params) {
|
|
|
16192
16185
|
var structureId = structure.structureId;
|
|
16193
16186
|
var matchUps = getAllStructureMatchUps({ structure: structure }).matchUps;
|
|
16194
16187
|
var roundMatchUps = getRoundMatchUps({ matchUps: matchUps }).roundMatchUps;
|
|
16195
|
-
var rounds = roundMatchUps &&
|
|
16196
|
-
Object.keys(roundMatchUps).map(function (roundNumber) {
|
|
16197
|
-
return parseInt(roundNumber);
|
|
16198
|
-
});
|
|
16188
|
+
var rounds = roundMatchUps && Object.keys(roundMatchUps).map(function (roundNumber) { return parseInt(roundNumber); });
|
|
16199
16189
|
tournamentMap[tournamentId][eventId][drawId][structureId] = rounds;
|
|
16200
16190
|
structureIds.push(structureId);
|
|
16201
16191
|
if ((_a = structure.structures) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -16218,8 +16208,7 @@ function tournamentRelevantSchedulingIds(params) {
|
|
|
16218
16208
|
};
|
|
16219
16209
|
}
|
|
16220
16210
|
function getAllRelevantSchedulingIds(params) {
|
|
16221
|
-
var records = ((params === null || params === void 0 ? void 0 : params.tournamentRecords) && Object.values(params === null || params === void 0 ? void 0 : params.tournamentRecords)) ||
|
|
16222
|
-
[];
|
|
16211
|
+
var records = ((params === null || params === void 0 ? void 0 : params.tournamentRecords) && Object.values(params === null || params === void 0 ? void 0 : params.tournamentRecords)) || [];
|
|
16223
16212
|
var tournamentsMap = {};
|
|
16224
16213
|
var _a = records.reduce(function (aggregator, tournamentRecord) {
|
|
16225
16214
|
var _a, _b, _c, _d;
|
|
@@ -25220,9 +25209,7 @@ function automatedPositioning(_a) {
|
|
|
25220
25209
|
return handleErrorCondition(result_1);
|
|
25221
25210
|
unseededByePositions = result_1.unseededByePositions;
|
|
25222
25211
|
positioningReport.push({ action: 'positionByes', unseededByePositions: unseededByePositions });
|
|
25223
|
-
var profileSeeding = structure.seedingProfile
|
|
25224
|
-
? { positioning: structure.seedingProfile }
|
|
25225
|
-
: seedingProfile;
|
|
25212
|
+
var profileSeeding = structure.seedingProfile ? { positioning: structure.seedingProfile } : seedingProfile;
|
|
25226
25213
|
result_1 = positionSeedBlocks({
|
|
25227
25214
|
seedingProfile: profileSeeding,
|
|
25228
25215
|
provisionalPositioning: provisionalPositioning,
|
|
@@ -25248,9 +25235,7 @@ function automatedPositioning(_a) {
|
|
|
25248
25235
|
// otherwise... seeds need to be placed first so that BYEs
|
|
25249
25236
|
// can follow the seedValues of placed seeds
|
|
25250
25237
|
if (drawType !== LUCKY_DRAW) {
|
|
25251
|
-
var profileSeeding = structure.seedingProfile
|
|
25252
|
-
? { positioning: structure.seedingProfile }
|
|
25253
|
-
: seedingProfile;
|
|
25238
|
+
var profileSeeding = structure.seedingProfile ? { positioning: structure.seedingProfile } : seedingProfile;
|
|
25254
25239
|
var result_2 = positionSeedBlocks({
|
|
25255
25240
|
seedingProfile: profileSeeding,
|
|
25256
25241
|
provisionalPositioning: provisionalPositioning,
|
|
@@ -25557,11 +25542,10 @@ function getSourceRounds(_a) {
|
|
|
25557
25542
|
structureId: structureId,
|
|
25558
25543
|
});
|
|
25559
25544
|
// reduce the sourceRoundsMap to roundNumbers, not including excludedRoundNumbers
|
|
25560
|
-
var
|
|
25545
|
+
var keys = Object.values(playoffPositionSourceRoundsMap);
|
|
25546
|
+
var relevantPlayoffSourceRounds = keys
|
|
25561
25547
|
.reduce(function (rounds, round) {
|
|
25562
|
-
return rounds.includes(round.roundNumber)
|
|
25563
|
-
? rounds
|
|
25564
|
-
: rounds.concat(round.roundNumber);
|
|
25548
|
+
return rounds.includes(round.roundNumber) ? rounds : rounds.concat(round.roundNumber);
|
|
25565
25549
|
}, [])
|
|
25566
25550
|
.map(function (roundNumber) { return ensureInt(roundNumber); })
|
|
25567
25551
|
.filter(function (roundNumber) { return !excludeRoundNumbers.includes(roundNumber); });
|
|
@@ -25572,12 +25556,11 @@ function getSourceRounds(_a) {
|
|
|
25572
25556
|
structureId: structureId,
|
|
25573
25557
|
});
|
|
25574
25558
|
// determine which rounds produced played off positions
|
|
25559
|
+
var roundsMapValues = playedOffRoundsMap ? Object.values(playedOffRoundsMap) : [];
|
|
25575
25560
|
var playedOffSourceRounds = playedOffRoundsMap
|
|
25576
|
-
?
|
|
25561
|
+
? roundsMapValues
|
|
25577
25562
|
.reduce(function (rounds, round) {
|
|
25578
|
-
return rounds.includes(round.roundNumber)
|
|
25579
|
-
? rounds
|
|
25580
|
-
: rounds.concat(round.roundNumber);
|
|
25563
|
+
return rounds.includes(round.roundNumber) ? rounds : rounds.concat(round.roundNumber);
|
|
25581
25564
|
}, [])
|
|
25582
25565
|
.map(function (round) { return ensureInt(round); })
|
|
25583
25566
|
: [];
|
|
@@ -36973,7 +36956,7 @@ function assignSeedPositions(params) {
|
|
|
36973
36956
|
|
|
36974
36957
|
function addParticipants(_a) {
|
|
36975
36958
|
var e_1, _b;
|
|
36976
|
-
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, returnParticipants = _a.returnParticipants,
|
|
36959
|
+
var allowDuplicateParticipantIdPairs = _a.allowDuplicateParticipantIdPairs, returnParticipants = _a.returnParticipants, tournamentRecord = _a.tournamentRecord, _c = _a.participants, participants = _c === void 0 ? [] : _c;
|
|
36977
36960
|
if (!tournamentRecord)
|
|
36978
36961
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
36979
36962
|
if (!tournamentRecord.participants)
|
|
@@ -36985,9 +36968,7 @@ function addParticipants(_a) {
|
|
|
36985
36968
|
participant.participantId = UUID();
|
|
36986
36969
|
});
|
|
36987
36970
|
var newParticipants = participants.filter(function (participant) { return !existingParticipantIds.includes(participant.participantId); });
|
|
36988
|
-
var notAdded = participants.filter(function (participant) {
|
|
36989
|
-
return existingParticipantIds.includes(participant.participantId);
|
|
36990
|
-
});
|
|
36971
|
+
var notAdded = participants.filter(function (participant) { return existingParticipantIds.includes(participant.participantId); });
|
|
36991
36972
|
var individualParticipants = newParticipants.filter(function (participant) { return participant.participantType === INDIVIDUAL; });
|
|
36992
36973
|
var groupedParticipants = newParticipants.filter(function (participant) { return participant.participantType !== INDIVIDUAL; });
|
|
36993
36974
|
// add individual participants first so that grouped participants which include them are valid
|
|
@@ -40634,7 +40615,7 @@ function setEventStartDate(_a) {
|
|
|
40634
40615
|
newEventStartDate > tournamentEndDate)
|
|
40635
40616
|
return { error: INVALID_DATE };
|
|
40636
40617
|
// use extractDate() to ensure that only the YYYY-MM-DD part of date is used for comparison
|
|
40637
|
-
var eventEndDate = event.endDate && new Date(extractDate(event.endDate));
|
|
40618
|
+
var eventEndDate = event.endDate && new Date(extractDate(event.endDate)).getTime();
|
|
40638
40619
|
if (eventEndDate && newEventStartDate > eventEndDate) {
|
|
40639
40620
|
// if the new startDate is after an existing endDate set the endDate to the startDate
|
|
40640
40621
|
event.endDate = startDate;
|
|
@@ -40662,7 +40643,7 @@ function setEventEndDate(_a) {
|
|
|
40662
40643
|
newEventEndDate > tournamentEndDate)
|
|
40663
40644
|
return { error: INVALID_DATE };
|
|
40664
40645
|
// use extractDate() to ensure that only the YYYY-MM-DD part of date is used for comparison
|
|
40665
|
-
var eventStartDate = event.startDate && new Date(extractDate(event.startDate));
|
|
40646
|
+
var eventStartDate = event.startDate && new Date(extractDate(event.startDate)).getTime();
|
|
40666
40647
|
if (eventStartDate && newEventEndDate < eventStartDate) {
|
|
40667
40648
|
// if the new endDate is before an existing startDate set the startDate to the endDate
|
|
40668
40649
|
event.startDate = endDate;
|
|
@@ -40683,8 +40664,8 @@ function setEventDates(_a) {
|
|
|
40683
40664
|
if (endDate && !dateValidation.test(endDate))
|
|
40684
40665
|
return { error: INVALID_DATE };
|
|
40685
40666
|
if (startDate && endDate) {
|
|
40686
|
-
var newStartDate = new Date(extractDate(startDate));
|
|
40687
|
-
var newEndDate = new Date(extractDate(endDate));
|
|
40667
|
+
var newStartDate = new Date(extractDate(startDate)).getTime();
|
|
40668
|
+
var newEndDate = new Date(extractDate(endDate)).getTime();
|
|
40688
40669
|
if (newStartDate > newEndDate)
|
|
40689
40670
|
return { error: INVALID_VALUES };
|
|
40690
40671
|
}
|
|
@@ -42852,8 +42833,7 @@ function generateLineUps(params) {
|
|
|
42852
42833
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
42853
42834
|
if (!tieFormat && !drawDefinition)
|
|
42854
42835
|
return { error: DRAW_DEFINITION_NOT_FOUND };
|
|
42855
|
-
tieFormat =
|
|
42856
|
-
tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
42836
|
+
tieFormat = tieFormat !== null && tieFormat !== void 0 ? tieFormat : (_c = resolveTieFormat({ drawDefinition: drawDefinition, event: event })) === null || _c === void 0 ? void 0 : _c.tieFormat;
|
|
42857
42837
|
if (validateTieFormat({ tieFormat: tieFormat }).error)
|
|
42858
42838
|
return { error: INVALID_TIE_FORMAT };
|
|
42859
42839
|
if (typeof scaleAccessor !== 'object' && !useDefaultEventRanking)
|
|
@@ -42879,8 +42859,7 @@ function generateLineUps(params) {
|
|
|
42879
42859
|
var matchUpTypeScales = (_a = individualParticipant[formattedScaleType]) === null || _a === void 0 ? void 0 : _a[matchUpType];
|
|
42880
42860
|
// if { userDefaultEventRanking: true } fallback to SINGLES if no values for DOUBLES
|
|
42881
42861
|
if (!matchUpTypeScales && useDefaultEventRanking) {
|
|
42882
|
-
matchUpTypeScales =
|
|
42883
|
-
(_b = individualParticipant[formattedScaleType]) === null || _b === void 0 ? void 0 : _b[SINGLES_MATCHUP];
|
|
42862
|
+
matchUpTypeScales = (_b = individualParticipant[formattedScaleType]) === null || _b === void 0 ? void 0 : _b[SINGLES_MATCHUP];
|
|
42884
42863
|
}
|
|
42885
42864
|
if (Array.isArray(matchUpTypeScales)) {
|
|
42886
42865
|
var scaleValue = (_c = matchUpTypeScales.find(function (scale) { return scale.scaleName === scaleName; })) === null || _c === void 0 ? void 0 : _c.scaleValue;
|
|
@@ -42920,9 +42899,7 @@ function generateLineUps(params) {
|
|
|
42920
42899
|
var _a;
|
|
42921
42900
|
var nextParticipantId = (_a = typeSort === null || typeSort === void 0 ? void 0 : typeSort.find(function (participant) {
|
|
42922
42901
|
var _a;
|
|
42923
|
-
var targetGender = gender &&
|
|
42924
|
-
(([MALE, FEMALE].includes(gender) && gender) ||
|
|
42925
|
-
(gender === MIXED && [MALE, FEMALE][i]));
|
|
42902
|
+
var targetGender = gender && (([MALE, FEMALE].includes(gender) && gender) || (gender === MIXED && [MALE, FEMALE][i]));
|
|
42926
42903
|
return ((!targetGender || targetGender === ((_a = participant.person) === null || _a === void 0 ? void 0 : _a.sex)) &&
|
|
42927
42904
|
!collectionParticipantIds.includes(participant.participantId));
|
|
42928
42905
|
})) === null || _a === void 0 ? void 0 : _a.participantId;
|
|
@@ -47490,14 +47467,10 @@ function generateParticipants(params) {
|
|
|
47490
47467
|
var doubles = participantType === PAIR || matchUpType === DOUBLES_MATCHUP;
|
|
47491
47468
|
var team = participantType === TEAM || matchUpType === TEAM;
|
|
47492
47469
|
if (rankingRange &&
|
|
47493
|
-
(!Array.isArray(rankingRange) ||
|
|
47494
|
-
!rankingRange.every(function (r) { return isNumeric(r); }) ||
|
|
47495
|
-
rankingRange.length !== 2)) {
|
|
47470
|
+
(!Array.isArray(rankingRange) || !rankingRange.every(function (r) { return isNumeric(r); }) || rankingRange.length !== 2)) {
|
|
47496
47471
|
rankingRange = undefined;
|
|
47497
47472
|
}
|
|
47498
|
-
scaledParticipantsCount = scaleAllParticipants
|
|
47499
|
-
? participantsCount
|
|
47500
|
-
: scaledParticipantsCount;
|
|
47473
|
+
scaledParticipantsCount = scaleAllParticipants ? participantsCount : scaledParticipantsCount;
|
|
47501
47474
|
var defaultRankingRange = 1000;
|
|
47502
47475
|
var rankingUpperBound = scaledParticipantsCount && scaledParticipantsCount > defaultRankingRange
|
|
47503
47476
|
? scaledParticipantsCount
|
|
@@ -47537,13 +47510,14 @@ function generateParticipants(params) {
|
|
|
47537
47510
|
var getAttributes_1 = function (attributes) {
|
|
47538
47511
|
var e_1, _a;
|
|
47539
47512
|
var generatedAttributes = {};
|
|
47513
|
+
var attributeKeys = Object.keys(attributes || {});
|
|
47540
47514
|
try {
|
|
47541
|
-
for (var
|
|
47542
|
-
var attribute =
|
|
47515
|
+
for (var attributeKeys_1 = __values(attributeKeys), attributeKeys_1_1 = attributeKeys_1.next(); !attributeKeys_1_1.done; attributeKeys_1_1 = attributeKeys_1.next()) {
|
|
47516
|
+
var attribute = attributeKeys_1_1.value;
|
|
47543
47517
|
var attributeValue = attributes[attribute];
|
|
47544
47518
|
if (typeof attributeValue === 'object' && attributeValue.generator) {
|
|
47545
47519
|
var range_1 = attributeValue.range;
|
|
47546
|
-
var
|
|
47520
|
+
var _b = __read(range_1.slice().sort(), 2), min_1 = _b[0], max_1 = _b[1];
|
|
47547
47521
|
generatedAttributes[attribute] = randomInt(min_1, max_1);
|
|
47548
47522
|
}
|
|
47549
47523
|
else {
|
|
@@ -47554,7 +47528,7 @@ function generateParticipants(params) {
|
|
|
47554
47528
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
47555
47529
|
finally {
|
|
47556
47530
|
try {
|
|
47557
|
-
if (
|
|
47531
|
+
if (attributeKeys_1_1 && !attributeKeys_1_1.done && (_a = attributeKeys_1.return)) _a.call(attributeKeys_1);
|
|
47558
47532
|
}
|
|
47559
47533
|
finally { if (e_1) throw e_1.error; }
|
|
47560
47534
|
}
|
|
@@ -47566,10 +47540,7 @@ function generateParticipants(params) {
|
|
|
47566
47540
|
var generateRatings = function () {
|
|
47567
47541
|
return generateRange(0, 2000) // overgenerate because filter and restricted range will impact final count
|
|
47568
47542
|
.map(function () { return skewedDistribution(min_2, max_2, skew_1, step_1, decimalsCount_1); })
|
|
47569
|
-
.filter(function (rating) {
|
|
47570
|
-
return (!ratingMax_1 || rating <= ratingMax_1) &&
|
|
47571
|
-
(!ratingMin_1 || rating >= ratingMin_1);
|
|
47572
|
-
})
|
|
47543
|
+
.filter(function (rating) { return (!ratingMax_1 || rating <= ratingMax_1) && (!ratingMin_1 || rating >= ratingMin_1); })
|
|
47573
47544
|
.slice(0, scaledParticipantsCount || randomInt(20, 30))
|
|
47574
47545
|
.map(function (scaleValue) {
|
|
47575
47546
|
return !accessors_1
|
|
@@ -47624,9 +47595,7 @@ function generateParticipants(params) {
|
|
|
47624
47595
|
var isoList = isoMin
|
|
47625
47596
|
? shuffleArray(countryCodes).slice(0, nationalityCodesCount)
|
|
47626
47597
|
: nationalityCodes
|
|
47627
|
-
? countryCodes.filter(function (isoCountry) {
|
|
47628
|
-
return nationalityCodes.includes(isoCountry.iso);
|
|
47629
|
-
})
|
|
47598
|
+
? countryCodes.filter(function (isoCountry) { return nationalityCodes.includes(isoCountry.iso); })
|
|
47630
47599
|
: countryCodes;
|
|
47631
47600
|
var countriesList = shuffleArray(generateRange(0, Math.ceil(individualParticipantsCount / (isoMin || 1)))
|
|
47632
47601
|
.map(function () { return isoList; })
|
|
@@ -47640,9 +47609,7 @@ function generateParticipants(params) {
|
|
|
47640
47609
|
return generateIndividualParticipant(participantIndex);
|
|
47641
47610
|
});
|
|
47642
47611
|
var individualParticipantIds = individualParticipants.map(function (participant) { return participant.participantId; });
|
|
47643
|
-
var pairName = individualParticipants
|
|
47644
|
-
.map(function (i) { return i.person.standardFamilyName; })
|
|
47645
|
-
.join('/');
|
|
47612
|
+
var pairName = individualParticipants.map(function (i) { return i.person.standardFamilyName; }).join('/');
|
|
47646
47613
|
var participantType = doubles ? PAIR : TEAM;
|
|
47647
47614
|
var groupParticipant = {
|
|
47648
47615
|
participantId: genParticipantId({
|
|
@@ -47658,8 +47625,7 @@ function generateParticipants(params) {
|
|
|
47658
47625
|
};
|
|
47659
47626
|
if (inContext)
|
|
47660
47627
|
groupParticipant.individualParticipants = individualParticipants;
|
|
47661
|
-
return doubles || team
|
|
47662
|
-
? __spreadArray([groupParticipant], __read(individualParticipants), false) : individualParticipants;
|
|
47628
|
+
return doubles || team ? __spreadArray([groupParticipant], __read(individualParticipants), false) : individualParticipants;
|
|
47663
47629
|
})
|
|
47664
47630
|
.flat();
|
|
47665
47631
|
return { participants: participants };
|
|
@@ -47671,10 +47637,7 @@ function generateParticipants(params) {
|
|
|
47671
47637
|
var participantName = "".concat(standardGivenName, " ").concat(standardFamilyName);
|
|
47672
47638
|
var country = countriesList[participantIndex];
|
|
47673
47639
|
var nationalityCode = ((personNationalityCodes === null || personNationalityCodes === void 0 ? void 0 : personNationalityCodes.length) && personNationalityCode) ||
|
|
47674
|
-
(country &&
|
|
47675
|
-
(nationalityCodeType === 'IOC'
|
|
47676
|
-
? country.ioc || country.iso
|
|
47677
|
-
: country.iso || country.ioc)) ||
|
|
47640
|
+
(country && (nationalityCodeType === 'IOC' ? country.ioc || country.iso : country.iso || country.ioc)) ||
|
|
47678
47641
|
personNationalityCode;
|
|
47679
47642
|
if ((countriesList === null || countriesList === void 0 ? void 0 : countriesList.length) && !nationalityCode && !personNationalityCode) {
|
|
47680
47643
|
console.log('%c Invalid Nationality Code', { participantIndex: participantIndex, country: country });
|
|
@@ -47694,9 +47657,7 @@ function generateParticipants(params) {
|
|
|
47694
47657
|
participantName: participantName,
|
|
47695
47658
|
person: {
|
|
47696
47659
|
addresses: [address],
|
|
47697
|
-
personId: personId ||
|
|
47698
|
-
((personIds === null || personIds === void 0 ? void 0 : personIds.length) && personIds[participantIndex]) ||
|
|
47699
|
-
UUID(),
|
|
47660
|
+
personId: personId || ((personIds === null || personIds === void 0 ? void 0 : personIds.length) && personIds[participantIndex]) || UUID(),
|
|
47700
47661
|
standardFamilyName: standardFamilyName,
|
|
47701
47662
|
standardGivenName: standardGivenName,
|
|
47702
47663
|
nationalityCode: nationalityCode,
|
|
@@ -47775,10 +47736,7 @@ function addScaleItem(_a) {
|
|
|
47775
47736
|
}
|
|
47776
47737
|
function genParticipantId(_a) {
|
|
47777
47738
|
var idPrefix = _a.idPrefix, participantType = _a.participantType, index = _a.index, uuids = _a.uuids;
|
|
47778
|
-
var type = participantType === INDIVIDUAL
|
|
47779
|
-
? 'I'
|
|
47780
|
-
: 'P'
|
|
47781
|
-
;
|
|
47739
|
+
var type = participantType === INDIVIDUAL ? 'I' : 'P' ;
|
|
47782
47740
|
return idPrefix ? "".concat(idPrefix, "-").concat(type, "-").concat(index) : (uuids === null || uuids === void 0 ? void 0 : uuids.pop()) || UUID();
|
|
47783
47741
|
}
|
|
47784
47742
|
|
|
@@ -48567,9 +48525,7 @@ function setParticipantScaleItems(params) {
|
|
|
48567
48525
|
}
|
|
48568
48526
|
if (context) {
|
|
48569
48527
|
var eventId = context.eventId, drawId = context.drawId, itemValue = __rest(context, ["eventId", "drawId"]);
|
|
48570
|
-
var itemSubTypes = ((_c = itemValue.scaleAttributes) === null || _c === void 0 ? void 0 : _c.scaleType) && [
|
|
48571
|
-
itemValue.scaleAttributes.scaleType,
|
|
48572
|
-
];
|
|
48528
|
+
var itemSubTypes = ((_c = itemValue.scaleAttributes) === null || _c === void 0 ? void 0 : _c.scaleType) && [itemValue.scaleAttributes.scaleType];
|
|
48573
48529
|
if (Object.keys(itemValue).length) {
|
|
48574
48530
|
var timeItem = {
|
|
48575
48531
|
itemType: ADD_SCALE_ITEMS,
|
|
@@ -48604,7 +48560,8 @@ function isValidScaleItem(_a) {
|
|
|
48604
48560
|
var scaleItem = _a.scaleItem;
|
|
48605
48561
|
var scaleItemAttributes = scaleItem && Object.keys(scaleItem);
|
|
48606
48562
|
var requiredAttributes = ['scaleType', 'eventType', 'scaleName'];
|
|
48607
|
-
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes === null || scaleItemAttributes === void 0 ? void 0 : scaleItemAttributes.includes(attribute); }).length ===
|
|
48563
|
+
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes === null || scaleItemAttributes === void 0 ? void 0 : scaleItemAttributes.includes(attribute); }).length ===
|
|
48564
|
+
requiredAttributes.length;
|
|
48608
48565
|
return !!validScaleItem;
|
|
48609
48566
|
}
|
|
48610
48567
|
function addParticipantScaleItem(_a) {
|
|
@@ -48614,9 +48571,8 @@ function addParticipantScaleItem(_a) {
|
|
|
48614
48571
|
}
|
|
48615
48572
|
var scaleItemAttributes = scaleItem && Object.keys(scaleItem);
|
|
48616
48573
|
var requiredAttributes = ['scaleType', 'eventType', 'scaleName'];
|
|
48617
|
-
var validScaleItem = requiredAttributes.filter(function (attribute) {
|
|
48618
|
-
|
|
48619
|
-
}).length === requiredAttributes.length;
|
|
48574
|
+
var validScaleItem = requiredAttributes.filter(function (attribute) { return scaleItemAttributes.includes(attribute) && scaleItem[attribute]; }).length ===
|
|
48575
|
+
requiredAttributes.length;
|
|
48620
48576
|
if (!validScaleItem)
|
|
48621
48577
|
return { error: INVALID_SCALE_ITEM };
|
|
48622
48578
|
var createdAt = new Date().toISOString();
|
|
@@ -48627,10 +48583,8 @@ function addParticipantScaleItem(_a) {
|
|
|
48627
48583
|
participant: participant,
|
|
48628
48584
|
}).scaleItem;
|
|
48629
48585
|
var isUndefined = function (value) { return [undefined, null, ''].includes(value); };
|
|
48630
|
-
var valueChanged = !(isUndefined(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) &&
|
|
48631
|
-
|
|
48632
|
-
JSON.stringify(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) !==
|
|
48633
|
-
JSON.stringify(scaleItem.scaleValue);
|
|
48586
|
+
var valueChanged = !(isUndefined(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) && isUndefined(scaleItem.scaleValue)) &&
|
|
48587
|
+
JSON.stringify(existingScaleItem === null || existingScaleItem === void 0 ? void 0 : existingScaleItem.scaleValue) !== JSON.stringify(scaleItem.scaleValue);
|
|
48634
48588
|
if (valueChanged) {
|
|
48635
48589
|
var scaleType = scaleItem.scaleType, eventType = scaleItem.eventType, scaleName = scaleItem.scaleName;
|
|
48636
48590
|
var itemType_1 = [SCALE$1, scaleType, eventType, scaleName].join('.');
|
|
@@ -49023,17 +48977,10 @@ function analyzeMatchUp(params) {
|
|
|
49023
48977
|
var sideIndex = isValidSideNumber ? sideNumber - 1 : 0;
|
|
49024
48978
|
var existingValue = setObject &&
|
|
49025
48979
|
isValidSideNumber &&
|
|
49026
|
-
((!isTiebreakValue &&
|
|
49027
|
-
|
|
49028
|
-
sideGameScores[sideIndex] !== undefined &&
|
|
49029
|
-
sideGameScores[sideIndex]) ||
|
|
49030
|
-
(isTiebreakValue &&
|
|
49031
|
-
sideTiebreakScores[sideIndex] !== undefined &&
|
|
49032
|
-
sideTiebreakScores[sideIndex]));
|
|
48980
|
+
((!isTiebreakValue && !isPointValue && sideGameScores[sideIndex] !== undefined && sideGameScores[sideIndex]) ||
|
|
48981
|
+
(isTiebreakValue && sideTiebreakScores[sideIndex] !== undefined && sideTiebreakScores[sideIndex]));
|
|
49033
48982
|
var hasExistingValue = !!existingValue;
|
|
49034
|
-
var completedSetsHaveValidOutcomes = completedSets === null || completedSets === void 0 ? void 0 : completedSets.map(function (setObject) {
|
|
49035
|
-
return analyzeSet({ setObject: setObject, matchUpScoringFormat: matchUpScoringFormat }).isValidSetOutcome;
|
|
49036
|
-
}).reduce(function (valid, validOutcome) { return valid && validOutcome; }, true);
|
|
48983
|
+
var completedSetsHaveValidOutcomes = completedSets === null || completedSets === void 0 ? void 0 : completedSets.map(function (setObject) { return analyzeSet({ setObject: setObject, matchUpScoringFormat: matchUpScoringFormat }).isValidSetOutcome; }).reduce(function (valid, validOutcome) { return valid && validOutcome; }, true);
|
|
49037
48984
|
var setsWinCounts = completedSets.reduce(function (counts, set) {
|
|
49038
48985
|
var winningSide = set.winningSide;
|
|
49039
48986
|
var winningSideIndex = winningSide - 1;
|
|
@@ -49047,17 +48994,11 @@ function analyzeMatchUp(params) {
|
|
|
49047
48994
|
var losingSideSetsCount = setsWinCounts[matchUpLosingSideIndex];
|
|
49048
48995
|
var maxSetsCount = Math.max.apply(Math, __spreadArray([], __read(setsWinCounts), false));
|
|
49049
48996
|
var maxSetsInstances = instanceCount(setsWinCounts)[maxSetsCount];
|
|
49050
|
-
var bestOf = (matchUpScoringFormat
|
|
48997
|
+
var bestOf = (matchUpScoringFormat !== null && matchUpScoringFormat !== void 0 ? matchUpScoringFormat : {}).bestOf;
|
|
49051
48998
|
var setsToWin = (bestOf && Math.ceil(bestOf / 2)) || 1;
|
|
49052
|
-
var calculatedWinningSide = (maxSetsCount === setsToWin &&
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
undefined;
|
|
49056
|
-
var validMatchUpWinningSide = winningSideSetsCount > losingSideSetsCount &&
|
|
49057
|
-
matchUpWinningSide === calculatedWinningSide;
|
|
49058
|
-
var validMatchUpOutcome = calculatedWinningSide &&
|
|
49059
|
-
completedSetsHaveValidOutcomes &&
|
|
49060
|
-
validMatchUpWinningSide;
|
|
48999
|
+
var calculatedWinningSide = (maxSetsCount === setsToWin && maxSetsInstances === 1 && setsWinCounts.indexOf(maxSetsCount) + 1) || undefined;
|
|
49000
|
+
var validMatchUpWinningSide = winningSideSetsCount > losingSideSetsCount && matchUpWinningSide === calculatedWinningSide;
|
|
49001
|
+
var validMatchUpOutcome = calculatedWinningSide && completedSetsHaveValidOutcomes && validMatchUpWinningSide;
|
|
49061
49002
|
return __assign({ completedSetsHaveValidOutcomes: completedSetsHaveValidOutcomes, validMatchUpWinningSide: validMatchUpWinningSide, calculatedWinningSide: calculatedWinningSide, matchUpScoringFormat: matchUpScoringFormat, validMatchUpOutcome: validMatchUpOutcome, isLastSetWithValues: isLastSetWithValues, completedSetsCount: completedSetsCount, isCompletedMatchUp: isCompletedMatchUp, isValidSideNumber: isValidSideNumber, hasExistingValue: hasExistingValue, existingValue: existingValue, isExistingSet: isExistingSet, isActiveSet: isActiveSet }, specifiedSetAnalysis);
|
|
49062
49003
|
}
|
|
49063
49004
|
|
|
@@ -49343,12 +49284,8 @@ function completeDrawMatchUps(params) {
|
|
|
49343
49284
|
randomWinningSide = params.randomWinningSide, tournamentRecord = params.tournamentRecord, completionGoal = params.completionGoal, drawDefinition = params.drawDefinition, event = params.event;
|
|
49344
49285
|
if (!drawDefinition)
|
|
49345
49286
|
return { error: MISSING_DRAW_DEFINITION };
|
|
49346
|
-
var matchUpFormat = params.matchUpFormat ||
|
|
49347
|
-
|
|
49348
|
-
(event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
49349
|
-
var sortedStructures = drawDefinition.structures
|
|
49350
|
-
.slice()
|
|
49351
|
-
.sort(structureSort);
|
|
49287
|
+
var matchUpFormat = params.matchUpFormat || drawDefinition.matchUpFormat || (event === null || event === void 0 ? void 0 : event.matchUpFormat);
|
|
49288
|
+
var sortedStructures = drawDefinition.structures.slice().sort(structureSort);
|
|
49352
49289
|
var completedCount = 0;
|
|
49353
49290
|
var _f = getAllDrawMatchUps({
|
|
49354
49291
|
contextFilters: {
|
|
@@ -65688,10 +65625,6 @@ var governors = {
|
|
|
65688
65625
|
venueGovernor: venueGovernor,
|
|
65689
65626
|
};
|
|
65690
65627
|
|
|
65691
|
-
var factoryTypes = {
|
|
65692
|
-
__proto__: null
|
|
65693
|
-
};
|
|
65694
|
-
|
|
65695
65628
|
var forge = {};
|
|
65696
65629
|
|
|
65697
65630
|
var _a$8;
|
|
@@ -65947,9 +65880,9 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
65947
65880
|
var tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(tournamentId);
|
|
65948
65881
|
var tournamentRecords = (params === null || params === void 0 ? void 0 : params.sandboxTournament)
|
|
65949
65882
|
? (_a = {}, _a[params === null || params === void 0 ? void 0 : params.sandboxTournament.tournamentId] = params.sandboxTournament, _a) : getTournamentRecords();
|
|
65950
|
-
|
|
65951
|
-
|
|
65952
|
-
|
|
65883
|
+
// ENSURE that logged params are not mutated by middleware
|
|
65884
|
+
var paramsToLog = params ? makeDeepCopy(params, undefined, true) : undefined;
|
|
65885
|
+
var augmentedParams = params ? paramsMiddleware(tournamentRecords, params) : undefined;
|
|
65953
65886
|
if (augmentedParams === null || augmentedParams === void 0 ? void 0 : augmentedParams.error)
|
|
65954
65887
|
return augmentedParams;
|
|
65955
65888
|
var result = invoke({
|
|
@@ -65960,7 +65893,7 @@ function executeFunction(engine, method, params, methodName, engineType) {
|
|
|
65960
65893
|
method: method,
|
|
65961
65894
|
});
|
|
65962
65895
|
var elapsed = Date.now() - start;
|
|
65963
|
-
engineLogging({ result: result, methodName: methodName, elapsed: elapsed, params:
|
|
65896
|
+
engineLogging({ result: result, methodName: methodName, elapsed: elapsed, params: paramsToLog, engineType: engineType });
|
|
65964
65897
|
return result;
|
|
65965
65898
|
}
|
|
65966
65899
|
function invoke(_a) {
|
|
@@ -66583,7 +66516,11 @@ var mocksEngine = (function () {
|
|
|
66583
66516
|
Object.keys(governor).forEach(function (method) {
|
|
66584
66517
|
engine[method] = function (params) {
|
|
66585
66518
|
try {
|
|
66586
|
-
|
|
66519
|
+
var invocationResult = engineInvoke(governor[method], params);
|
|
66520
|
+
if (!(invocationResult === null || invocationResult === void 0 ? void 0 : invocationResult.error) && (params === null || params === void 0 ? void 0 : params.setState) && (invocationResult === null || invocationResult === void 0 ? void 0 : invocationResult.tournamentRecord)) {
|
|
66521
|
+
setState$1(invocationResult.tournamentRecord);
|
|
66522
|
+
}
|
|
66523
|
+
return invocationResult;
|
|
66587
66524
|
}
|
|
66588
66525
|
catch (err) {
|
|
66589
66526
|
var error = void 0;
|
|
@@ -67689,7 +67626,6 @@ exports.entryStatusConstants = entryStatusConstants;
|
|
|
67689
67626
|
exports.errorConditionConstants = errorConditionConstants;
|
|
67690
67627
|
exports.eventConstants = eventConstants;
|
|
67691
67628
|
exports.factoryConstants = factoryConstants;
|
|
67692
|
-
exports.factoryTypes = factoryTypes;
|
|
67693
67629
|
exports.fixtures = fixtures;
|
|
67694
67630
|
exports.flightConstants = flightConstants;
|
|
67695
67631
|
exports.forge = forge;
|