tods-competition-factory 1.8.20 → 1.8.22

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.
@@ -2043,11 +2043,12 @@ declare function getOrderedDrawPositions({ drawPositions, roundProfile, roundNum
2043
2043
  };
2044
2044
 
2045
2045
  type GetRoundContextProfileArgs = {
2046
+ drawDefinition?: DrawDefinition;
2046
2047
  matchUps: HydratedMatchUp[];
2047
2048
  roundNamingPolicy: any;
2048
2049
  structure: Structure;
2049
2050
  };
2050
- declare function getRoundContextProfile({ roundNamingPolicy, structure, matchUps, }: GetRoundContextProfileArgs): ResultType & {
2051
+ declare function getRoundContextProfile({ roundNamingPolicy, drawDefinition, structure, matchUps, }: GetRoundContextProfileArgs): ResultType & {
2051
2052
  roundNamingProfile?: {
2052
2053
  [key: string]: {
2053
2054
  roundName: string;
@@ -2117,11 +2118,11 @@ type GetRoundMatchUpsArgs = {
2117
2118
  interpolate?: boolean;
2118
2119
  };
2119
2120
  type RoundMatchUpsResult = {
2120
- roundsNotPowerOf2?: boolean;
2121
2121
  roundMatchUps?: HydratedMatchUp[];
2122
2122
  hasNoRoundPositions?: boolean;
2123
- roundProfile?: RoundProfile;
2123
+ roundsNotPowerOf2?: boolean;
2124
2124
  maxMatchUpsCount?: number;
2125
+ roundProfile?: RoundProfile;
2125
2126
  roundNumbers?: number[];
2126
2127
  error?: ErrorType;
2127
2128
  };
@@ -1521,7 +1521,6 @@ const DIRECT_ENTRY_STATUSES = [
1521
1521
  const STRUCTURE_SELECTED_STATUSES = [
1522
1522
  CONFIRMED,
1523
1523
  DIRECT_ACCEPTANCE,
1524
- FEED_IN,
1525
1524
  JUNIOR_EXEMPT,
1526
1525
  LUCKY_LOSER,
1527
1526
  QUALIFIER,
@@ -6763,6 +6762,9 @@ const POLICY_ROUND_NAMING_DEFAULT = {
6763
6762
  namingConventions: {
6764
6763
  round: "Round"
6765
6764
  },
6765
+ qualifyingFinishMap: {
6766
+ 1: "Final"
6767
+ },
6766
6768
  abbreviatedRoundNamingMap: {
6767
6769
  // key is matchUpsCount for the round
6768
6770
  1: "F",
@@ -6776,7 +6778,8 @@ const POLICY_ROUND_NAMING_DEFAULT = {
6776
6778
  },
6777
6779
  affixes: {
6778
6780
  roundNumber: "R",
6779
- preFeedRound: "Q"
6781
+ preFeedRound: "Q",
6782
+ preQualifying: "P"
6780
6783
  },
6781
6784
  stageConstants: {
6782
6785
  [MAIN]: "",
@@ -6789,6 +6792,7 @@ const POLICY_ROUND_NAMING_DEFAULT = {
6789
6792
 
6790
6793
  function getRoundContextProfile({
6791
6794
  roundNamingPolicy,
6795
+ drawDefinition,
6792
6796
  structure,
6793
6797
  matchUps
6794
6798
  }) {
@@ -6799,21 +6803,31 @@ function getRoundContextProfile({
6799
6803
  const isRoundRobin = structure.structures;
6800
6804
  const roundNamingProfile = {};
6801
6805
  const defaultRoundNamingPolicy = POLICY_ROUND_NAMING_DEFAULT[POLICY_TYPE_ROUND_NAMING];
6806
+ const isQualifying = structure.stage === QUALIFYING;
6807
+ const qualifyingFinishgMap = isQualifying && (roundNamingPolicy?.qualifyingFinishMap || defaultRoundNamingPolicy?.qualifyingFinishMap || {});
6808
+ const qualifyingStageSequences = isQualifying ? Math.max(
6809
+ ...(drawDefinition?.structures ?? []).filter((structure2) => structure2.stage === QUALIFYING).map(({ stageSequence }) => stageSequence ?? 1),
6810
+ 0
6811
+ ) : 0;
6812
+ const preQualifyingSequence = qualifyingStageSequences ? qualifyingStageSequences - (structure.stageSequence || 1) || "" : "";
6813
+ const preQualifyingAffix = preQualifyingSequence ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || "" : "";
6802
6814
  const roundNamingMap = roundNamingPolicy?.roundNamingMap || defaultRoundNamingPolicy.roundNamingMap || {};
6803
6815
  const abbreviatedRoundNamingMap = roundNamingPolicy?.abbreviatedRoundNamingMap || defaultRoundNamingPolicy.abbreviatedRoundNamingMap || {};
6804
- const roundNamePrefix = roundNamingPolicy?.affixes || defaultRoundNamingPolicy.affixes;
6805
- const roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
6816
+ const preFeedAffix = roundNamingPolicy?.affixes?.preFeedRound || defaultRoundNamingPolicy.affixes.preFeedRound;
6817
+ const roundNumberAffix = roundNamingPolicy?.affixes?.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
6806
6818
  const namingConventions = roundNamingPolicy?.namingConventions || defaultRoundNamingPolicy.namingConventions;
6807
6819
  const roundNameFallback = namingConventions.round;
6808
- const stageInitial = stage && stage !== MAIN && stage[0];
6809
- const stageConstants = roundNamingPolicy?.stageConstants;
6810
- const stageConstant = stage && stageConstants?.[stage] || stageInitial;
6820
+ const stageInitial = stage && stage !== MAIN ? stage[0] : "";
6821
+ const stageConstants = roundNamingPolicy?.stageConstants || defaultRoundNamingPolicy.stageConstants;
6822
+ const stageIndicator = stage && stageConstants?.[stage] || stageInitial;
6823
+ const stageConstant = `${preQualifyingAffix}${stageIndicator}${preQualifyingSequence}`;
6811
6824
  const roundProfileKeys = roundProfile ? Object.keys(roundProfile) : [];
6825
+ const qualifyingAffix = isQualifying && stageConstants?.[QUALIFYING] ? `${stageConstants?.[QUALIFYING]}-` : "";
6812
6826
  if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
6813
6827
  Object.assign(
6814
6828
  roundNamingProfile,
6815
6829
  ...roundProfileKeys.map((key) => {
6816
- const roundName = `${roundNameFallback} ${key}`;
6830
+ const roundName = `${qualifyingAffix}${roundNameFallback} ${key}`;
6817
6831
  const abbreviatedRoundName = `${roundNumberAffix}${key}`;
6818
6832
  return { [key]: { roundName, abbreviatedRoundName } };
6819
6833
  })
@@ -6826,15 +6840,15 @@ function getRoundContextProfile({
6826
6840
  return;
6827
6841
  const { matchUpsCount, preFeedRound } = roundProfile[round];
6828
6842
  const participantsCount = matchUpsCount * 2;
6829
- const sizedRoundName = roundNamingMap[matchUpsCount] || `${roundNamePrefix.roundNumber}${participantsCount}`;
6830
- const suffix = preFeedRound ? `-${roundNamePrefix.preFeedRound}` : "";
6843
+ const sizedRoundName = qualifyingFinishgMap?.[roundProfile?.[round].finishingRound] || qualifyingFinishgMap && `${roundNumberAffix}${participantsCount}` || roundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
6844
+ const suffix = preFeedRound ? `-${preFeedAffix}` : "";
6831
6845
  const profileRoundName = `${sizedRoundName}${suffix}`;
6832
6846
  const roundName = [
6833
6847
  stageConstant,
6834
6848
  structureAbbreviation,
6835
6849
  profileRoundName
6836
6850
  ].filter(Boolean).join("-");
6837
- const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNamePrefix.roundNumber}${participantsCount}`;
6851
+ const sizedAbbreviation = abbreviatedRoundNamingMap[matchUpsCount] || `${roundNumberAffix}${participantsCount}`;
6838
6852
  const profileAbbreviation = `${sizedAbbreviation}${suffix}`;
6839
6853
  const abbreviatedRoundName = [
6840
6854
  stageConstant,
@@ -7008,6 +7022,7 @@ function getAllStructureMatchUps({
7008
7022
  const roundNamingPolicy = appliedPolicies?.[POLICY_TYPE_ROUND_NAMING];
7009
7023
  const result = getRoundContextProfile({
7010
7024
  roundNamingPolicy,
7025
+ drawDefinition,
7011
7026
  structure,
7012
7027
  matchUps
7013
7028
  });