tods-competition-factory 1.7.4 → 1.7.5

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.
package/dist/index.mjs CHANGED
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
333
333
  };
334
334
 
335
335
  function factoryVersion() {
336
- return "1.7.4";
336
+ return "1.7.5";
337
337
  }
338
338
 
339
339
  function getObjectTieFormat(obj) {
@@ -4429,14 +4429,15 @@ function getScaleValues({ participant }) {
4429
4429
  for (const itemType of itemTypes) {
4430
4430
  const scaleItem = latestScaleItem(itemType);
4431
4431
  if (scaleItem) {
4432
- const [, type, format, scaleName] = scaleItem.itemType.split(".");
4432
+ const [, type, format, scaleName, modifier] = scaleItem.itemType.split(".");
4433
+ const namedScale = modifier ? `${scaleName}.${modifier}` : scaleName;
4433
4434
  const scaleType = type === SEEDING$1 && "seedings" || type === RANKING$1 && "rankings" || "ratings";
4434
4435
  if (!scales[scaleType][format])
4435
4436
  scales[scaleType][format] = [];
4436
4437
  scales[scaleType][format].push({
4437
4438
  scaleValue: scaleItem.itemValue,
4438
4439
  scaleDate: scaleItem.itemDate,
4439
- scaleName
4440
+ scaleName: namedScale
4440
4441
  });
4441
4442
  }
4442
4443
  }
@@ -38822,7 +38823,7 @@ function treeMatchUps({
38822
38823
  uuids
38823
38824
  }));
38824
38825
  roundNumber++;
38825
- roundLimit = roundLimit || qualifyingRoundNumber || (qualifyingPositions ? drawSize / 2 / qualifyingPositions : void 0);
38826
+ roundLimit = roundLimit || qualifyingRoundNumber;
38826
38827
  while (roundNodes.length > 1) {
38827
38828
  if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
38828
38829
  roundLimit = roundNumber - 1;
@@ -46996,8 +46997,10 @@ function getPairings({
46996
46997
 
46997
46998
  const ENCOUNTER_VALUE = 100;
46998
46999
  const SAME_TEAM_VALUE = 100;
46999
- const MAX_ITERATIONS = 5e3;
47000
+ const MAX_ITERATIONS = 4e3;
47000
47001
  function generateDrawMaticRound({
47002
+ encounterValue = ENCOUNTER_VALUE,
47003
+ sameTeamValue = SAME_TEAM_VALUE,
47001
47004
  maxIterations = MAX_ITERATIONS,
47002
47005
  generateMatchUps = true,
47003
47006
  tournamentParticipants,
@@ -47030,7 +47033,7 @@ function generateDrawMaticRound({
47030
47033
  for (const pairing of encounters) {
47031
47034
  if (!valueObjects[pairing])
47032
47035
  valueObjects[pairing] = 0;
47033
- valueObjects[pairing] += ENCOUNTER_VALUE;
47036
+ valueObjects[pairing] += encounterValue;
47034
47037
  }
47035
47038
  const teamParticipants = tournamentParticipants?.filter(
47036
47039
  ({ participantType }) => participantType === TEAM
@@ -47042,7 +47045,7 @@ function generateDrawMaticRound({
47042
47045
  for (const pairing of uniquePairings2) {
47043
47046
  if (!valueObjects[pairing])
47044
47047
  valueObjects[pairing] = 0;
47045
- valueObjects[pairing] += SAME_TEAM_VALUE;
47048
+ valueObjects[pairing] += sameTeamValue;
47046
47049
  }
47047
47050
  }
47048
47051
  }
@@ -47064,7 +47067,7 @@ function generateDrawMaticRound({
47064
47067
  structure,
47065
47068
  salted
47066
47069
  };
47067
- const { candidatesCount, participantIdPairings, iterations } = getPairings(params);
47070
+ const { candidatesCount, participantIdPairings, iterations, candidate } = getPairings(params);
47068
47071
  if (!candidatesCount)
47069
47072
  return { error: NO_CANDIDATES };
47070
47073
  let matchUps;
@@ -47082,12 +47085,15 @@ function generateDrawMaticRound({
47082
47085
  return result;
47083
47086
  matchUps = result.matchUps;
47084
47087
  }
47088
+ const { maxDelta, maxDiff } = candidate;
47085
47089
  return {
47086
47090
  ...SUCCESS,
47087
47091
  participantIdPairings,
47088
47092
  candidatesCount,
47089
47093
  iterations,
47090
- matchUps
47094
+ matchUps,
47095
+ maxDelta,
47096
+ maxDiff
47091
47097
  };
47092
47098
  }
47093
47099
 
@@ -47095,10 +47101,12 @@ function drawMatic$1({
47095
47101
  tournamentParticipants,
47096
47102
  restrictEntryStatus,
47097
47103
  adHocRatings = {},
47098
- tournamentRecord,
47099
47104
  generateMatchUps,
47105
+ tournamentRecord,
47100
47106
  addToStructure,
47101
47107
  participantIds,
47108
+ encounterValue,
47109
+ sameTeamValue,
47102
47110
  drawDefinition,
47103
47111
  scaleAccessor,
47104
47112
  maxIterations,
@@ -47107,6 +47115,7 @@ function drawMatic$1({
47107
47115
  scaleName,
47108
47116
  // custom rating name to seed dynamic ratings
47109
47117
  eventType,
47118
+ salted,
47110
47119
  event
47111
47120
  }) {
47112
47121
  if (typeof drawDefinition !== "object" || drawDefinition.drawType && drawDefinition.drawType !== AD_HOC) {
@@ -47172,16 +47181,19 @@ function drawMatic$1({
47172
47181
  }
47173
47182
  return generateDrawMaticRound({
47174
47183
  tournamentParticipants,
47175
- tournamentRecord,
47176
47184
  generateMatchUps,
47177
- participantIds,
47185
+ tournamentRecord,
47178
47186
  addToStructure,
47187
+ participantIds,
47188
+ encounterValue,
47189
+ sameTeamValue,
47179
47190
  drawDefinition,
47180
47191
  maxIterations,
47181
47192
  adHocRatings,
47182
47193
  matchUpIds,
47183
47194
  structure,
47184
- eventType
47195
+ eventType,
47196
+ salted
47185
47197
  });
47186
47198
  }
47187
47199
  function getScaleValue({