tods-competition-factory 1.7.4 → 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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.7.4';
365
+ return '1.7.6';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -5289,7 +5289,7 @@ var _a$j, _b$6;
5289
5289
  var POLICY_COMPETITIVE_BANDS_DEFAULT = (_a$j = {},
5290
5290
  _a$j[POLICY_TYPE_COMPETITIVE_BANDS] = {
5291
5291
  policyName: 'Competitive Bands Default',
5292
- competitiveProfile: (_b$6 = {},
5292
+ profileBands: (_b$6 = {},
5293
5293
  _b$6[DECISIVE] = 20,
5294
5294
  _b$6[ROUTINE] = 50,
5295
5295
  _b$6),
@@ -5374,7 +5374,7 @@ function pctSpread(pcts) {
5374
5374
  return pcts
5375
5375
  .map(gamesPercent)
5376
5376
  .sort()
5377
- .map(function (p) { return p.toFixed(2); });
5377
+ .map(function (p) { return parseFloat(p.toFixed(2)); });
5378
5378
  }
5379
5379
 
5380
5380
  function findPolicy(_a) {
@@ -5392,27 +5392,27 @@ function findPolicy(_a) {
5392
5392
  : { error: POLICY_NOT_FOUND };
5393
5393
  }
5394
5394
 
5395
- function getMatchUpCompetitiveness(_a) {
5396
- var competitiveProfile = _a.competitiveProfile, tournamentRecord = _a.tournamentRecord, matchUp = _a.matchUp;
5395
+ function getMatchUpCompetitiveProfile(_a) {
5396
+ var profileBands = _a.profileBands, tournamentRecord = _a.tournamentRecord, matchUp = _a.matchUp;
5397
5397
  if (!matchUp)
5398
5398
  return { error: MISSING_MATCHUP };
5399
5399
  var score = matchUp.score, winningSide = matchUp.winningSide;
5400
5400
  if (!winningSide)
5401
5401
  return { error: INVALID_VALUES };
5402
- var policy = !competitiveProfile &&
5402
+ var policy = !profileBands &&
5403
5403
  tournamentRecord &&
5404
5404
  findPolicy({
5405
5405
  policyType: POLICY_TYPE_COMPETITIVE_BANDS,
5406
5406
  tournamentRecord: tournamentRecord,
5407
5407
  }).policy;
5408
- var bandProfiles = competitiveProfile ||
5409
- (policy === null || policy === void 0 ? void 0 : policy.competitiveProfile) ||
5408
+ var bandProfiles = profileBands ||
5409
+ (policy === null || policy === void 0 ? void 0 : policy.profileBands) ||
5410
5410
  POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS]
5411
- .competitiveProfile;
5411
+ .profileBands;
5412
5412
  var scoreComponents = getScoreComponents({ score: score });
5413
5413
  var spread = pctSpread([scoreComponents]);
5414
5414
  var competitiveness = getBand(spread, bandProfiles);
5415
- return __assign(__assign({}, SUCCESS), { competitiveness: competitiveness });
5415
+ return __assign(__assign({}, SUCCESS), { competitiveness: competitiveness, pctSpread: spread });
5416
5416
  }
5417
5417
 
5418
5418
  function findMatchupFormatAverageTimes(params) {
@@ -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
  }
@@ -9435,8 +9436,8 @@ function getAllStructureMatchUps(_a) {
9435
9436
  (((_m = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.processCodes) === null || _m === void 0 ? void 0 : _m.length) && (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.processCodes)) ||
9436
9437
  (((_o = event === null || event === void 0 ? void 0 : event.processCodes) === null || _o === void 0 ? void 0 : _o.length) && (event === null || event === void 0 ? void 0 : event.processCodes)) ||
9437
9438
  (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.processCodes);
9438
- var competitiveness = (contextProfile === null || contextProfile === void 0 ? void 0 : contextProfile.withCompetitiveness) &&
9439
- getMatchUpCompetitiveness(__assign(__assign({}, contextContent), { matchUp: matchUp })).competitiveness;
9439
+ var competitiveProfile = (contextProfile === null || contextProfile === void 0 ? void 0 : contextProfile.withCompetitiveness) &&
9440
+ getMatchUpCompetitiveProfile(__assign(__assign({}, contextContent), { matchUp: matchUp }));
9440
9441
  // necessry for SINGLES/DOUBLES matchUps that are part of TEAM tournaments
9441
9442
  var finishingPositionRange = matchUp.finishingPositionRange ||
9442
9443
  additionalContext.finishingPositionRange;
@@ -9455,7 +9456,7 @@ function getAllStructureMatchUps(_a) {
9455
9456
  finishingPositionRange: finishingPositionRange,
9456
9457
  abbreviatedRoundName: abbreviatedRoundName,
9457
9458
  drawPositionsRange: drawPositionsRange,
9458
- competitiveness: competitiveness,
9459
+ competitiveProfile: competitiveProfile,
9459
9460
  structureName: structureName,
9460
9461
  stageSequence: stageSequence,
9461
9462
  drawPositions: drawPositions,
@@ -14953,13 +14954,19 @@ var ratingConstants = {
14953
14954
 
14954
14955
  var _a$g;
14955
14956
  var ratingsParameters = (_a$g = {},
14956
- _a$g[ELO] = { range: [0, 3000], decimalsCount: 0, defaultInitialization: 1500 },
14957
+ _a$g[ELO] = {
14958
+ defaultInitialization: 1500,
14959
+ decimalsCount: 0,
14960
+ range: [0, 3000],
14961
+ ascending: true,
14962
+ },
14957
14963
  _a$g[NTRP] = {
14958
14964
  accessors: ['ntrpRating', 'dntrpRatingHundredths'],
14959
14965
  attributes: { ustaRatingType: '' },
14960
14966
  accessor: 'dntrpRatingHundredths',
14961
14967
  defaultInitialization: 3,
14962
14968
  decimalsCount: 1,
14969
+ ascending: true,
14963
14970
  range: [1, 7],
14964
14971
  },
14965
14972
  _a$g[UTR] = {
@@ -14967,6 +14974,7 @@ var ratingsParameters = (_a$g = {},
14967
14974
  accessors: ['utrRating'],
14968
14975
  accessor: 'utrRating',
14969
14976
  decimalsCount: 2,
14977
+ ascending: true,
14970
14978
  range: [1, 16],
14971
14979
  },
14972
14980
  _a$g[WTN] = {
@@ -14974,6 +14982,7 @@ var ratingsParameters = (_a$g = {},
14974
14982
  accessors: ['wtnRating', 'confidence'],
14975
14983
  defaultInitialization: 23,
14976
14984
  accessor: 'wtnRating',
14985
+ ascending: false,
14977
14986
  decimalsCount: 2,
14978
14987
  range: [40, 1],
14979
14988
  },
@@ -34843,7 +34852,7 @@ function checkSchedulingProfile$1(_a) {
34843
34852
 
34844
34853
  function scheduledSortedMatchUps(_a) {
34845
34854
  var e_1, _b, e_2, _c, e_3, _d, e_4, _e;
34846
- var _f = _a.matchUps, matchUps = _f === void 0 ? [] : _f, schedulingProfile = _a.schedulingProfile;
34855
+ var schedulingProfile = _a.schedulingProfile, _f = _a.matchUps, matchUps = _f === void 0 ? [] : _f;
34847
34856
  var profileHash = {};
34848
34857
  // hash is used to store a sort order value for scheduled rounds
34849
34858
  var getHash = function (_a) {
@@ -42142,10 +42151,7 @@ function treeMatchUps(_a) {
42142
42151
  uuids: uuids,
42143
42152
  }), roundNodes = _b.roundNodes, matchUps = _b.matchUps);
42144
42153
  roundNumber++;
42145
- roundLimit =
42146
- roundLimit ||
42147
- qualifyingRoundNumber ||
42148
- (qualifyingPositions ? drawSize / 2 / qualifyingPositions : undefined);
42154
+ roundLimit = roundLimit || qualifyingRoundNumber;
42149
42155
  while (roundNodes.length > 1) {
42150
42156
  if (qualifyingPositions && roundNodes.length === qualifyingPositions) {
42151
42157
  roundLimit = roundNumber - 1;
@@ -50545,6 +50551,10 @@ function removeDelegatedOutcome$1(_a) {
50545
50551
  });
50546
50552
  }
50547
50553
 
50554
+ function stringSort(a, b) {
50555
+ return (a || '').localeCompare(b || '');
50556
+ }
50557
+
50548
50558
  function generateCandidate(_a) {
50549
50559
  var _b = _a.maxIterations, maxIterations = _b === void 0 ? 4000 : _b, // cap the processing intensity of the candidate generator
50550
50560
  valueSortedPairings = _a.valueSortedPairings, // pairings sorted by value from low to high
@@ -50688,7 +50698,7 @@ function roundCandidate(_a) {
50688
50698
  return { value: candidateValue, participantIdPairings: participantIdPairings, maxDelta: maxDelta, maxDiff: maxDiff };
50689
50699
  }
50690
50700
  function pairingHash(id1, id2) {
50691
- return [id1, id2].sort().join('|');
50701
+ return [id1, id2].sort(stringSort).join('|');
50692
50702
  }
50693
50703
 
50694
50704
  function getPairingsData(_a) {
@@ -50848,11 +50858,11 @@ function getPairings(_a) {
50848
50858
  // this should be in policyDefinitions
50849
50859
  var ENCOUNTER_VALUE = 100;
50850
50860
  var SAME_TEAM_VALUE = 100;
50851
- var MAX_ITERATIONS = 5000;
50861
+ var MAX_ITERATIONS = 4000;
50852
50862
  function generateDrawMaticRound(_a) {
50853
50863
  var e_1, _b, e_2, _c, e_3, _d;
50854
50864
  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;
50865
+ 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
50866
  if (!drawDefinition)
50857
50867
  return { error: MISSING_DRAW_DEFINITION };
50858
50868
  if (!structure && !structureId)
@@ -50879,7 +50889,7 @@ function generateDrawMaticRound(_a) {
50879
50889
  var pairing = encounters_1_1.value;
50880
50890
  if (!valueObjects[pairing])
50881
50891
  valueObjects[pairing] = 0;
50882
- valueObjects[pairing] += ENCOUNTER_VALUE;
50892
+ valueObjects[pairing] += encounterValue;
50883
50893
  }
50884
50894
  }
50885
50895
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -50905,7 +50915,7 @@ function generateDrawMaticRound(_a) {
50905
50915
  var pairing = uniquePairings_1_1.value;
50906
50916
  if (!valueObjects[pairing])
50907
50917
  valueObjects[pairing] = 0;
50908
- valueObjects[pairing] += SAME_TEAM_VALUE;
50918
+ valueObjects[pairing] += sameTeamValue;
50909
50919
  }
50910
50920
  }
50911
50921
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
@@ -50931,9 +50941,9 @@ function generateDrawMaticRound(_a) {
50931
50941
  // 'P-I-0|P-I-2': 0,
50932
50942
  // 'P-I-0|P-I-3': 0
50933
50943
  // }
50934
- var _k = getPairingsData({
50944
+ var _m = getPairingsData({
50935
50945
  participantIds: participantIds,
50936
- }), uniquePairings = _k.uniquePairings, possiblePairings = _k.possiblePairings, deltaObjects = _k.deltaObjects;
50946
+ }), uniquePairings = _m.uniquePairings, possiblePairings = _m.possiblePairings, deltaObjects = _m.deltaObjects;
50937
50947
  var params = {
50938
50948
  tournamentParticipants: tournamentParticipants,
50939
50949
  possiblePairings: possiblePairings,
@@ -50949,8 +50959,7 @@ function generateDrawMaticRound(_a) {
50949
50959
  structure: structure,
50950
50960
  salted: salted,
50951
50961
  };
50952
- var _l = getPairings(params), candidatesCount = _l.candidatesCount, participantIdPairings = _l.participantIdPairings, iterations = _l.iterations;
50953
- // console.log({ candidatesCount, participantIdPairings, iterations });
50962
+ var _o = getPairings(params), candidatesCount = _o.candidatesCount, participantIdPairings = _o.participantIdPairings, iterations = _o.iterations, candidate = _o.candidate;
50954
50963
  if (!candidatesCount)
50955
50964
  return { error: NO_CANDIDATES };
50956
50965
  var matchUps;
@@ -50968,14 +50977,15 @@ function generateDrawMaticRound(_a) {
50968
50977
  return result;
50969
50978
  matchUps = result.matchUps;
50970
50979
  }
50971
- return __assign(__assign({}, SUCCESS), { participantIdPairings: participantIdPairings, candidatesCount: candidatesCount, iterations: iterations, matchUps: matchUps });
50980
+ var maxDelta = candidate.maxDelta, maxDiff = candidate.maxDiff;
50981
+ return __assign(__assign({}, SUCCESS), { participantIdPairings: participantIdPairings, candidatesCount: candidatesCount, iterations: iterations, matchUps: matchUps, maxDelta: maxDelta, maxDiff: maxDiff });
50972
50982
  }
50973
50983
 
50974
50984
  function drawMatic$1(_a) {
50975
50985
  var e_1, _b;
50976
50986
  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;
50987
+ 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
50988
+ eventType = _a.eventType, salted = _a.salted, event = _a.event;
50979
50989
  if (typeof drawDefinition !== 'object' ||
50980
50990
  (drawDefinition.drawType && drawDefinition.drawType !== AD_HOC)) {
50981
50991
  return { error: INVALID_DRAW_DEFINITION };
@@ -51062,16 +51072,19 @@ function drawMatic$1(_a) {
51062
51072
  // use scaleEngine.generateDynamicRatings(); see dynamicCalculations.test.ts
51063
51073
  return generateDrawMaticRound({
51064
51074
  tournamentParticipants: tournamentParticipants,
51065
- tournamentRecord: tournamentRecord,
51066
51075
  generateMatchUps: generateMatchUps,
51067
- participantIds: participantIds,
51076
+ tournamentRecord: tournamentRecord,
51068
51077
  addToStructure: addToStructure,
51078
+ participantIds: participantIds,
51079
+ encounterValue: encounterValue,
51080
+ sameTeamValue: sameTeamValue,
51069
51081
  drawDefinition: drawDefinition,
51070
51082
  maxIterations: maxIterations,
51071
51083
  adHocRatings: adHocRatings,
51072
51084
  matchUpIds: matchUpIds,
51073
51085
  structure: structure,
51074
51086
  eventType: eventType,
51087
+ salted: salted,
51075
51088
  });
51076
51089
  }
51077
51090
  function getScaleValue(_a) {
@@ -57364,6 +57377,30 @@ function setTournamentStatus(_a) {
57364
57377
  return __assign({}, SUCCESS);
57365
57378
  }
57366
57379
 
57380
+ // TODO: ability to add onlineResources to other items, e.g. organisations, participants, persons, venues, courts
57381
+ function addOnlineResource(_a) {
57382
+ var tournamentRecord = _a.tournamentRecord, onlineResource = _a.onlineResource;
57383
+ if (!tournamentRecord)
57384
+ return { error: MISSING_TOURNAMENT_RECORD };
57385
+ if (!onlineResource)
57386
+ return { error: MISSING_VALUE };
57387
+ if (!tournamentRecord.onlineResources)
57388
+ tournamentRecord.onlineResources = [];
57389
+ // TODO: onlineResource validation
57390
+ tournamentRecord.onlineResources.push(onlineResource);
57391
+ return __assign({}, SUCCESS);
57392
+ /**
57393
+ [
57394
+ {
57395
+ identifier:
57396
+ resourceSubType: 'IMAGE',
57397
+ name: 'tournamentImage',
57398
+ resourceType: 'URL',
57399
+ },
57400
+ ];
57401
+ */
57402
+ }
57403
+
57367
57404
  function analyzeDraws(_a) {
57368
57405
  var _b;
57369
57406
  var tournamentRecord = _a.tournamentRecord;
@@ -57721,10 +57758,11 @@ function removeInvalidScheduling(_a) {
57721
57758
 
57722
57759
  // undocumented access to mocksEngine method
57723
57760
  var tournamentGovernor = {
57724
- addNotes: addNotes,
57725
- removeNotes: removeNotes,
57726
- analyzeDraws: analyzeDraws,
57727
57761
  analyzeTournament: analyzeTournament,
57762
+ analyzeDraws: analyzeDraws,
57763
+ addOnlineResource: addOnlineResource,
57764
+ removeNotes: removeNotes,
57765
+ addNotes: addNotes,
57728
57766
  completeDrawMatchUps: completeDrawMatchUps,
57729
57767
  getRounds: getRounds,
57730
57768
  getProfileRounds: getProfileRounds,
@@ -63137,21 +63175,24 @@ function getMaxEntryPosition(params) {
63137
63175
  }
63138
63176
 
63139
63177
  function getPredictiveAccuracy(params) {
63140
- var _a, _b, _c, _d;
63178
+ var _a, _b, _c, _d, _e, _f, _g;
63141
63179
  var matchUps = params.matchUps;
63142
- var tournamentRecord = params.tournamentRecord, _e = params.ascending, ascending = _e === void 0 ? true : _e, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, valueAccessor = params.valueAccessor, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, zoneMargin = params.zoneMargin, scaleName = params.scaleName, eventId = params.eventId, drawId = params.drawId, event = params.event;
63180
+ var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, zoneMargin = params.zoneMargin, scaleName = params.scaleName, eventId = params.eventId, drawId = params.drawId, event = params.event;
63143
63181
  if (!tournamentRecord && !matchUps)
63144
63182
  return { error: MISSING_TOURNAMENT_RECORD };
63145
63183
  if (matchUpType && ![SINGLES$1, DOUBLES$1].includes(matchUpType))
63146
63184
  return { error: INVALID_VALUES, info: { matchUpType: matchUpType } };
63147
63185
  if (matchUps && !validMatchUps(matchUps))
63148
63186
  return { error: INVALID_VALUES, context: { matchUps: matchUps } };
63187
+ var scaleProfile = ratingsParameters[scaleName];
63188
+ var ascending = (_b = (_a = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.ascending) !== null && _a !== void 0 ? _a : params.ascending) !== null && _b !== void 0 ? _b : false;
63189
+ var valueAccessor = (_c = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.accessor) !== null && _c !== void 0 ? _c : params.valueAccessor;
63149
63190
  var contextProfile = { withScaleValues: true, withCompetitiveness: true };
63150
63191
  var contextFilters = {
63151
63192
  matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
63152
63193
  };
63153
63194
  var participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
63154
- if ((_a = matchUps === null || matchUps === void 0 ? void 0 : matchUps[0]) === null || _a === void 0 ? void 0 : _a.hasContext) {
63195
+ if ((_d = matchUps === null || matchUps === void 0 ? void 0 : matchUps[0]) === null || _d === void 0 ? void 0 : _d.hasContext) {
63155
63196
  if (drawId) {
63156
63197
  matchUps = matchUps.filter(function (matchUp) { return matchUp.drawId === drawId; });
63157
63198
  }
@@ -63164,27 +63205,27 @@ function getPredictiveAccuracy(params) {
63164
63205
  (drawId && !drawDefinition && []) ||
63165
63206
  (!drawId && eventId && !event && []) ||
63166
63207
  (drawId &&
63167
- ((_b = allDrawMatchUps$1({
63208
+ ((_e = allDrawMatchUps$1({
63168
63209
  inContext: true,
63169
63210
  drawDefinition: drawDefinition,
63170
63211
  contextFilters: contextFilters,
63171
63212
  contextProfile: contextProfile,
63172
63213
  participants: participants,
63173
- })) === null || _b === void 0 ? void 0 : _b.matchUps)) ||
63214
+ })) === null || _e === void 0 ? void 0 : _e.matchUps)) ||
63174
63215
  (!drawId &&
63175
63216
  eventId &&
63176
- ((_c = allEventMatchUps({
63217
+ ((_f = allEventMatchUps({
63177
63218
  inContext: true,
63178
63219
  contextFilters: contextFilters,
63179
63220
  contextProfile: contextProfile,
63180
63221
  participants: participants,
63181
63222
  event: event,
63182
- })) === null || _c === void 0 ? void 0 : _c.matchUps)) ||
63183
- ((_d = allTournamentMatchUps({
63223
+ })) === null || _f === void 0 ? void 0 : _f.matchUps)) ||
63224
+ ((_g = allTournamentMatchUps({
63184
63225
  tournamentRecord: tournamentRecord,
63185
63226
  contextFilters: contextFilters,
63186
63227
  contextProfile: contextProfile,
63187
- })) === null || _d === void 0 ? void 0 : _d.matchUps) ||
63228
+ })) === null || _g === void 0 ? void 0 : _g.matchUps) ||
63188
63229
  [];
63189
63230
  }
63190
63231
  if (matchUpType) {
@@ -63209,7 +63250,7 @@ function getPredictiveAccuracy(params) {
63209
63250
  var zoneData = zoneMargin &&
63210
63251
  relevantMatchUps
63211
63252
  .map(function (_a) {
63212
- var competitiveness = _a.competitiveness, matchUpType = _a.matchUpType, score = _a.score, sides = _a.sides;
63253
+ var competitiveProfile = _a.competitiveProfile, matchUpType = _a.matchUpType, score = _a.score, sides = _a.sides;
63213
63254
  var sideValues = getSideValues({
63214
63255
  valueAccessor: valueAccessor,
63215
63256
  matchUpType: matchUpType,
@@ -63217,7 +63258,11 @@ function getPredictiveAccuracy(params) {
63217
63258
  sides: sides,
63218
63259
  });
63219
63260
  var valuesGap = Math.abs(sideValues[0].value - sideValues[1].value);
63220
- return { competitiveness: competitiveness, score: score, valuesGap: valuesGap };
63261
+ return {
63262
+ competitiveness: competitiveProfile === null || competitiveProfile === void 0 ? void 0 : competitiveProfile.competitiveness,
63263
+ valuesGap: valuesGap,
63264
+ score: score,
63265
+ };
63221
63266
  })
63222
63267
  .filter(function (_a) {
63223
63268
  var valuesGap = _a.valuesGap;
@@ -63409,8 +63454,8 @@ function getGroupingAccuracy(_a) {
63409
63454
  });
63410
63455
  continue;
63411
63456
  }
63412
- // when ascending is true winning value will be less than losing value
63413
- var signedGap = ascending ? valuesGap * -1 : valuesGap;
63457
+ // when ascending is true winning value will be greater than losing value
63458
+ var signedGap = ascending ? valuesGap : valuesGap * -1;
63414
63459
  var winningScoreString = winningSide === 1 ? score === null || score === void 0 ? void 0 : score.scoreStringSide1 : score === null || score === void 0 ? void 0 : score.scoreStringSide2;
63415
63460
  if (signedGap > 0) {
63416
63461
  accuracy.affirmative.push({
@@ -63505,18 +63550,18 @@ function getMatchUpFormat(_a) {
63505
63550
 
63506
63551
  function getMatchUpsStats(_a) {
63507
63552
  var _b, _c;
63508
- var competitiveProfile = _a.competitiveProfile, tournamentRecord = _a.tournamentRecord, matchUps = _a.matchUps;
63553
+ var profileBands = _a.profileBands, tournamentRecord = _a.tournamentRecord, matchUps = _a.matchUps;
63509
63554
  if (!validMatchUps(matchUps))
63510
63555
  return { error: MISSING_MATCHUPS };
63511
- var policy = !competitiveProfile &&
63556
+ var policy = !profileBands &&
63512
63557
  findPolicy({
63513
63558
  policyType: POLICY_TYPE_COMPETITIVE_BANDS,
63514
63559
  tournamentRecord: tournamentRecord,
63515
63560
  }).policy;
63516
- var bandProfiles = competitiveProfile ||
63517
- (policy === null || policy === void 0 ? void 0 : policy.competitiveProfile) ||
63561
+ var bandProfiles = profileBands ||
63562
+ (policy === null || policy === void 0 ? void 0 : policy.profileBands) ||
63518
63563
  POLICY_COMPETITIVE_BANDS_DEFAULT[POLICY_TYPE_COMPETITIVE_BANDS]
63519
- .competitiveProfile;
63564
+ .profileBands;
63520
63565
  var relevantMatchUps = matchUps.filter(function (_a) {
63521
63566
  var winningSide = _a.winningSide;
63522
63567
  return winningSide;
@@ -63709,7 +63754,7 @@ var queryGovernor = {
63709
63754
  getPositionAssignments: getPositionAssignments,
63710
63755
  isValidMatchUpFormat: isValid,
63711
63756
  getMaxEntryPosition: getMaxEntryPosition,
63712
- getMatchUpCompetitiveness: getMatchUpCompetitiveness,
63757
+ getMatchUpCompetitiveProfile: getMatchUpCompetitiveProfile,
63713
63758
  findVenue: findVenue,
63714
63759
  getCourts: getCourts,
63715
63760
  getVenuesAndCourts: getVenuesAndCourts$1,