tods-competition-factory 2.2.28 → 2.2.30

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.
@@ -4619,11 +4619,11 @@ declare function deleteFlightProfileAndFlightDraws({ autoPublish, tournamentReco
4619
4619
  event: any;
4620
4620
  force: any;
4621
4621
  }): {
4622
+ error: any;
4623
+ } | {
4622
4624
  success?: boolean;
4623
4625
  error?: ErrorType;
4624
4626
  info?: any;
4625
- } | {
4626
- error: any;
4627
4627
  };
4628
4628
 
4629
4629
  type ModifyEventMatchUpFormatTimingArgs = {
@@ -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.30';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -14673,13 +14673,14 @@ function addDrawEntry(params) {
14673
14673
  function addDrawEntries$1(params) {
14674
14674
  const stack = 'addDrawEntries';
14675
14675
  const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE, autoEntryPositions = true, ignoreStageSpace, participantIds, drawDefinition, stageSequence, stage = MAIN, roundTarget, extension, event, } = params;
14676
+ const isAdHocDraw = drawDefinition.drawType === AD_HOC;
14676
14677
  if (!stage)
14677
14678
  return { error: MISSING_STAGE };
14678
14679
  if (!drawDefinition)
14679
14680
  return { error: MISSING_DRAW_DEFINITION };
14680
14681
  if (!Array.isArray(participantIds))
14681
14682
  return { error: INVALID_PARTICIPANT_IDS };
14682
- if (!getValidStage({ stage, drawDefinition })) {
14683
+ if (!isAdHocDraw && !getValidStage({ stage, drawDefinition })) {
14683
14684
  return { error: INVALID_STAGE };
14684
14685
  }
14685
14686
  if (extension && !isValidExtension({ extension })) {
@@ -14696,11 +14697,14 @@ function addDrawEntries$1(params) {
14696
14697
  entryStatus,
14697
14698
  stage,
14698
14699
  });
14699
- if (!ignoreStageSpace && !spaceAvailable.success) {
14700
+ if (!ignoreStageSpace && !spaceAvailable.success && !isAdHocDraw) {
14700
14701
  return { error: spaceAvailable.error };
14701
14702
  }
14702
14703
  const positionsAvailable = spaceAvailable.positionsAvailable ?? 0;
14703
- if (!ignoreStageSpace && stage !== VOLUNTARY_CONSOLATION && positionsAvailable < participantIds.length)
14704
+ if (!ignoreStageSpace &&
14705
+ !isAdHocDraw &&
14706
+ stage !== VOLUNTARY_CONSOLATION &&
14707
+ positionsAvailable < participantIds.length)
14704
14708
  return { error: PARTICIPANT_COUNT_EXCEEDS_DRAW_SIZE };
14705
14709
  const duplicateEntries = [];
14706
14710
  const drawId = drawDefinition.drawId;
@@ -22795,7 +22799,7 @@ function tallyParticipantResults({ policyDefinitions, generateReport, pressureRa
22795
22799
  perPlayer = 0;
22796
22800
  const completedTieMatchUps = matchUps.every(({ matchUpType, tieMatchUps }) => matchUpType === TEAM$2 && tieMatchUps?.every((matchUp) => checkMatchUpIsComplete({ matchUp })));
22797
22801
  const tallyPolicy = policyDefinitions?.[POLICY_TYPE_ROUND_ROBIN_TALLY];
22798
- const consideredMatchUps = matchUps.filter((matchUp) => checkMatchUpIsComplete({ matchUp }) || matchUp.matchUpType === TEAM$2);
22802
+ const consideredMatchUps = matchUps.filter((matchUp) => checkMatchUpIsComplete({ matchUp }) ?? matchUp.matchUpType === TEAM$2);
22799
22803
  const { participantResults } = getParticipantResults({
22800
22804
  matchUps: consideredMatchUps,
22801
22805
  pressureRating,
@@ -46972,7 +46976,7 @@ function getGroupedRounds({ scheduledRoundsDetails, greatestAverageMinutes, garm
46972
46976
  if (roundDetails.hash === lastHash || garmanSinglePass) {
46973
46977
  groupedMatchUpIds = groupedMatchUpIds.concat(roundDetails.matchUpIds);
46974
46978
  }
46975
- if (roundDetails.hash !== lastHash && false) ;
46979
+ if (roundDetails.hash !== lastHash && !garmanSinglePass) ;
46976
46980
  averageMinutes = greatestAverageMinutes ;
46977
46981
  recoveryMinutes = roundDetails.recoveryMinutes;
46978
46982
  roundPeriodLength = roundDetails.roundPeriodLength;
@@ -53838,7 +53842,7 @@ function getAvgWTN({ eventType, matchUps, eventId, drawId }) {
53838
53842
  }
53839
53843
 
53840
53844
  function getStructureReports(params) {
53841
- const { tournamentRecord, extensionProfiles, firstFlightOnly } = params;
53845
+ const { tournamentRecord, extensionProfiles, firstFlightOnly, firstStageSequenceOnly = true } = params;
53842
53846
  if (!tournamentRecord)
53843
53847
  return { error: MISSING_TOURNAMENT_ID };
53844
53848
  const mainStructures = [];
@@ -53851,7 +53855,7 @@ function getStructureReports(params) {
53851
53855
  name,
53852
53856
  })?.extension?.value;
53853
53857
  const value = accessor ? getAccessorValue({ element, accessor })?.value : element;
53854
- return { [label || name]: value };
53858
+ return { [label ?? name]: value };
53855
53859
  }));
53856
53860
  const tournamentId = tournamentRecord?.tournamentId;
53857
53861
  const participantsProfile = { withScaleValues: true };
@@ -53870,9 +53874,8 @@ function getStructureReports(params) {
53870
53874
  const updateStructureManipulations = ({ positionManipulations }) => {
53871
53875
  positionManipulations?.forEach((action) => {
53872
53876
  const { structureId, name } = action;
53873
- const drawPositions = action.drawPositions || [action.drawPosition];
53874
- if (!structureManipulations[structureId])
53875
- structureManipulations[structureId] = [];
53877
+ const drawPositions = action.drawPositions ?? [action.drawPosition];
53878
+ structureManipulations[structureId] ??= [];
53876
53879
  structureManipulations[structureId].push(`${name}: ${drawPositions.join('/')}`);
53877
53880
  });
53878
53881
  };
@@ -53884,7 +53887,7 @@ function getStructureReports(params) {
53884
53887
  const flightMap = flightNumbers && Object.assign({}, ...flightNumbers);
53885
53888
  const drawDeletionsExtension = extensions?.find((x) => x.name === DRAW_DELETIONS);
53886
53889
  const drawDeletionsTimeItem = eventTimeItems?.find((x) => x.itemType === DRAW_DELETIONS);
53887
- const drawDeletionsCount = drawDeletionsExtension?.value?.length || drawDeletionsTimeItem?.itemValue || 0;
53890
+ const drawDeletionsCount = drawDeletionsExtension?.value?.length ?? drawDeletionsTimeItem?.itemValue ?? 0;
53888
53891
  const mapValues = Object.values(flightMap ?? {});
53889
53892
  const minFlightNumber = flightMap && Math.min(...mapValues);
53890
53893
  const eventSeedingBasis = getSeedingBasis(eventTimeItems);
@@ -53906,16 +53909,17 @@ function getStructureReports(params) {
53906
53909
  matchUps,
53907
53910
  drawId,
53908
53911
  });
53909
- const seedingBasis = getSeedingBasis(drawTimeItems) || eventSeedingBasis;
53912
+ const seedingBasis = getSeedingBasis(drawTimeItems) ?? eventSeedingBasis;
53910
53913
  const positionManipulations = getPositionManipulations({ extensions });
53911
- const manipulationsCount = positionManipulations?.length || 0;
53914
+ const manipulationsCount = positionManipulations?.length ?? 0;
53912
53915
  updateStructureManipulations({ positionManipulations });
53913
53916
  eventStructureReports[eventId].totalPositionManipulations += manipulationsCount;
53914
53917
  eventStructureReports[eventId].generatedDrawsCount += 1;
53915
53918
  if (manipulationsCount > eventStructureReports[eventId].maxPositionManipulations)
53916
53919
  eventStructureReports[eventId].maxPositionManipulations = manipulationsCount;
53917
53920
  return structures
53918
- ?.filter((s) => s.stageSequence === 1 && [QUALIFYING, MAIN, CONSOLATION, PLAY_OFF].includes(s.stage))
53921
+ ?.filter((s) => (s.stageSequence === 1 || !firstStageSequenceOnly) &&
53922
+ [QUALIFYING, MAIN, CONSOLATION, PLAY_OFF].includes(s.stage))
53919
53923
  .map((s) => {
53920
53924
  const finalMatchUp = [MAIN, PLAY_OFF].includes(s.stage)
53921
53925
  ? matchUps.find((matchUp) => matchUp.structureId === s.structureId && matchUp.finishingRound === 1 && matchUp.winningSide)
@@ -53927,7 +53931,7 @@ function getStructureReports(params) {
53927
53931
  const winningTeamId = winningParticipant?.participantType === TEAM_PARTICIPANT && winningParticipant.participantId;
53928
53932
  const individualParticipants = winningParticipant?.participantType === PAIR ? winningParticipant.individualParticipants : [];
53929
53933
  const winningPersonWTN = getDetailsWTN({
53930
- participant: individualParticipants?.[0] || winningParticipant,
53934
+ participant: individualParticipants?.[0] ?? winningParticipant,
53931
53935
  eventType,
53932
53936
  });
53933
53937
  const { personId: winningPersonId, personOtherId: winningPersonOtherId, tennisId: winningPersonTennisId, confidence: confidence1, wtnRating: wtnRating1, } = winningPersonWTN || {};
@@ -53937,15 +53941,15 @@ function getStructureReports(params) {
53937
53941
  });
53938
53942
  const { personId: winningPerson2Id, personOtherId: winningPerson2OtherId, tennisId: winningPerson2TennisId, confidence: confidence2, wtnRating: wtnRating2, } = winningPerson2WTN || {};
53939
53943
  const { ageCategoryCode, categoryName, subType } = category ?? {};
53940
- const matchUpFormat = s.matchUpFormat || drawMatchUpFormat;
53941
- const matchUpsInitialFormat = matchUpFormatCounts[matchUpFormat] || 0;
53944
+ const matchUpFormat = s.matchUpFormat ?? drawMatchUpFormat;
53945
+ const matchUpsInitialFormat = matchUpFormatCounts[matchUpFormat] ?? 0;
53942
53946
  const pctInitialMatchUpFormat = (matchUpsInitialFormat / matchUpsCount) * 100;
53943
53947
  const { tieFormatName: drawTieFormatName, tieFormatDesc: drawTieFormatDesc } = getTieFormatDesc(drawTieFormat);
53944
53948
  const { tieFormatName: structureTieFormatName, tieFormatDesc: structureTieFormatDesc } = getTieFormatDesc(s.tieFormat);
53945
53949
  const equivalentTieFormatDesc = drawTieFormatDesc === structureTieFormatDesc;
53946
53950
  const tieFormatName = !equivalentTieFormatDesc && structureTieFormatName;
53947
53951
  const tieFormatDesc = s.tieFormat && !equivalentTieFormatDesc && structureTieFormatDesc;
53948
- const manipulations = positionManipulations?.filter((action) => action.structureId === s.structureId)?.length || 0;
53952
+ const manipulations = positionManipulations?.filter((action) => action.structureId === s.structureId)?.length ?? 0;
53949
53953
  return {
53950
53954
  ...extensionValues,
53951
53955
  tournamentId,