tods-competition-factory 1.8.43 → 1.8.44

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.
@@ -2138,17 +2138,18 @@ type RoundMatchUpsResult = {
2138
2138
  };
2139
2139
  declare function getRoundMatchUps({ matchUps, interpolate, }: GetRoundMatchUpsArgs): RoundMatchUpsResult;
2140
2140
 
2141
- /**
2142
- *
2143
- * @param {boolean} requireParticipantCount - whether or not to consider participantsCount
2144
- * @param {boolean} drawSizeProgression - drawSizeProgression indicates that rules for all smaller drawSizes should be considered
2145
- * @param {number} participantsCount - number of participants in draw structure // TODO: migrate to participantsCount
2146
- * @param {number} drawSize - number of positions available in draw structure
2147
- * @param {object} policyDefinitions - polictyDefinition object
2148
- * @param {object} drawDefinition - optional - retrieved automatically if drawId is provided
2149
- * @param {string} drawId - allows drawDefinition and event to be retrieved by tournamentEngine from tournament record
2150
- */
2151
- declare function getSeedsCount(params?: any): ResultType & {
2141
+ type GetSeedsCountArgs = {
2142
+ policyDefinitions?: PolicyDefinitions;
2143
+ requireParticipantCount?: boolean;
2144
+ drawSizeProgression?: boolean;
2145
+ tournamentRecord?: Tournament;
2146
+ drawDefinition?: DrawDefinition;
2147
+ participantsCount?: number;
2148
+ participantCount?: number;
2149
+ drawSize?: any;
2150
+ event?: Event;
2151
+ };
2152
+ declare function getSeedsCount(params: GetSeedsCountArgs): ResultType & {
2152
2153
  seedsCount?: number;
2153
2154
  };
2154
2155
 
@@ -10750,9 +10750,9 @@ function getSeedsCount(params) {
10750
10750
  }
10751
10751
  }
10752
10752
  const consideredParticipantCount = requireParticipantCount && participantsCount || drawSize;
10753
- if (consideredParticipantCount > drawSize)
10753
+ if (consideredParticipantCount && consideredParticipantCount > drawSize)
10754
10754
  return { error: PARTICIPANT_COUNT_EXCEEDS_DRAW_SIZE };
10755
- const policy = policyDefinitions[POLICY_TYPE_SEEDING];
10755
+ const policy = policyDefinitions?.[POLICY_TYPE_SEEDING];
10756
10756
  if (!policy)
10757
10757
  return { error: INVALID_POLICY_DEFINITION };
10758
10758
  const seedsCountThresholds = policy.seedsCountThresholds;
@@ -10764,7 +10764,7 @@ function getSeedsCount(params) {
10764
10764
  return drawSizeProgression ? threshold.drawSize <= drawSize : drawSize === threshold.drawSize;
10765
10765
  });
10766
10766
  const seedsCount = relevantThresholds.reduce((seedsCount2, threshold) => {
10767
- return participantsCount >= threshold.minimumParticipantCount ? threshold.seedsCount : seedsCount2;
10767
+ return participantsCount && participantsCount >= threshold.minimumParticipantCount ? threshold.seedsCount : seedsCount2;
10768
10768
  }, 0);
10769
10769
  return { seedsCount };
10770
10770
  }