tods-competition-factory 1.7.5 → 1.7.6

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.
@@ -3833,7 +3833,7 @@ const WIN_RATIO = "winRatio";
3833
3833
  const POLICY_COMPETITIVE_BANDS_DEFAULT = {
3834
3834
  [POLICY_TYPE_COMPETITIVE_BANDS]: {
3835
3835
  policyName: "Competitive Bands Default",
3836
- competitiveProfile: {
3836
+ profileBands: {
3837
3837
  [DECISIVE]: 20,
3838
3838
  [ROUTINE]: 50
3839
3839
  }
@@ -4922,11 +4922,11 @@ function gamesPercent(scoreComponents) {
4922
4922
  return Math.round(minGames / maxGames * 100);
4923
4923
  }
4924
4924
  function pctSpread(pcts) {
4925
- return pcts.map(gamesPercent).sort().map((p) => p.toFixed(2));
4925
+ return pcts.map(gamesPercent).sort().map((p) => parseFloat(p.toFixed(2)));
4926
4926
  }
4927
4927
 
4928
- function getMatchUpCompetitiveness({
4929
- competitiveProfile,
4928
+ function getMatchUpCompetitiveProfile({
4929
+ profileBands,
4930
4930
  tournamentRecord,
4931
4931
  matchUp
4932
4932
  }) {
@@ -4935,15 +4935,15 @@ function getMatchUpCompetitiveness({
4935
4935
  const { score, winningSide } = matchUp;
4936
4936
  if (!winningSide)
4937
4937
  return { error: INVALID_VALUES };
4938
- const policy = !competitiveProfile && tournamentRecord && findPolicy({
4938
+ const policy = !profileBands && tournamentRecord && findPolicy({
4939
4939
  policyType: POLICY_TYPE_COMPETITIVE_BANDS,
4940
4940
  tournamentRecord
4941
4941
  }).policy;
4942
- const bandProfiles = competitiveProfile || policy?.competitiveProfile || POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS].competitiveProfile;
4942
+ const bandProfiles = profileBands || policy?.profileBands || POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS].profileBands;
4943
4943
  const scoreComponents = getScoreComponents({ score });
4944
4944
  const spread = pctSpread([scoreComponents]);
4945
4945
  const competitiveness = getBand(spread, bandProfiles);
4946
- return { ...SUCCESS, competitiveness };
4946
+ return { ...SUCCESS, competitiveness, pctSpread: spread };
4947
4947
  }
4948
4948
 
4949
4949
  function findMatchupFormatAverageTimes(params) {
@@ -7167,7 +7167,7 @@ function getAllStructureMatchUps({
7167
7167
  ...collectionDefinition.category
7168
7168
  } : context?.category;
7169
7169
  const processCodes = matchUp.processCodes?.length && matchUp.processCodes || collectionDefinition?.processCodes?.length && collectionDefinition?.processCodes || structure?.processCodes?.length && structure?.processCodes || drawDefinition?.processCodes?.length && drawDefinition?.processCodes || event2?.processCodes?.length && event2?.processCodes || tournamentRecord?.processCodes;
7170
- const competitiveness = contextProfile?.withCompetitiveness && getMatchUpCompetitiveness({ ...contextContent, matchUp }).competitiveness;
7170
+ const competitiveProfile = contextProfile?.withCompetitiveness && getMatchUpCompetitiveProfile({ ...contextContent, matchUp });
7171
7171
  const finishingPositionRange = matchUp.finishingPositionRange || additionalContext.finishingPositionRange;
7172
7172
  const onlyDefined = (obj) => definedAttributes(obj, void 0, true);
7173
7173
  const matchUpWithContext = {
@@ -7183,7 +7183,7 @@ function getAllStructureMatchUps({
7183
7183
  finishingPositionRange,
7184
7184
  abbreviatedRoundName,
7185
7185
  drawPositionsRange,
7186
- competitiveness,
7186
+ competitiveProfile,
7187
7187
  structureName,
7188
7188
  stageSequence,
7189
7189
  drawPositions,
@@ -10334,8 +10334,8 @@ function getUpdatedSchedulingProfile({
10334
10334
  }
10335
10335
 
10336
10336
  function scheduledSortedMatchUps({
10337
- matchUps = [],
10338
- schedulingProfile
10337
+ schedulingProfile,
10338
+ matchUps = []
10339
10339
  }) {
10340
10340
  const profileHash = {};
10341
10341
  const getHash = ({ eventId, drawId, structureId, roundNumber }) => {