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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.7.4';
365
+ return '1.7.5';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -5552,7 +5552,8 @@ function getScaleValues(_a) {
5552
5552
  var itemType = itemTypes_1_1.value;
5553
5553
  var scaleItem = latestScaleItem(itemType);
5554
5554
  if (scaleItem) {
5555
- var _d = __read(scaleItem.itemType.split('.'), 4), type = _d[1], format = _d[2], scaleName = _d[3];
5555
+ var _d = __read(scaleItem.itemType.split('.'), 5), type = _d[1], format = _d[2], scaleName = _d[3], modifier = _d[4];
5556
+ var namedScale = modifier ? "".concat(scaleName, ".").concat(modifier) : scaleName;
5556
5557
  var scaleType = (type === SEEDING$1 && 'seedings') ||
5557
5558
  (type === RANKING$1 && 'rankings') ||
5558
5559
  'ratings';
@@ -5561,7 +5562,7 @@ function getScaleValues(_a) {
5561
5562
  scales[scaleType][format].push({
5562
5563
  scaleValue: scaleItem.itemValue,
5563
5564
  scaleDate: scaleItem.itemDate,
5564
- scaleName: scaleName,
5565
+ scaleName: namedScale,
5565
5566
  });
5566
5567
  }
5567
5568
  }
@@ -42142,10 +42143,7 @@ function treeMatchUps(_a) {
42142
42143
  uuids: uuids,
42143
42144
  }), roundNodes = _b.roundNodes, matchUps = _b.matchUps);
42144
42145
  roundNumber++;
42145
- roundLimit =
42146
- roundLimit ||
42147
- qualifyingRoundNumber ||
42148
- (qualifyingPositions ? drawSize / 2 / qualifyingPositions : undefined);
42146
+ roundLimit = roundLimit || qualifyingRoundNumber;
42149
42147
  while (roundNodes.length > 1) {
42150
42148
  if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
42151
42149
  roundLimit = roundNumber - 1;
@@ -50848,11 +50846,11 @@ function getPairings(_a) {
50848
50846
  // this should be in policyDefinitions
50849
50847
  var ENCOUNTER_VALUE = 100;
50850
50848
  var SAME_TEAM_VALUE = 100;
50851
- var MAX_ITERATIONS = 5000;
50849
+ var MAX_ITERATIONS = 4000;
50852
50850
  function generateDrawMaticRound(_a) {
50853
50851
  var e_1, _b, e_2, _c, e_3, _d;
50854
50852
  var _e, _f;
50855
- var _g = _a.maxIterations, maxIterations = _g === void 0 ? MAX_ITERATIONS : _g, _h = _a.generateMatchUps, generateMatchUps = _h === void 0 ? true : _h, tournamentParticipants = _a.tournamentParticipants, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds, addToStructure = _a.addToStructure, drawDefinition = _a.drawDefinition, adHocRatings = _a.adHocRatings, structureId = _a.structureId, _j = _a.salted, salted = _j === void 0 ? 0.5 : _j, matchUpIds = _a.matchUpIds, eventType = _a.eventType, structure = _a.structure, scaleName = _a.scaleName;
50853
+ var _g = _a.encounterValue, encounterValue = _g === void 0 ? ENCOUNTER_VALUE : _g, _h = _a.sameTeamValue, sameTeamValue = _h === void 0 ? SAME_TEAM_VALUE : _h, _j = _a.maxIterations, maxIterations = _j === void 0 ? MAX_ITERATIONS : _j, _k = _a.generateMatchUps, generateMatchUps = _k === void 0 ? true : _k, tournamentParticipants = _a.tournamentParticipants, tournamentRecord = _a.tournamentRecord, participantIds = _a.participantIds, addToStructure = _a.addToStructure, drawDefinition = _a.drawDefinition, adHocRatings = _a.adHocRatings, structureId = _a.structureId, _l = _a.salted, salted = _l === void 0 ? 0.5 : _l, matchUpIds = _a.matchUpIds, eventType = _a.eventType, structure = _a.structure, scaleName = _a.scaleName;
50856
50854
  if (!drawDefinition)
50857
50855
  return { error: MISSING_DRAW_DEFINITION };
50858
50856
  if (!structure && !structureId)
@@ -50879,7 +50877,7 @@ function generateDrawMaticRound(_a) {
50879
50877
  var pairing = encounters_1_1.value;
50880
50878
  if (!valueObjects[pairing])
50881
50879
  valueObjects[pairing] = 0;
50882
- valueObjects[pairing] += ENCOUNTER_VALUE;
50880
+ valueObjects[pairing] += encounterValue;
50883
50881
  }
50884
50882
  }
50885
50883
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -50905,7 +50903,7 @@ function generateDrawMaticRound(_a) {
50905
50903
  var pairing = uniquePairings_1_1.value;
50906
50904
  if (!valueObjects[pairing])
50907
50905
  valueObjects[pairing] = 0;
50908
- valueObjects[pairing] += SAME_TEAM_VALUE;
50906
+ valueObjects[pairing] += sameTeamValue;
50909
50907
  }
50910
50908
  }
50911
50909
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -50931,9 +50929,9 @@ function generateDrawMaticRound(_a) {
50931
50929
  // 'P-I-0|P-I-2': 0,
50932
50930
  // 'P-I-0|P-I-3': 0
50933
50931
  // }
50934
- var _k = getPairingsData({
50932
+ var _m = getPairingsData({
50935
50933
  participantIds: participantIds,
50936
- }), uniquePairings = _k.uniquePairings, possiblePairings = _k.possiblePairings, deltaObjects = _k.deltaObjects;
50934
+ }), uniquePairings = _m.uniquePairings, possiblePairings = _m.possiblePairings, deltaObjects = _m.deltaObjects;
50937
50935
  var params = {
50938
50936
  tournamentParticipants: tournamentParticipants,
50939
50937
  possiblePairings: possiblePairings,
@@ -50949,8 +50947,7 @@ function generateDrawMaticRound(_a) {
50949
50947
  structure: structure,
50950
50948
  salted: salted,
50951
50949
  };
50952
- var _l = getPairings(params), candidatesCount = _l.candidatesCount, participantIdPairings = _l.participantIdPairings, iterations = _l.iterations;
50953
- // console.log({ candidatesCount, participantIdPairings, iterations });
50950
+ var _o = getPairings(params), candidatesCount = _o.candidatesCount, participantIdPairings = _o.participantIdPairings, iterations = _o.iterations, candidate = _o.candidate;
50954
50951
  if (!candidatesCount)
50955
50952
  return { error: NO_CANDIDATES };
50956
50953
  var matchUps;
@@ -50968,14 +50965,15 @@ function generateDrawMaticRound(_a) {
50968
50965
  return result;
50969
50966
  matchUps = result.matchUps;
50970
50967
  }
50971
- return __assign(__assign({}, SUCCESS), { participantIdPairings: participantIdPairings, candidatesCount: candidatesCount, iterations: iterations, matchUps: matchUps });
50968
+ var maxDelta = candidate.maxDelta, maxDiff = candidate.maxDiff;
50969
+ return __assign(__assign({}, SUCCESS), { participantIdPairings: participantIdPairings, candidatesCount: candidatesCount, iterations: iterations, matchUps: matchUps, maxDelta: maxDelta, maxDiff: maxDiff });
50972
50970
  }
50973
50971
 
50974
50972
  function drawMatic$1(_a) {
50975
50973
  var e_1, _b;
50976
50974
  var _c, _d, _e, _f, _g;
50977
- var tournamentParticipants = _a.tournamentParticipants, restrictEntryStatus = _a.restrictEntryStatus, _h = _a.adHocRatings, adHocRatings = _h === void 0 ? {} : _h, tournamentRecord = _a.tournamentRecord, generateMatchUps = _a.generateMatchUps, addToStructure = _a.addToStructure, participantIds = _a.participantIds, drawDefinition = _a.drawDefinition, scaleAccessor = _a.scaleAccessor, maxIterations = _a.maxIterations, structureId = _a.structureId, matchUpIds = _a.matchUpIds, scaleName = _a.scaleName, // custom rating name to seed dynamic ratings
50978
- eventType = _a.eventType, event = _a.event;
50975
+ var tournamentParticipants = _a.tournamentParticipants, restrictEntryStatus = _a.restrictEntryStatus, _h = _a.adHocRatings, adHocRatings = _h === void 0 ? {} : _h, generateMatchUps = _a.generateMatchUps, tournamentRecord = _a.tournamentRecord, addToStructure = _a.addToStructure, participantIds = _a.participantIds, encounterValue = _a.encounterValue, sameTeamValue = _a.sameTeamValue, drawDefinition = _a.drawDefinition, scaleAccessor = _a.scaleAccessor, maxIterations = _a.maxIterations, structureId = _a.structureId, matchUpIds = _a.matchUpIds, scaleName = _a.scaleName, // custom rating name to seed dynamic ratings
50976
+ eventType = _a.eventType, salted = _a.salted, event = _a.event;
50979
50977
  if (typeof drawDefinition !== 'object' ||
50980
50978
  (drawDefinition.drawType && drawDefinition.drawType !== AD_HOC)) {
50981
50979
  return { error: INVALID_DRAW_DEFINITION };
@@ -51062,16 +51060,19 @@ function drawMatic$1(_a) {
51062
51060
  // use scaleEngine.generateDynamicRatings(); see dynamicCalculations.test.ts
51063
51061
  return generateDrawMaticRound({
51064
51062
  tournamentParticipants: tournamentParticipants,
51065
- tournamentRecord: tournamentRecord,
51066
51063
  generateMatchUps: generateMatchUps,
51067
- participantIds: participantIds,
51064
+ tournamentRecord: tournamentRecord,
51068
51065
  addToStructure: addToStructure,
51066
+ participantIds: participantIds,
51067
+ encounterValue: encounterValue,
51068
+ sameTeamValue: sameTeamValue,
51069
51069
  drawDefinition: drawDefinition,
51070
51070
  maxIterations: maxIterations,
51071
51071
  adHocRatings: adHocRatings,
51072
51072
  matchUpIds: matchUpIds,
51073
51073
  structure: structure,
51074
51074
  eventType: eventType,
51075
+ salted: salted,
51075
51076
  });
51076
51077
  }
51077
51078
  function getScaleValue(_a) {