tods-competition-factory 2.2.28 → 2.2.29

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.
@@ -8851,6 +8851,7 @@ declare function getEntryStatusReports({ tournamentRecord }: GetEntryStatusRepor
8851
8851
  };
8852
8852
 
8853
8853
  type GetStructureReportsArgs = {
8854
+ firstStageSequenceOnly?: boolean;
8854
8855
  tournamentRecord: Tournament;
8855
8856
  extensionProfiles?: any[];
8856
8857
  firstFlightOnly?: boolean;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.28';
6
+ return '2.2.29';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -22795,7 +22795,7 @@ function tallyParticipantResults({ policyDefinitions, generateReport, pressureRa
22795
22795
  perPlayer = 0;
22796
22796
  const completedTieMatchUps = matchUps.every(({ matchUpType, tieMatchUps }) => matchUpType === TEAM$2 && tieMatchUps?.every((matchUp) => checkMatchUpIsComplete({ matchUp })));
22797
22797
  const tallyPolicy = policyDefinitions?.[POLICY_TYPE_ROUND_ROBIN_TALLY];
22798
- const consideredMatchUps = matchUps.filter((matchUp) => checkMatchUpIsComplete({ matchUp }) || matchUp.matchUpType === TEAM$2);
22798
+ const consideredMatchUps = matchUps.filter((matchUp) => checkMatchUpIsComplete({ matchUp }) ?? matchUp.matchUpType === TEAM$2);
22799
22799
  const { participantResults } = getParticipantResults({
22800
22800
  matchUps: consideredMatchUps,
22801
22801
  pressureRating,
@@ -53838,7 +53838,7 @@ function getAvgWTN({ eventType, matchUps, eventId, drawId }) {
53838
53838
  }
53839
53839
 
53840
53840
  function getStructureReports(params) {
53841
- const { tournamentRecord, extensionProfiles, firstFlightOnly } = params;
53841
+ const { tournamentRecord, extensionProfiles, firstFlightOnly, firstStageSequenceOnly = true } = params;
53842
53842
  if (!tournamentRecord)
53843
53843
  return { error: MISSING_TOURNAMENT_ID };
53844
53844
  const mainStructures = [];
@@ -53851,7 +53851,7 @@ function getStructureReports(params) {
53851
53851
  name,
53852
53852
  })?.extension?.value;
53853
53853
  const value = accessor ? getAccessorValue({ element, accessor })?.value : element;
53854
- return { [label || name]: value };
53854
+ return { [label ?? name]: value };
53855
53855
  }));
53856
53856
  const tournamentId = tournamentRecord?.tournamentId;
53857
53857
  const participantsProfile = { withScaleValues: true };
@@ -53870,9 +53870,8 @@ function getStructureReports(params) {
53870
53870
  const updateStructureManipulations = ({ positionManipulations }) => {
53871
53871
  positionManipulations?.forEach((action) => {
53872
53872
  const { structureId, name } = action;
53873
- const drawPositions = action.drawPositions || [action.drawPosition];
53874
- if (!structureManipulations[structureId])
53875
- structureManipulations[structureId] = [];
53873
+ const drawPositions = action.drawPositions ?? [action.drawPosition];
53874
+ structureManipulations[structureId] ??= [];
53876
53875
  structureManipulations[structureId].push(`${name}: ${drawPositions.join('/')}`);
53877
53876
  });
53878
53877
  };
@@ -53884,7 +53883,7 @@ function getStructureReports(params) {
53884
53883
  const flightMap = flightNumbers && Object.assign({}, ...flightNumbers);
53885
53884
  const drawDeletionsExtension = extensions?.find((x) => x.name === DRAW_DELETIONS);
53886
53885
  const drawDeletionsTimeItem = eventTimeItems?.find((x) => x.itemType === DRAW_DELETIONS);
53887
- const drawDeletionsCount = drawDeletionsExtension?.value?.length || drawDeletionsTimeItem?.itemValue || 0;
53886
+ const drawDeletionsCount = drawDeletionsExtension?.value?.length ?? drawDeletionsTimeItem?.itemValue ?? 0;
53888
53887
  const mapValues = Object.values(flightMap ?? {});
53889
53888
  const minFlightNumber = flightMap && Math.min(...mapValues);
53890
53889
  const eventSeedingBasis = getSeedingBasis(eventTimeItems);
@@ -53906,16 +53905,17 @@ function getStructureReports(params) {
53906
53905
  matchUps,
53907
53906
  drawId,
53908
53907
  });
53909
- const seedingBasis = getSeedingBasis(drawTimeItems) || eventSeedingBasis;
53908
+ const seedingBasis = getSeedingBasis(drawTimeItems) ?? eventSeedingBasis;
53910
53909
  const positionManipulations = getPositionManipulations({ extensions });
53911
- const manipulationsCount = positionManipulations?.length || 0;
53910
+ const manipulationsCount = positionManipulations?.length ?? 0;
53912
53911
  updateStructureManipulations({ positionManipulations });
53913
53912
  eventStructureReports[eventId].totalPositionManipulations += manipulationsCount;
53914
53913
  eventStructureReports[eventId].generatedDrawsCount += 1;
53915
53914
  if (manipulationsCount > eventStructureReports[eventId].maxPositionManipulations)
53916
53915
  eventStructureReports[eventId].maxPositionManipulations = manipulationsCount;
53917
53916
  return structures
53918
- ?.filter((s) => s.stageSequence === 1 && [QUALIFYING, MAIN, CONSOLATION, PLAY_OFF].includes(s.stage))
53917
+ ?.filter((s) => (s.stageSequence === 1 || !firstStageSequenceOnly) &&
53918
+ [QUALIFYING, MAIN, CONSOLATION, PLAY_OFF].includes(s.stage))
53919
53919
  .map((s) => {
53920
53920
  const finalMatchUp = [MAIN, PLAY_OFF].includes(s.stage)
53921
53921
  ? matchUps.find((matchUp) => matchUp.structureId === s.structureId && matchUp.finishingRound === 1 && matchUp.winningSide)
@@ -53927,7 +53927,7 @@ function getStructureReports(params) {
53927
53927
  const winningTeamId = winningParticipant?.participantType === TEAM_PARTICIPANT && winningParticipant.participantId;
53928
53928
  const individualParticipants = winningParticipant?.participantType === PAIR ? winningParticipant.individualParticipants : [];
53929
53929
  const winningPersonWTN = getDetailsWTN({
53930
- participant: individualParticipants?.[0] || winningParticipant,
53930
+ participant: individualParticipants?.[0] ?? winningParticipant,
53931
53931
  eventType,
53932
53932
  });
53933
53933
  const { personId: winningPersonId, personOtherId: winningPersonOtherId, tennisId: winningPersonTennisId, confidence: confidence1, wtnRating: wtnRating1, } = winningPersonWTN || {};
@@ -53937,15 +53937,15 @@ function getStructureReports(params) {
53937
53937
  });
53938
53938
  const { personId: winningPerson2Id, personOtherId: winningPerson2OtherId, tennisId: winningPerson2TennisId, confidence: confidence2, wtnRating: wtnRating2, } = winningPerson2WTN || {};
53939
53939
  const { ageCategoryCode, categoryName, subType } = category ?? {};
53940
- const matchUpFormat = s.matchUpFormat || drawMatchUpFormat;
53941
- const matchUpsInitialFormat = matchUpFormatCounts[matchUpFormat] || 0;
53940
+ const matchUpFormat = s.matchUpFormat ?? drawMatchUpFormat;
53941
+ const matchUpsInitialFormat = matchUpFormatCounts[matchUpFormat] ?? 0;
53942
53942
  const pctInitialMatchUpFormat = (matchUpsInitialFormat / matchUpsCount) * 100;
53943
53943
  const { tieFormatName: drawTieFormatName, tieFormatDesc: drawTieFormatDesc } = getTieFormatDesc(drawTieFormat);
53944
53944
  const { tieFormatName: structureTieFormatName, tieFormatDesc: structureTieFormatDesc } = getTieFormatDesc(s.tieFormat);
53945
53945
  const equivalentTieFormatDesc = drawTieFormatDesc === structureTieFormatDesc;
53946
53946
  const tieFormatName = !equivalentTieFormatDesc && structureTieFormatName;
53947
53947
  const tieFormatDesc = s.tieFormat && !equivalentTieFormatDesc && structureTieFormatDesc;
53948
- const manipulations = positionManipulations?.filter((action) => action.structureId === s.structureId)?.length || 0;
53948
+ const manipulations = positionManipulations?.filter((action) => action.structureId === s.structureId)?.length ?? 0;
53949
53949
  return {
53950
53950
  ...extensionValues,
53951
53951
  tournamentId,