tods-competition-factory 2.2.12 → 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.
@@ -183,18 +183,8 @@ interface TimeItem {
183
183
  itemType?: string;
184
184
  itemValue?: any;
185
185
  }
186
- declare enum CategoryEnum {
187
- AGE = "AGE",
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
- declare enum DrawStatusEnum {
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
- declare enum IndoorOutdoorEnum {
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.12';
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([0-9]{1,2})@?([1-9]?)*/);
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([0-9]{1,2})@?([1-9]?)*/);
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];
@@ -5705,7 +5705,7 @@ function addPositionActionTelemetry(params) {
5705
5705
  name: POSITION_ACTIONS,
5706
5706
  element: drawDefinition,
5707
5707
  });
5708
- const existingValue = Array.isArray(extension?.value) ? extension?.value ?? [] : [];
5708
+ const existingValue = Array.isArray(extension?.value) ? (extension?.value ?? []) : [];
5709
5709
  if (!existingValue?.length) {
5710
5710
  const mainStructure = drawDefinition.structures.find((structure) => structure.stage === MAIN);
5711
5711
  if (mainStructure) {
@@ -7787,7 +7787,8 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
7787
7787
  const participantMap = {};
7788
7788
  for (const participant of tournamentRecord.participants ?? []) {
7789
7789
  const participantId = participant?.participantId;
7790
- participantId && initializeParticipantId({ participantMap, participantId });
7790
+ if (participantId)
7791
+ initializeParticipantId({ participantMap, participantId });
7791
7792
  }
7792
7793
  for (const participant of tournamentRecord.participants ?? []) {
7793
7794
  const participantCopy = makeDeepCopy(participant, convertExtensions, internalUse);
@@ -8957,7 +8958,7 @@ function getRoundContextProfile({ roundNamingPolicy, drawDefinition, structure,
8957
8958
  .filter((structure) => structure.stage === QUALIFYING)
8958
8959
  .map(({ stageSequence }) => stageSequence ?? 1), 0)
8959
8960
  : 0;
8960
- const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? structure.stageSequence ?? 1 : '';
8961
+ const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? (structure.stageSequence ?? 1) : '';
8961
8962
  const preQualifyingAffix = preQualifyingSequence
8962
8963
  ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || ''
8963
8964
  : '';
@@ -10202,7 +10203,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
10202
10203
  collectionDefinitions?.find((definition) => definition.collectionId === matchUp.collectionId);
10203
10204
  const matchUpFormat = matchUp.collectionId
10204
10205
  ? collectionDefinition?.matchUpFormat
10205
- : matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
10206
+ : (matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat);
10206
10207
  const matchUpType = matchUp.matchUpType ||
10207
10208
  collectionDefinition?.matchUpType ||
10208
10209
  structure?.matchUpType ||
@@ -10251,7 +10252,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
10251
10252
  ...(context?.category || {}),
10252
10253
  ...collectionDefinition.category,
10253
10254
  }
10254
- : context?.category ?? event?.category;
10255
+ : (context?.category ?? event?.category);
10255
10256
  const processCodes = (matchUp.processCodes?.length && matchUp.processCodes) ||
10256
10257
  (collectionDefinition?.processCodes?.length && collectionDefinition?.processCodes) ||
10257
10258
  (structure?.processCodes?.length && structure?.processCodes) ||
@@ -11873,7 +11874,7 @@ function addFinishingRounds({ finishingPositionOffset = 0, finishingPositionLimi
11873
11874
  };
11874
11875
  const upcomingMatchUps = roundMatchUpsCountArray?.slice(roundNumber - 1).reduce((a, b) => a + (b || 0), 0);
11875
11876
  const fmlcException = fmlc && roundNumber !== 1;
11876
- const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? positionsFed ?? 0 : 0);
11877
+ const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? (positionsFed ?? 0) : 0);
11877
11878
  const finalPosition = 1;
11878
11879
  const positionRange = generateRange(rangeOffset, lucky ? rangeOffset + matchUpsCount * 2 : upcomingMatchUps + rangeOffset + finalPosition);
11879
11880
  const slicer = upcomingMatchUps + finalPosition - matchUpsCount;
@@ -12155,7 +12156,7 @@ function getStructureDrawPositionProfiles(params) {
12155
12156
  const result = findStructure({ drawDefinition, structureId });
12156
12157
  if (result.error)
12157
12158
  return result;
12158
- structure = findContainer ? result.containingStructure ?? result.structure : result.structure;
12159
+ structure = findContainer ? (result.containingStructure ?? result.structure) : result.structure;
12159
12160
  }
12160
12161
  if (isAdHoc({ structure })) {
12161
12162
  return { structure, isAdHoc: true, error: INVALID_DRAW_POSITION };
@@ -13526,7 +13527,7 @@ function getPubStatus({ event }) {
13526
13527
  const drawDetailPublishedIds = drawDetails &&
13527
13528
  Object.keys(drawDetails).length &&
13528
13529
  Object.keys(drawDetails).filter((drawId) => getDrawPublishStatus({ drawDetails, drawId }));
13529
- const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : eventPubStatus.drawIds ?? [];
13530
+ const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : (eventPubStatus.drawIds ?? []);
13530
13531
  if (publishedDrawIds?.length && !drawDetailPublishedIds?.length) {
13531
13532
  for (const drawId of publishedDrawIds) {
13532
13533
  drawDetails[drawId] = {
@@ -13740,7 +13741,8 @@ function processSides(params) {
13740
13741
  individualParticipantIds.forEach((participantId, i) => {
13741
13742
  const partnerParticipantId = individualParticipantIds[1 - i];
13742
13743
  const participant = participantMap[participantId];
13743
- participant && addPartner({ participant, partnerParticipantId });
13744
+ if (participant)
13745
+ addPartner({ participant, partnerParticipantId });
13744
13746
  });
13745
13747
  if (withEvents && matchUpSides) {
13746
13748
  const teamParticipantId = matchUpSides.find((s) => s.sideNumber === sideNumber)?.participant?.participantId;
@@ -16343,7 +16345,7 @@ function getNextSeedBlock(params) {
16343
16345
  const seedsWithoutDrawPositions = seedAssignments?.filter((assignment) => !assignment.participantId);
16344
16346
  const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0
16345
16347
  ? unplacedSeedAssignments.length
16346
- : seedsWithoutDrawPositions?.length ?? 0;
16348
+ : (seedsWithoutDrawPositions?.length ?? 0);
16347
16349
  const unfilled = (seedsLeftToAssign &&
16348
16350
  nextSeedBlock?.drawPositions.filter((drawPosition) => !assignedDrawPositions?.includes(drawPosition))) ||
16349
16351
  [];
@@ -21950,7 +21952,7 @@ function getParticipantResults({ participantIds, pressureRating, matchUpFormat,
21950
21952
  ? tieMatchUps
21951
21953
  .filter(({ matchUpStatus }) => !excludeMatchUpStatuses.includes(matchUpStatus))
21952
21954
  .flatMap(({ score }) => score?.sets?.length ?? 0)
21953
- : score?.sets?.length ?? 0);
21955
+ : (score?.sets?.length ?? 0));
21954
21956
  const totalSets = allSets?.reduce((a, b) => a + b, 0);
21955
21957
  for (const matchUp of filteredMatchUps ?? []) {
21956
21958
  const { matchUpStatus, tieMatchUps, tieFormat, score, winningSide, sides } = matchUp;
@@ -22288,7 +22290,7 @@ function getTallyReport({ matchUps, order, report }) {
22288
22290
  const floatSort = (a, b) => parseFloat(step.reversed ? a : b) - parseFloat(step.reversed ? b : a);
22289
22291
  const participantsCount = step.groups
22290
22292
  ? Object.values(step.groups).flat(Infinity).length
22291
- : step.participantIds?.length ?? 0;
22293
+ : (step.participantIds?.length ?? 0);
22292
22294
  const getExplanation = (step) => {
22293
22295
  step.groups &&
22294
22296
  Object.keys(step.groups)
@@ -22899,11 +22901,11 @@ function modifyMatchUpScore(params) {
22899
22901
  const updateTally = (structure) => {
22900
22902
  matchUpFormat = isDualMatchUp
22901
22903
  ? 'SET1-S:T100'
22902
- : matchUpFormat ??
22904
+ : (matchUpFormat ??
22903
22905
  matchUp.matchUpFormat ??
22904
22906
  structure?.matchUpFormat ??
22905
22907
  drawDefinition?.matchUpFormat ??
22906
- event?.matchUpFormat;
22908
+ event?.matchUpFormat);
22907
22909
  const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : undefined;
22908
22910
  const { matchUps } = getAllStructureMatchUps({
22909
22911
  afterRecoveryTimes: false,
@@ -25097,20 +25099,20 @@ function getEligibleVoluntaryConsolationParticipants({ excludedMatchUpStatuses =
25097
25099
  const eventMatchUpFilters = event?.eventType ? { matchUpTypes: [event.eventType] } : undefined;
25098
25100
  const drawMatchUpFilters = drawDefinition?.matchUpType ? { matchUpTypes: [drawDefinition.matchUpType] } : undefined;
25099
25101
  const matchUps = includeEventParticipants && event
25100
- ? allEventMatchUps({
25102
+ ? (allEventMatchUps({
25101
25103
  contextFilters: { stages },
25102
25104
  matchUpFilters: eventMatchUpFilters,
25103
25105
  tournamentRecord,
25104
25106
  inContext: true,
25105
25107
  event,
25106
- })?.matchUps ?? []
25107
- : allDrawMatchUps({
25108
+ })?.matchUps ?? [])
25109
+ : (allDrawMatchUps({
25108
25110
  contextFilters: { stages },
25109
25111
  matchUpFilters: drawMatchUpFilters,
25110
25112
  tournamentRecord,
25111
25113
  inContext: true,
25112
25114
  drawDefinition,
25113
- })?.matchUps ?? [];
25115
+ })?.matchUps ?? []);
25114
25116
  const voluntaryConsolationEntries = getStageEntries$2({
25115
25117
  stage: VOLUNTARY_CONSOLATION,
25116
25118
  drawDefinition,
@@ -30130,23 +30132,21 @@ function keyValueScore(params) {
30130
30132
  else if (analysis.isGameScoreEntry) {
30131
30133
  info = 'game scoreString entry';
30132
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
+ }
30133
30148
  else {
30134
- if (analysis.lastSetIsComplete || !sets.length) {
30135
- updated = true;
30136
- const { scoreString: newScore, set } = keyValueSetScore({
30137
- analysis,
30138
- lowSide,
30139
- scoreString,
30140
- value: ensureInt(value),
30141
- });
30142
- if (set)
30143
- set.setNumber = sets?.length + 1 || 1;
30144
- sets = sets?.concat(set).filter(Boolean) || [set];
30145
- scoreString = newScore || undefined;
30146
- }
30147
- else {
30148
- console.log('error: unknown outcome');
30149
- }
30149
+ console.log('error: unknown outcome');
30150
30150
  }
30151
30151
  if (updated) {
30152
30152
  sets = sets?.filter(Boolean);
@@ -30225,10 +30225,8 @@ function correctContainerMismatch(score) {
30225
30225
  lastType = '';
30226
30226
  return complement;
30227
30227
  }
30228
- else {
30229
- if (!typeCount[lastType])
30230
- lastType = '';
30231
- }
30228
+ else if (!typeCount[lastType])
30229
+ lastType = '';
30232
30230
  }
30233
30231
  return char;
30234
30232
  })
@@ -35495,31 +35493,32 @@ function tournamentRelevantSchedulingIds(params) {
35495
35493
  tournamentIds.push(tournamentId);
35496
35494
  tournamentMap[tournamentId] = {};
35497
35495
  const events = tournamentRecord?.events || [];
35498
- events.forEach((event) => {
35496
+ for (const event of events) {
35499
35497
  const eventId = event.eventId;
35500
35498
  eventIds.push(eventId);
35501
35499
  tournamentMap[tournamentId][eventId] = {};
35502
- (event.drawDefinitions || []).forEach((drawDefinition) => {
35500
+ const mapParsedInt = (roundNumber) => parseInt(roundNumber);
35501
+ for (const drawDefinition of event.drawDefinitions || []) {
35503
35502
  const drawId = drawDefinition.drawId;
35504
35503
  drawIds.push(drawId);
35505
35504
  tournamentMap[tournamentId][eventId][drawId] = {};
35506
35505
  const { structures } = getDrawStructures({ drawDefinition });
35507
- (structures || []).forEach((structure) => {
35506
+ for (const structure of structures || []) {
35508
35507
  const structureId = structure.structureId;
35509
35508
  const { matchUps } = getAllStructureMatchUps({ structure });
35510
35509
  const { roundMatchUps } = getRoundMatchUps({ matchUps });
35511
- const rounds = roundMatchUps && Object.keys(roundMatchUps).map((roundNumber) => parseInt(roundNumber));
35510
+ const rounds = roundMatchUps && Object.keys(roundMatchUps).map(mapParsedInt);
35512
35511
  tournamentMap[tournamentId][eventId][drawId][structureId] = rounds;
35513
35512
  structureIds.push(structureId);
35514
35513
  if (structure.structures?.length) {
35515
- structure.structures.forEach((itemStructure) => {
35514
+ for (const itemStructure of structure.structures) {
35516
35515
  structureIds.push(itemStructure.structureId);
35517
35516
  tournamentMap[tournamentId][eventId][drawId][itemStructure.structureId] = rounds;
35518
- });
35517
+ }
35519
35518
  }
35520
- });
35521
- });
35522
- });
35519
+ }
35520
+ }
35521
+ }
35523
35522
  }
35524
35523
  return {
35525
35524
  tournamentMap,
@@ -36851,7 +36850,7 @@ function getPredictiveAccuracy(params) {
36851
36850
  : 0;
36852
36851
  const zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
36853
36852
  ? (zonePct ?? 0 / 100) * ratingsRangeDifference
36854
- : params.zoneMargin ?? ratingsRangeDifference;
36853
+ : (params.zoneMargin ?? ratingsRangeDifference);
36855
36854
  const contextProfile = { withScaleValues: true, withCompetitiveness: true };
36856
36855
  const contextFilters = {
36857
36856
  matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
@@ -38576,7 +38575,7 @@ function addParticipant(params) {
38576
38575
  const { allowDuplicateParticipantIdPairs, returnParticipant, disableNotice, pairOverride, participant } = params;
38577
38576
  const tournamentRecord = params.tournamentId
38578
38577
  ? params.tournamentRecords?.[params.tournamentId]
38579
- : params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]);
38578
+ : (params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]));
38580
38579
  if (!tournamentRecord)
38581
38580
  return { error: MISSING_TOURNAMENT_RECORD };
38582
38581
  if (!participant)
@@ -39189,7 +39188,7 @@ function generateEventsFromTieFormat(params) {
39189
39188
  const entryStatus = eventType === DOUBLES_EVENT ? UNGROUPED : params.entryStatus || DIRECT_ACCEPTANCE;
39190
39189
  const participantIds = eventGender === MIXED
39191
39190
  ? [...genderedParticipants[MALE], ...genderedParticipants[FEMALE]]
39192
- : genderedParticipants[eventGender] ?? [];
39191
+ : (genderedParticipants[eventGender] ?? []);
39193
39192
  if (participantIds.length) {
39194
39193
  const result = addEventEntries({
39195
39194
  participantIds,
@@ -40581,7 +40580,7 @@ function checkCategoryUpdates(params) {
40581
40580
  const startDate = params.eventUpdates.startDate || params.event.startDate || params.tournamentRecord.startDate;
40582
40581
  const endDate = params.eventUpdates.endDate || params.event.endDate || params.tournamentRecord.endDate;
40583
40582
  const individualParticpants = params.enteredParticipants
40584
- .map((p) => (p.participantType === INDIVIDUAL ? p : p.individualParticpants ?? []))
40583
+ .map((p) => (p.participantType === INDIVIDUAL ? p : (p.individualParticpants ?? [])))
40585
40584
  .flat();
40586
40585
  const startAgeDetails = getCategoryAgeDetails({ category, consideredDate: startDate });
40587
40586
  const endAgeDetails = getCategoryAgeDetails({ category, consideredDate: endDate });
@@ -40636,11 +40635,11 @@ function getEnteredParticipants(params) {
40636
40635
  })
40637
40636
  .map(({ participantId }) => participantId) ?? [];
40638
40637
  return enteredParticipantIds
40639
- ? getParticipants({
40638
+ ? (getParticipants({
40640
40639
  participantFilters: { participantIds: enteredParticipantIds },
40641
40640
  withIndividualParticipants: true,
40642
40641
  tournamentRecord,
40643
- }).participants ?? []
40642
+ }).participants ?? [])
40644
40643
  : [];
40645
40644
  }
40646
40645
  function getParticipantsProfile({ enteredParticipants }) {
@@ -41170,14 +41169,14 @@ function generateLineUps(params) {
41170
41169
  const singlesSort = teamParticipant.individualParticipants?.sort(singlesScaleSort) ?? [];
41171
41170
  const doublesSort = singlesOnly
41172
41171
  ? singlesSort
41173
- : teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? [];
41172
+ : (teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? []);
41174
41173
  const participantAssignments = {};
41175
41174
  for (const collectionDefinition of collectionDefinitions) {
41176
41175
  const collectionParticipantIds = [];
41177
41176
  const { collectionId, matchUpCount, matchUpType, gender } = collectionDefinition;
41178
41177
  const singlesMatchUp = isMatchUpEventType(SINGLES_MATCHUP)(matchUpType);
41179
41178
  generateRange(0, matchUpCount).forEach((i) => {
41180
- const typeSort = singlesMatchUp ? singlesSort : doublesSort ?? [];
41179
+ const typeSort = singlesMatchUp ? singlesSort : (doublesSort ?? []);
41181
41180
  const collectionPosition = i + 1;
41182
41181
  const participantIds = [];
41183
41182
  generateRange(0, singlesMatchUp ? 1 : 2).forEach((i) => {
@@ -49976,7 +49975,7 @@ function generateEventParticipants(params) {
49976
49975
  const qualifyingParticipantsCount = uniqueParticipantsCount[QUALIFYING] || 0;
49977
49976
  const participantsCount = eventProfile.drawProfiles?.length
49978
49977
  ? mainParticipantsCount + qualifyingParticipantsCount
49979
- : eventProfile.participantsProfile?.participantsCount ?? 0;
49978
+ : (eventProfile.participantsProfile?.participantsCount ?? 0);
49980
49979
  const sex = [MALE, FEMALE].includes(gender) ? gender : undefined;
49981
49980
  const idPrefix = participantsProfile?.idPrefix ? `E-${eventIndex}-${participantsProfile?.idPrefix}` : undefined;
49982
49981
  const { participants: uniqueFlightParticipants } = generateParticipants({
@@ -51097,8 +51096,8 @@ function processLeagueProfiles(params) {
51097
51096
  tournamentRecord.events = [];
51098
51097
  tournamentRecord.events.push(event);
51099
51098
  if (entries.length) {
51100
- const roundsCount = (isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
51101
- leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN
51099
+ const roundsCount = ((isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
51100
+ leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN)
51102
51101
  ? (drawSize - 1) * 2
51103
51102
  : drawSize - 1;
51104
51103
  const result = generateDrawDefinition({
@@ -56765,7 +56764,7 @@ function copyTournamentRecord(params) {
56765
56764
  }, false, true);
56766
56765
  };
56767
56766
  const tournamentRecord = {
56768
- participants: params.copyParticipants ? params.tournamentRecord.participants?.map(copyParticipant) ?? [] : [],
56767
+ participants: params.copyParticipants ? (params.tournamentRecord.participants?.map(copyParticipant) ?? []) : [],
56769
56768
  parentOrganisation: makeDeepCopy({ ...params.tournamentRecord.parentOrganisation }, false, true),
56770
56769
  venues: makeDeepCopy(params.tournamentRecord.venues ?? [], false, true),
56771
56770
  extensions: filteredExtensions(params.tournamentRecord.extensions),
@@ -58182,7 +58181,7 @@ function JSON2CSV(arrayOfJSON, config) {
58182
58181
  .sort(sortColumns);
58183
58182
  Object.keys(columnMap).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58184
58183
  Object.keys(columnTransform).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58185
- typeof context === 'object' &&
58184
+ if (typeof context === 'object')
58186
58185
  Object.keys(context).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58187
58186
  let mappedHeaderRow = tranformedHeaderRow.map((key) => columnMap[key] || key);
58188
58187
  if (onlyHeaderRow)