tods-competition-factory 2.2.11 → 2.2.13
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/index.mjs +6 -6
- package/dist/tods-competition-factory.d.ts +4 -24
- package/dist/tods-competition-factory.development.cjs.js +66 -65
- 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 +42 -42
|
@@ -183,18 +183,8 @@ interface TimeItem {
|
|
|
183
183
|
itemType?: string;
|
|
184
184
|
itemValue?: any;
|
|
185
185
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
BOTH = "BOTH",
|
|
189
|
-
LEVEL = "LEVEL"
|
|
190
|
-
}
|
|
191
|
-
type CategoryUnion = keyof typeof CategoryEnum;
|
|
192
|
-
declare enum DisciplineEnum {
|
|
193
|
-
BEACH_TENNIS = "BEACH_TENNIS",
|
|
194
|
-
TENNIS = "TENNIS",
|
|
195
|
-
WHEELCHAIR_TENNIS = "WHEELCHAIR_TENNIS"
|
|
196
|
-
}
|
|
197
|
-
type DisciplineUnion = keyof typeof DisciplineEnum;
|
|
186
|
+
type DisciplineUnion = 'BEACH_TENNIS' | 'TENNIS' | 'WHEELCHAIR_TENNIS';
|
|
187
|
+
type CategoryUnion = 'AGE' | 'BOTH' | 'LEVEL';
|
|
198
188
|
interface DrawDefinition {
|
|
199
189
|
activeDates?: Date[] | string[];
|
|
200
190
|
automated?: boolean;
|
|
@@ -222,12 +212,7 @@ interface DrawDefinition {
|
|
|
222
212
|
timeItems?: TimeItem[];
|
|
223
213
|
updatedAt?: Date | string;
|
|
224
214
|
}
|
|
225
|
-
|
|
226
|
-
COMPLETE = "COMPLETE",
|
|
227
|
-
IN_PROGRESS = "IN_PROGRESS",
|
|
228
|
-
TO_BE_PLAYED = "TO_BE_PLAYED"
|
|
229
|
-
}
|
|
230
|
-
type DrawStatusUnion = keyof typeof DrawStatusEnum;
|
|
215
|
+
type DrawStatusUnion = 'COMPLETE' | 'IN_PROGRESS' | 'TO_BE_PLAYED';
|
|
231
216
|
interface Entry {
|
|
232
217
|
createdAt?: Date | string;
|
|
233
218
|
entryId?: string;
|
|
@@ -372,12 +357,7 @@ interface MatchUpFinishingPositionRange {
|
|
|
372
357
|
loser: number[];
|
|
373
358
|
winner: number[];
|
|
374
359
|
}
|
|
375
|
-
|
|
376
|
-
INDOOR = "INDOOR",
|
|
377
|
-
MIXED = "MIXED",
|
|
378
|
-
OUTDOOR = "OUTDOOR"
|
|
379
|
-
}
|
|
380
|
-
type IndoorOutdoorUnion = keyof typeof IndoorOutdoorEnum;
|
|
360
|
+
type IndoorOutdoorUnion = 'INDOOR' | 'MIXED' | 'OUTDOOR';
|
|
381
361
|
declare enum MatchUpStatusEnum {
|
|
382
362
|
ABANDONED = "ABANDONED",
|
|
383
363
|
AWAITING_RESULT = "AWAITING_RESULT",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.2.
|
|
6
|
+
return '2.2.13';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
const SINGLES_MATCHUP = 'SINGLES';
|
|
@@ -2143,11 +2143,11 @@ function isValidMatchUpFormat({ matchUpFormat }) {
|
|
|
2143
2143
|
if (!isString(matchUpFormat) || matchUpFormat === '')
|
|
2144
2144
|
return false;
|
|
2145
2145
|
const parsedFormat = parse(matchUpFormat);
|
|
2146
|
-
const setParts = matchUpFormat.match(/-S:([1-9])+\/TB(
|
|
2146
|
+
const setParts = matchUpFormat.match(/-S:([1-9])+\/TB(\d{1,2})@?([1-9]?)*/);
|
|
2147
2147
|
const setsTo = setParts?.[1];
|
|
2148
2148
|
const tiebreakTo = setParts?.[2];
|
|
2149
2149
|
const tiebreakAt = setParts?.[3];
|
|
2150
|
-
const finalSetParts = matchUpFormat.match(/-F:([1-9])+\/TB(
|
|
2150
|
+
const finalSetParts = matchUpFormat.match(/-F:([1-9])+\/TB(\d{1,2})@?([1-9]?)*/);
|
|
2151
2151
|
const finalSetTo = finalSetParts?.[1];
|
|
2152
2152
|
const finalSetTiebreakTo = finalSetParts?.[2];
|
|
2153
2153
|
const finalTiebreakAt = finalSetParts?.[3];
|
|
@@ -2478,8 +2478,10 @@ function getCategoryAgeDetails(params) {
|
|
|
2478
2478
|
let { ageCategoryCode, ageMaxDate, ageMinDate, ageMax, ageMin } = category;
|
|
2479
2479
|
const categoryName = category.categoryName;
|
|
2480
2480
|
let combinedAge;
|
|
2481
|
-
|
|
2482
|
-
|
|
2481
|
+
const isValidCategory = typeMatch([ageCategoryCode, ageMaxDate, ageMinDate, categoryName], 'string') &&
|
|
2482
|
+
allNumeric([ageMax, ageMin]) &&
|
|
2483
|
+
[ageMaxDate, ageMinDate].filter(Boolean).every(isValidDateString);
|
|
2484
|
+
if (!isValidCategory)
|
|
2483
2485
|
return { error: INVALID_CATEGORY };
|
|
2484
2486
|
const consideredDate = params.consideredDate ?? extractDate(new Date().toLocaleDateString('sv'));
|
|
2485
2487
|
if (!isValidDateString(consideredDate))
|
|
@@ -5703,7 +5705,7 @@ function addPositionActionTelemetry(params) {
|
|
|
5703
5705
|
name: POSITION_ACTIONS,
|
|
5704
5706
|
element: drawDefinition,
|
|
5705
5707
|
});
|
|
5706
|
-
const existingValue = Array.isArray(extension?.value) ? extension?.value ?? [] : [];
|
|
5708
|
+
const existingValue = Array.isArray(extension?.value) ? (extension?.value ?? []) : [];
|
|
5707
5709
|
if (!existingValue?.length) {
|
|
5708
5710
|
const mainStructure = drawDefinition.structures.find((structure) => structure.stage === MAIN);
|
|
5709
5711
|
if (mainStructure) {
|
|
@@ -7785,7 +7787,8 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
|
|
|
7785
7787
|
const participantMap = {};
|
|
7786
7788
|
for (const participant of tournamentRecord.participants ?? []) {
|
|
7787
7789
|
const participantId = participant?.participantId;
|
|
7788
|
-
|
|
7790
|
+
if (participantId)
|
|
7791
|
+
initializeParticipantId({ participantMap, participantId });
|
|
7789
7792
|
}
|
|
7790
7793
|
for (const participant of tournamentRecord.participants ?? []) {
|
|
7791
7794
|
const participantCopy = makeDeepCopy(participant, convertExtensions, internalUse);
|
|
@@ -8955,7 +8958,7 @@ function getRoundContextProfile({ roundNamingPolicy, drawDefinition, structure,
|
|
|
8955
8958
|
.filter((structure) => structure.stage === QUALIFYING)
|
|
8956
8959
|
.map(({ stageSequence }) => stageSequence ?? 1), 0)
|
|
8957
8960
|
: 0;
|
|
8958
|
-
const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? structure.stageSequence ?? 1 : '';
|
|
8961
|
+
const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? (structure.stageSequence ?? 1) : '';
|
|
8959
8962
|
const preQualifyingAffix = preQualifyingSequence
|
|
8960
8963
|
? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || ''
|
|
8961
8964
|
: '';
|
|
@@ -10200,7 +10203,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10200
10203
|
collectionDefinitions?.find((definition) => definition.collectionId === matchUp.collectionId);
|
|
10201
10204
|
const matchUpFormat = matchUp.collectionId
|
|
10202
10205
|
? collectionDefinition?.matchUpFormat
|
|
10203
|
-
: matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
|
|
10206
|
+
: (matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat);
|
|
10204
10207
|
const matchUpType = matchUp.matchUpType ||
|
|
10205
10208
|
collectionDefinition?.matchUpType ||
|
|
10206
10209
|
structure?.matchUpType ||
|
|
@@ -10249,7 +10252,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
|
|
|
10249
10252
|
...(context?.category || {}),
|
|
10250
10253
|
...collectionDefinition.category,
|
|
10251
10254
|
}
|
|
10252
|
-
: context?.category ?? event?.category;
|
|
10255
|
+
: (context?.category ?? event?.category);
|
|
10253
10256
|
const processCodes = (matchUp.processCodes?.length && matchUp.processCodes) ||
|
|
10254
10257
|
(collectionDefinition?.processCodes?.length && collectionDefinition?.processCodes) ||
|
|
10255
10258
|
(structure?.processCodes?.length && structure?.processCodes) ||
|
|
@@ -11871,7 +11874,7 @@ function addFinishingRounds({ finishingPositionOffset = 0, finishingPositionLimi
|
|
|
11871
11874
|
};
|
|
11872
11875
|
const upcomingMatchUps = roundMatchUpsCountArray?.slice(roundNumber - 1).reduce((a, b) => a + (b || 0), 0);
|
|
11873
11876
|
const fmlcException = fmlc && roundNumber !== 1;
|
|
11874
|
-
const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? positionsFed ?? 0 : 0);
|
|
11877
|
+
const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? (positionsFed ?? 0) : 0);
|
|
11875
11878
|
const finalPosition = 1;
|
|
11876
11879
|
const positionRange = generateRange(rangeOffset, lucky ? rangeOffset + matchUpsCount * 2 : upcomingMatchUps + rangeOffset + finalPosition);
|
|
11877
11880
|
const slicer = upcomingMatchUps + finalPosition - matchUpsCount;
|
|
@@ -12153,7 +12156,7 @@ function getStructureDrawPositionProfiles(params) {
|
|
|
12153
12156
|
const result = findStructure({ drawDefinition, structureId });
|
|
12154
12157
|
if (result.error)
|
|
12155
12158
|
return result;
|
|
12156
|
-
structure = findContainer ? result.containingStructure ?? result.structure : result.structure;
|
|
12159
|
+
structure = findContainer ? (result.containingStructure ?? result.structure) : result.structure;
|
|
12157
12160
|
}
|
|
12158
12161
|
if (isAdHoc({ structure })) {
|
|
12159
12162
|
return { structure, isAdHoc: true, error: INVALID_DRAW_POSITION };
|
|
@@ -13524,7 +13527,7 @@ function getPubStatus({ event }) {
|
|
|
13524
13527
|
const drawDetailPublishedIds = drawDetails &&
|
|
13525
13528
|
Object.keys(drawDetails).length &&
|
|
13526
13529
|
Object.keys(drawDetails).filter((drawId) => getDrawPublishStatus({ drawDetails, drawId }));
|
|
13527
|
-
const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : eventPubStatus.drawIds ?? [];
|
|
13530
|
+
const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : (eventPubStatus.drawIds ?? []);
|
|
13528
13531
|
if (publishedDrawIds?.length && !drawDetailPublishedIds?.length) {
|
|
13529
13532
|
for (const drawId of publishedDrawIds) {
|
|
13530
13533
|
drawDetails[drawId] = {
|
|
@@ -13738,7 +13741,8 @@ function processSides(params) {
|
|
|
13738
13741
|
individualParticipantIds.forEach((participantId, i) => {
|
|
13739
13742
|
const partnerParticipantId = individualParticipantIds[1 - i];
|
|
13740
13743
|
const participant = participantMap[participantId];
|
|
13741
|
-
|
|
13744
|
+
if (participant)
|
|
13745
|
+
addPartner({ participant, partnerParticipantId });
|
|
13742
13746
|
});
|
|
13743
13747
|
if (withEvents && matchUpSides) {
|
|
13744
13748
|
const teamParticipantId = matchUpSides.find((s) => s.sideNumber === sideNumber)?.participant?.participantId;
|
|
@@ -16341,7 +16345,7 @@ function getNextSeedBlock(params) {
|
|
|
16341
16345
|
const seedsWithoutDrawPositions = seedAssignments?.filter((assignment) => !assignment.participantId);
|
|
16342
16346
|
const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0
|
|
16343
16347
|
? unplacedSeedAssignments.length
|
|
16344
|
-
: seedsWithoutDrawPositions?.length ?? 0;
|
|
16348
|
+
: (seedsWithoutDrawPositions?.length ?? 0);
|
|
16345
16349
|
const unfilled = (seedsLeftToAssign &&
|
|
16346
16350
|
nextSeedBlock?.drawPositions.filter((drawPosition) => !assignedDrawPositions?.includes(drawPosition))) ||
|
|
16347
16351
|
[];
|
|
@@ -21948,7 +21952,7 @@ function getParticipantResults({ participantIds, pressureRating, matchUpFormat,
|
|
|
21948
21952
|
? tieMatchUps
|
|
21949
21953
|
.filter(({ matchUpStatus }) => !excludeMatchUpStatuses.includes(matchUpStatus))
|
|
21950
21954
|
.flatMap(({ score }) => score?.sets?.length ?? 0)
|
|
21951
|
-
: score?.sets?.length ?? 0);
|
|
21955
|
+
: (score?.sets?.length ?? 0));
|
|
21952
21956
|
const totalSets = allSets?.reduce((a, b) => a + b, 0);
|
|
21953
21957
|
for (const matchUp of filteredMatchUps ?? []) {
|
|
21954
21958
|
const { matchUpStatus, tieMatchUps, tieFormat, score, winningSide, sides } = matchUp;
|
|
@@ -22286,7 +22290,7 @@ function getTallyReport({ matchUps, order, report }) {
|
|
|
22286
22290
|
const floatSort = (a, b) => parseFloat(step.reversed ? a : b) - parseFloat(step.reversed ? b : a);
|
|
22287
22291
|
const participantsCount = step.groups
|
|
22288
22292
|
? Object.values(step.groups).flat(Infinity).length
|
|
22289
|
-
: step.participantIds?.length ?? 0;
|
|
22293
|
+
: (step.participantIds?.length ?? 0);
|
|
22290
22294
|
const getExplanation = (step) => {
|
|
22291
22295
|
step.groups &&
|
|
22292
22296
|
Object.keys(step.groups)
|
|
@@ -22897,11 +22901,11 @@ function modifyMatchUpScore(params) {
|
|
|
22897
22901
|
const updateTally = (structure) => {
|
|
22898
22902
|
matchUpFormat = isDualMatchUp
|
|
22899
22903
|
? 'SET1-S:T100'
|
|
22900
|
-
: matchUpFormat ??
|
|
22904
|
+
: (matchUpFormat ??
|
|
22901
22905
|
matchUp.matchUpFormat ??
|
|
22902
22906
|
structure?.matchUpFormat ??
|
|
22903
22907
|
drawDefinition?.matchUpFormat ??
|
|
22904
|
-
event?.matchUpFormat;
|
|
22908
|
+
event?.matchUpFormat);
|
|
22905
22909
|
const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : undefined;
|
|
22906
22910
|
const { matchUps } = getAllStructureMatchUps({
|
|
22907
22911
|
afterRecoveryTimes: false,
|
|
@@ -25095,20 +25099,20 @@ function getEligibleVoluntaryConsolationParticipants({ excludedMatchUpStatuses =
|
|
|
25095
25099
|
const eventMatchUpFilters = event?.eventType ? { matchUpTypes: [event.eventType] } : undefined;
|
|
25096
25100
|
const drawMatchUpFilters = drawDefinition?.matchUpType ? { matchUpTypes: [drawDefinition.matchUpType] } : undefined;
|
|
25097
25101
|
const matchUps = includeEventParticipants && event
|
|
25098
|
-
? allEventMatchUps({
|
|
25102
|
+
? (allEventMatchUps({
|
|
25099
25103
|
contextFilters: { stages },
|
|
25100
25104
|
matchUpFilters: eventMatchUpFilters,
|
|
25101
25105
|
tournamentRecord,
|
|
25102
25106
|
inContext: true,
|
|
25103
25107
|
event,
|
|
25104
|
-
})?.matchUps ?? []
|
|
25105
|
-
: allDrawMatchUps({
|
|
25108
|
+
})?.matchUps ?? [])
|
|
25109
|
+
: (allDrawMatchUps({
|
|
25106
25110
|
contextFilters: { stages },
|
|
25107
25111
|
matchUpFilters: drawMatchUpFilters,
|
|
25108
25112
|
tournamentRecord,
|
|
25109
25113
|
inContext: true,
|
|
25110
25114
|
drawDefinition,
|
|
25111
|
-
})?.matchUps ?? [];
|
|
25115
|
+
})?.matchUps ?? []);
|
|
25112
25116
|
const voluntaryConsolationEntries = getStageEntries$2({
|
|
25113
25117
|
stage: VOLUNTARY_CONSOLATION,
|
|
25114
25118
|
drawDefinition,
|
|
@@ -30128,23 +30132,21 @@ function keyValueScore(params) {
|
|
|
30128
30132
|
else if (analysis.isGameScoreEntry) {
|
|
30129
30133
|
info = 'game scoreString entry';
|
|
30130
30134
|
}
|
|
30135
|
+
else if (analysis.lastSetIsComplete || !sets.length) {
|
|
30136
|
+
updated = true;
|
|
30137
|
+
const { scoreString: newScore, set } = keyValueSetScore({
|
|
30138
|
+
analysis,
|
|
30139
|
+
lowSide,
|
|
30140
|
+
scoreString,
|
|
30141
|
+
value: ensureInt(value),
|
|
30142
|
+
});
|
|
30143
|
+
if (set)
|
|
30144
|
+
set.setNumber = sets?.length + 1 || 1;
|
|
30145
|
+
sets = sets?.concat(set).filter(Boolean) || [set];
|
|
30146
|
+
scoreString = newScore || undefined;
|
|
30147
|
+
}
|
|
30131
30148
|
else {
|
|
30132
|
-
|
|
30133
|
-
updated = true;
|
|
30134
|
-
const { scoreString: newScore, set } = keyValueSetScore({
|
|
30135
|
-
analysis,
|
|
30136
|
-
lowSide,
|
|
30137
|
-
scoreString,
|
|
30138
|
-
value: ensureInt(value),
|
|
30139
|
-
});
|
|
30140
|
-
if (set)
|
|
30141
|
-
set.setNumber = sets?.length + 1 || 1;
|
|
30142
|
-
sets = sets?.concat(set).filter(Boolean) || [set];
|
|
30143
|
-
scoreString = newScore || undefined;
|
|
30144
|
-
}
|
|
30145
|
-
else {
|
|
30146
|
-
console.log('error: unknown outcome');
|
|
30147
|
-
}
|
|
30149
|
+
console.log('error: unknown outcome');
|
|
30148
30150
|
}
|
|
30149
30151
|
if (updated) {
|
|
30150
30152
|
sets = sets?.filter(Boolean);
|
|
@@ -30223,10 +30225,8 @@ function correctContainerMismatch(score) {
|
|
|
30223
30225
|
lastType = '';
|
|
30224
30226
|
return complement;
|
|
30225
30227
|
}
|
|
30226
|
-
else
|
|
30227
|
-
|
|
30228
|
-
lastType = '';
|
|
30229
|
-
}
|
|
30228
|
+
else if (!typeCount[lastType])
|
|
30229
|
+
lastType = '';
|
|
30230
30230
|
}
|
|
30231
30231
|
return char;
|
|
30232
30232
|
})
|
|
@@ -35493,31 +35493,32 @@ function tournamentRelevantSchedulingIds(params) {
|
|
|
35493
35493
|
tournamentIds.push(tournamentId);
|
|
35494
35494
|
tournamentMap[tournamentId] = {};
|
|
35495
35495
|
const events = tournamentRecord?.events || [];
|
|
35496
|
-
|
|
35496
|
+
for (const event of events) {
|
|
35497
35497
|
const eventId = event.eventId;
|
|
35498
35498
|
eventIds.push(eventId);
|
|
35499
35499
|
tournamentMap[tournamentId][eventId] = {};
|
|
35500
|
-
|
|
35500
|
+
const mapParsedInt = (roundNumber) => parseInt(roundNumber);
|
|
35501
|
+
for (const drawDefinition of event.drawDefinitions || []) {
|
|
35501
35502
|
const drawId = drawDefinition.drawId;
|
|
35502
35503
|
drawIds.push(drawId);
|
|
35503
35504
|
tournamentMap[tournamentId][eventId][drawId] = {};
|
|
35504
35505
|
const { structures } = getDrawStructures({ drawDefinition });
|
|
35505
|
-
(structures || [])
|
|
35506
|
+
for (const structure of structures || []) {
|
|
35506
35507
|
const structureId = structure.structureId;
|
|
35507
35508
|
const { matchUps } = getAllStructureMatchUps({ structure });
|
|
35508
35509
|
const { roundMatchUps } = getRoundMatchUps({ matchUps });
|
|
35509
|
-
const rounds = roundMatchUps && Object.keys(roundMatchUps).map(
|
|
35510
|
+
const rounds = roundMatchUps && Object.keys(roundMatchUps).map(mapParsedInt);
|
|
35510
35511
|
tournamentMap[tournamentId][eventId][drawId][structureId] = rounds;
|
|
35511
35512
|
structureIds.push(structureId);
|
|
35512
35513
|
if (structure.structures?.length) {
|
|
35513
|
-
structure.structures
|
|
35514
|
+
for (const itemStructure of structure.structures) {
|
|
35514
35515
|
structureIds.push(itemStructure.structureId);
|
|
35515
35516
|
tournamentMap[tournamentId][eventId][drawId][itemStructure.structureId] = rounds;
|
|
35516
|
-
}
|
|
35517
|
+
}
|
|
35517
35518
|
}
|
|
35518
|
-
}
|
|
35519
|
-
}
|
|
35520
|
-
}
|
|
35519
|
+
}
|
|
35520
|
+
}
|
|
35521
|
+
}
|
|
35521
35522
|
}
|
|
35522
35523
|
return {
|
|
35523
35524
|
tournamentMap,
|
|
@@ -36849,7 +36850,7 @@ function getPredictiveAccuracy(params) {
|
|
|
36849
36850
|
: 0;
|
|
36850
36851
|
const zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
|
|
36851
36852
|
? (zonePct ?? 0 / 100) * ratingsRangeDifference
|
|
36852
|
-
: params.zoneMargin ?? ratingsRangeDifference;
|
|
36853
|
+
: (params.zoneMargin ?? ratingsRangeDifference);
|
|
36853
36854
|
const contextProfile = { withScaleValues: true, withCompetitiveness: true };
|
|
36854
36855
|
const contextFilters = {
|
|
36855
36856
|
matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
|
|
@@ -38574,7 +38575,7 @@ function addParticipant(params) {
|
|
|
38574
38575
|
const { allowDuplicateParticipantIdPairs, returnParticipant, disableNotice, pairOverride, participant } = params;
|
|
38575
38576
|
const tournamentRecord = params.tournamentId
|
|
38576
38577
|
? params.tournamentRecords?.[params.tournamentId]
|
|
38577
|
-
: params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]);
|
|
38578
|
+
: (params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]));
|
|
38578
38579
|
if (!tournamentRecord)
|
|
38579
38580
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
38580
38581
|
if (!participant)
|
|
@@ -39187,7 +39188,7 @@ function generateEventsFromTieFormat(params) {
|
|
|
39187
39188
|
const entryStatus = eventType === DOUBLES_EVENT ? UNGROUPED : params.entryStatus || DIRECT_ACCEPTANCE;
|
|
39188
39189
|
const participantIds = eventGender === MIXED
|
|
39189
39190
|
? [...genderedParticipants[MALE], ...genderedParticipants[FEMALE]]
|
|
39190
|
-
: genderedParticipants[eventGender] ?? [];
|
|
39191
|
+
: (genderedParticipants[eventGender] ?? []);
|
|
39191
39192
|
if (participantIds.length) {
|
|
39192
39193
|
const result = addEventEntries({
|
|
39193
39194
|
participantIds,
|
|
@@ -40579,7 +40580,7 @@ function checkCategoryUpdates(params) {
|
|
|
40579
40580
|
const startDate = params.eventUpdates.startDate || params.event.startDate || params.tournamentRecord.startDate;
|
|
40580
40581
|
const endDate = params.eventUpdates.endDate || params.event.endDate || params.tournamentRecord.endDate;
|
|
40581
40582
|
const individualParticpants = params.enteredParticipants
|
|
40582
|
-
.map((p) => (p.participantType === INDIVIDUAL ? p : p.individualParticpants ?? []))
|
|
40583
|
+
.map((p) => (p.participantType === INDIVIDUAL ? p : (p.individualParticpants ?? [])))
|
|
40583
40584
|
.flat();
|
|
40584
40585
|
const startAgeDetails = getCategoryAgeDetails({ category, consideredDate: startDate });
|
|
40585
40586
|
const endAgeDetails = getCategoryAgeDetails({ category, consideredDate: endDate });
|
|
@@ -40634,11 +40635,11 @@ function getEnteredParticipants(params) {
|
|
|
40634
40635
|
})
|
|
40635
40636
|
.map(({ participantId }) => participantId) ?? [];
|
|
40636
40637
|
return enteredParticipantIds
|
|
40637
|
-
? getParticipants({
|
|
40638
|
+
? (getParticipants({
|
|
40638
40639
|
participantFilters: { participantIds: enteredParticipantIds },
|
|
40639
40640
|
withIndividualParticipants: true,
|
|
40640
40641
|
tournamentRecord,
|
|
40641
|
-
}).participants ?? []
|
|
40642
|
+
}).participants ?? [])
|
|
40642
40643
|
: [];
|
|
40643
40644
|
}
|
|
40644
40645
|
function getParticipantsProfile({ enteredParticipants }) {
|
|
@@ -41168,14 +41169,14 @@ function generateLineUps(params) {
|
|
|
41168
41169
|
const singlesSort = teamParticipant.individualParticipants?.sort(singlesScaleSort) ?? [];
|
|
41169
41170
|
const doublesSort = singlesOnly
|
|
41170
41171
|
? singlesSort
|
|
41171
|
-
: teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? [];
|
|
41172
|
+
: (teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? []);
|
|
41172
41173
|
const participantAssignments = {};
|
|
41173
41174
|
for (const collectionDefinition of collectionDefinitions) {
|
|
41174
41175
|
const collectionParticipantIds = [];
|
|
41175
41176
|
const { collectionId, matchUpCount, matchUpType, gender } = collectionDefinition;
|
|
41176
41177
|
const singlesMatchUp = isMatchUpEventType(SINGLES_MATCHUP)(matchUpType);
|
|
41177
41178
|
generateRange(0, matchUpCount).forEach((i) => {
|
|
41178
|
-
const typeSort = singlesMatchUp ? singlesSort : doublesSort ?? [];
|
|
41179
|
+
const typeSort = singlesMatchUp ? singlesSort : (doublesSort ?? []);
|
|
41179
41180
|
const collectionPosition = i + 1;
|
|
41180
41181
|
const participantIds = [];
|
|
41181
41182
|
generateRange(0, singlesMatchUp ? 1 : 2).forEach((i) => {
|
|
@@ -49974,7 +49975,7 @@ function generateEventParticipants(params) {
|
|
|
49974
49975
|
const qualifyingParticipantsCount = uniqueParticipantsCount[QUALIFYING] || 0;
|
|
49975
49976
|
const participantsCount = eventProfile.drawProfiles?.length
|
|
49976
49977
|
? mainParticipantsCount + qualifyingParticipantsCount
|
|
49977
|
-
: eventProfile.participantsProfile?.participantsCount ?? 0;
|
|
49978
|
+
: (eventProfile.participantsProfile?.participantsCount ?? 0);
|
|
49978
49979
|
const sex = [MALE, FEMALE].includes(gender) ? gender : undefined;
|
|
49979
49980
|
const idPrefix = participantsProfile?.idPrefix ? `E-${eventIndex}-${participantsProfile?.idPrefix}` : undefined;
|
|
49980
49981
|
const { participants: uniqueFlightParticipants } = generateParticipants({
|
|
@@ -51095,8 +51096,8 @@ function processLeagueProfiles(params) {
|
|
|
51095
51096
|
tournamentRecord.events = [];
|
|
51096
51097
|
tournamentRecord.events.push(event);
|
|
51097
51098
|
if (entries.length) {
|
|
51098
|
-
const roundsCount = (isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
|
|
51099
|
-
leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN
|
|
51099
|
+
const roundsCount = ((isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
|
|
51100
|
+
leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN)
|
|
51100
51101
|
? (drawSize - 1) * 2
|
|
51101
51102
|
: drawSize - 1;
|
|
51102
51103
|
const result = generateDrawDefinition({
|
|
@@ -56763,7 +56764,7 @@ function copyTournamentRecord(params) {
|
|
|
56763
56764
|
}, false, true);
|
|
56764
56765
|
};
|
|
56765
56766
|
const tournamentRecord = {
|
|
56766
|
-
participants: params.copyParticipants ? params.tournamentRecord.participants?.map(copyParticipant) ?? [] : [],
|
|
56767
|
+
participants: params.copyParticipants ? (params.tournamentRecord.participants?.map(copyParticipant) ?? []) : [],
|
|
56767
56768
|
parentOrganisation: makeDeepCopy({ ...params.tournamentRecord.parentOrganisation }, false, true),
|
|
56768
56769
|
venues: makeDeepCopy(params.tournamentRecord.venues ?? [], false, true),
|
|
56769
56770
|
extensions: filteredExtensions(params.tournamentRecord.extensions),
|
|
@@ -58180,7 +58181,7 @@ function JSON2CSV(arrayOfJSON, config) {
|
|
|
58180
58181
|
.sort(sortColumns);
|
|
58181
58182
|
Object.keys(columnMap).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
|
|
58182
58183
|
Object.keys(columnTransform).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
|
|
58183
|
-
typeof context === 'object'
|
|
58184
|
+
if (typeof context === 'object')
|
|
58184
58185
|
Object.keys(context).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
|
|
58185
58186
|
let mappedHeaderRow = tranformedHeaderRow.map((key) => columnMap[key] || key);
|
|
58186
58187
|
if (onlyHeaderRow)
|