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.
@@ -1411,6 +1411,8 @@ type GenerateDrawMaticRoundArgs = {
1411
1411
  salted?: number | boolean;
1412
1412
  participantIds?: string[];
1413
1413
  addToStructure?: boolean;
1414
+ encounterValue?: number;
1415
+ sameTeamValue?: number;
1414
1416
  maxIterations?: number;
1415
1417
  matchUpIds?: string[];
1416
1418
  structure?: Structure;
@@ -1419,12 +1421,14 @@ type GenerateDrawMaticRoundArgs = {
1419
1421
  scaleName?: string;
1420
1422
  drawId?: string;
1421
1423
  };
1422
- declare function generateDrawMaticRound({ maxIterations, generateMatchUps, tournamentParticipants, tournamentRecord, participantIds, addToStructure, drawDefinition, adHocRatings, structureId, salted, matchUpIds, eventType, structure, scaleName, }: GenerateDrawMaticRoundArgs): ResultType | {
1424
+ declare function generateDrawMaticRound({ encounterValue, sameTeamValue, maxIterations, generateMatchUps, tournamentParticipants, tournamentRecord, participantIds, addToStructure, drawDefinition, adHocRatings, structureId, salted, matchUpIds, eventType, structure, scaleName, }: GenerateDrawMaticRoundArgs): ResultType | {
1423
1425
  participantIdPairings: string[][];
1424
1426
  candidatesCount: number;
1425
1427
  matchUps: MatchUp[];
1426
1428
  iterations: number;
1427
1429
  success: boolean;
1430
+ maxDelta: number;
1431
+ maxDiff: number;
1428
1432
  };
1429
1433
 
1430
1434
  type DrawMaticArgs = {
@@ -1436,8 +1440,11 @@ type DrawMaticArgs = {
1436
1440
  drawDefinition?: DrawDefinition;
1437
1441
  tournamentRecord: Tournament;
1438
1442
  generateMatchUps?: boolean;
1439
- addToStructure?: boolean;
1443
+ salted?: number | boolean;
1440
1444
  participantIds?: string[];
1445
+ addToStructure?: boolean;
1446
+ encounterValue?: number;
1447
+ sameTeamValue?: number;
1441
1448
  maxIterations?: number;
1442
1449
  structure?: Structure;
1443
1450
  matchUpIds?: string[];
@@ -1576,14 +1576,15 @@ function getScaleValues({ participant }) {
1576
1576
  for (const itemType of itemTypes) {
1577
1577
  const scaleItem = latestScaleItem(itemType);
1578
1578
  if (scaleItem) {
1579
- const [, type, format, scaleName] = scaleItem.itemType.split(".");
1579
+ const [, type, format, scaleName, modifier] = scaleItem.itemType.split(".");
1580
+ const namedScale = modifier ? `${scaleName}.${modifier}` : scaleName;
1580
1581
  const scaleType = type === SEEDING && "seedings" || type === RANKING && "rankings" || "ratings";
1581
1582
  if (!scales[scaleType][format])
1582
1583
  scales[scaleType][format] = [];
1583
1584
  scales[scaleType][format].push({
1584
1585
  scaleValue: scaleItem.itemValue,
1585
1586
  scaleDate: scaleItem.itemDate,
1586
- scaleName
1587
+ scaleName: namedScale
1587
1588
  });
1588
1589
  }
1589
1590
  }
@@ -13936,7 +13937,7 @@ function treeMatchUps({
13936
13937
  uuids
13937
13938
  }));
13938
13939
  roundNumber++;
13939
- roundLimit = roundLimit || qualifyingRoundNumber || (qualifyingPositions ? drawSize / 2 / qualifyingPositions : void 0);
13940
+ roundLimit = roundLimit || qualifyingRoundNumber;
13940
13941
  while (roundNodes.length > 1) {
13941
13942
  if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
13942
13943
  roundLimit = roundNumber - 1;
@@ -20050,8 +20051,10 @@ function getPairings({
20050
20051
 
20051
20052
  const ENCOUNTER_VALUE = 100;
20052
20053
  const SAME_TEAM_VALUE = 100;
20053
- const MAX_ITERATIONS = 5e3;
20054
+ const MAX_ITERATIONS = 4e3;
20054
20055
  function generateDrawMaticRound({
20056
+ encounterValue = ENCOUNTER_VALUE,
20057
+ sameTeamValue = SAME_TEAM_VALUE,
20055
20058
  maxIterations = MAX_ITERATIONS,
20056
20059
  generateMatchUps = true,
20057
20060
  tournamentParticipants,
@@ -20084,7 +20087,7 @@ function generateDrawMaticRound({
20084
20087
  for (const pairing of encounters) {
20085
20088
  if (!valueObjects[pairing])
20086
20089
  valueObjects[pairing] = 0;
20087
- valueObjects[pairing] += ENCOUNTER_VALUE;
20090
+ valueObjects[pairing] += encounterValue;
20088
20091
  }
20089
20092
  const teamParticipants = tournamentParticipants?.filter(
20090
20093
  ({ participantType }) => participantType === TEAM
@@ -20096,7 +20099,7 @@ function generateDrawMaticRound({
20096
20099
  for (const pairing of uniquePairings2) {
20097
20100
  if (!valueObjects[pairing])
20098
20101
  valueObjects[pairing] = 0;
20099
- valueObjects[pairing] += SAME_TEAM_VALUE;
20102
+ valueObjects[pairing] += sameTeamValue;
20100
20103
  }
20101
20104
  }
20102
20105
  }
@@ -20118,7 +20121,7 @@ function generateDrawMaticRound({
20118
20121
  structure,
20119
20122
  salted
20120
20123
  };
20121
- const { candidatesCount, participantIdPairings, iterations } = getPairings(params);
20124
+ const { candidatesCount, participantIdPairings, iterations, candidate } = getPairings(params);
20122
20125
  if (!candidatesCount)
20123
20126
  return { error: NO_CANDIDATES };
20124
20127
  let matchUps;
@@ -20136,12 +20139,15 @@ function generateDrawMaticRound({
20136
20139
  return result;
20137
20140
  matchUps = result.matchUps;
20138
20141
  }
20142
+ const { maxDelta, maxDiff } = candidate;
20139
20143
  return {
20140
20144
  ...SUCCESS,
20141
20145
  participantIdPairings,
20142
20146
  candidatesCount,
20143
20147
  iterations,
20144
- matchUps
20148
+ matchUps,
20149
+ maxDelta,
20150
+ maxDiff
20145
20151
  };
20146
20152
  }
20147
20153
 
@@ -22680,10 +22686,12 @@ function drawMatic({
22680
22686
  tournamentParticipants,
22681
22687
  restrictEntryStatus,
22682
22688
  adHocRatings = {},
22683
- tournamentRecord,
22684
22689
  generateMatchUps,
22690
+ tournamentRecord,
22685
22691
  addToStructure,
22686
22692
  participantIds,
22693
+ encounterValue,
22694
+ sameTeamValue,
22687
22695
  drawDefinition,
22688
22696
  scaleAccessor,
22689
22697
  maxIterations,
@@ -22692,6 +22700,7 @@ function drawMatic({
22692
22700
  scaleName,
22693
22701
  // custom rating name to seed dynamic ratings
22694
22702
  eventType,
22703
+ salted,
22695
22704
  event
22696
22705
  }) {
22697
22706
  if (typeof drawDefinition !== "object" || drawDefinition.drawType && drawDefinition.drawType !== AD_HOC) {
@@ -22757,16 +22766,19 @@ function drawMatic({
22757
22766
  }
22758
22767
  return generateDrawMaticRound({
22759
22768
  tournamentParticipants,
22760
- tournamentRecord,
22761
22769
  generateMatchUps,
22762
- participantIds,
22770
+ tournamentRecord,
22763
22771
  addToStructure,
22772
+ participantIds,
22773
+ encounterValue,
22774
+ sameTeamValue,
22764
22775
  drawDefinition,
22765
22776
  maxIterations,
22766
22777
  adHocRatings,
22767
22778
  matchUpIds,
22768
22779
  structure,
22769
- eventType
22780
+ eventType,
22781
+ salted
22770
22782
  });
22771
22783
  }
22772
22784
  function getScaleValue({