tods-competition-factory 2.0.40 → 2.0.42

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.
@@ -8716,6 +8716,17 @@ declare function checkSetIsComplete({ ignoreTiebreak, matchUpScoringFormat, matc
8716
8716
  info: string;
8717
8717
  };
8718
8718
 
8719
+ type AnalyzeScoreArgs = {
8720
+ existingMatchUpStatus?: string;
8721
+ matchUpStatus?: string;
8722
+ matchUpFormat?: string;
8723
+ winningSide?: number;
8724
+ score: Score;
8725
+ };
8726
+ declare function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, winningSide, score, }: AnalyzeScoreArgs): {
8727
+ valid: boolean;
8728
+ };
8729
+
8719
8730
  type ParseScoreArgs = {
8720
8731
  scoreString: string;
8721
8732
  tiebreakTo?: number;
@@ -8734,6 +8745,7 @@ declare function analyzeSet(params: any): {
8734
8745
  [key: string]: any;
8735
8746
  };
8736
8747
 
8748
+ declare const query_analyzeScore: typeof analyzeScore;
8737
8749
  declare const query_analyzeSet: typeof analyzeSet;
8738
8750
  declare const query_checkScoreHasValue: typeof checkScoreHasValue;
8739
8751
  declare const query_checkSetIsComplete: typeof checkSetIsComplete;
@@ -8744,13 +8756,14 @@ declare const query_parseScoreString: typeof parseScoreString;
8744
8756
  declare const query_validateScore: typeof validateScore;
8745
8757
  declare const query_validateTieFormat: typeof validateTieFormat;
8746
8758
  declare namespace query {
8747
- export { query_analyzeSet as analyzeSet, query_checkScoreHasValue as checkScoreHasValue, query_checkSetIsComplete as checkSetIsComplete, query_getSetComplement as getSetComplement, query_getTiebreakComplement as getTiebreakComplement, query_isValidMatchUpFormat as isValidMatchUpFormat, query_parseScoreString as parseScoreString, query_validateScore as validateScore, query_validateTieFormat as validateTieFormat };
8759
+ export { query_analyzeScore as analyzeScore, query_analyzeSet as analyzeSet, query_checkScoreHasValue as checkScoreHasValue, query_checkSetIsComplete as checkSetIsComplete, query_getSetComplement as getSetComplement, query_getTiebreakComplement as getTiebreakComplement, query_isValidMatchUpFormat as isValidMatchUpFormat, query_parseScoreString as parseScoreString, query_validateScore as validateScore, query_validateTieFormat as validateTieFormat };
8748
8760
  }
8749
8761
 
8750
8762
  declare const index$6_addGame: typeof addGame;
8751
8763
  declare const index$6_addPoint: typeof addPoint;
8752
8764
  declare const index$6_addSet: typeof addSet;
8753
8765
  declare const index$6_addShot: typeof addShot;
8766
+ declare const index$6_analyzeScore: typeof analyzeScore;
8754
8767
  declare const index$6_analyzeSet: typeof analyzeSet;
8755
8768
  declare const index$6_calculateHistoryScore: typeof calculateHistoryScore;
8756
8769
  declare const index$6_checkScoreHasValue: typeof checkScoreHasValue;
@@ -8773,7 +8786,7 @@ declare const index$6_undo: typeof undo;
8773
8786
  declare const index$6_validateScore: typeof validateScore;
8774
8787
  declare const index$6_validateTieFormat: typeof validateTieFormat;
8775
8788
  declare namespace index$6 {
8776
- export { index$6_addGame as addGame, index$6_addPoint as addPoint, index$6_addSet as addSet, index$6_addShot as addShot, index$6_analyzeSet as analyzeSet, index$6_calculateHistoryScore as calculateHistoryScore, index$6_checkScoreHasValue as checkScoreHasValue, index$6_checkSetIsComplete as checkSetIsComplete, index$6_clearHistory as clearHistory, generate$1 as generate, index$6_generateScoreString as generateScoreString, index$6_generateTieMatchUpScore as generateTieMatchUpScore, index$6_getSetComplement as getSetComplement, index$6_getTiebreakComplement as getTiebreakComplement, help as helpers, index$6_isValidMatchUpFormat as isValidMatchUpFormat, index$6_keyValueScore as keyValueScore, mutate$3 as mutate, parse as parseMatchUpFormat, index$6_parseScoreString as parseScoreString, index$6_query as query, index$6_redo as redo, index$6_reverseScore as reverseScore, index$6_setServingSide as setServingSide, stringify as stringifyMatchUpFormat, index$6_tidyScore as tidyScore, index$6_umo as umo, index$6_undo as undo, index$6_validateScore as validateScore, index$6_validateTieFormat as validateTieFormat };
8789
+ export { index$6_addGame as addGame, index$6_addPoint as addPoint, index$6_addSet as addSet, index$6_addShot as addShot, index$6_analyzeScore as analyzeScore, index$6_analyzeSet as analyzeSet, index$6_calculateHistoryScore as calculateHistoryScore, index$6_checkScoreHasValue as checkScoreHasValue, index$6_checkSetIsComplete as checkSetIsComplete, index$6_clearHistory as clearHistory, generate$1 as generate, index$6_generateScoreString as generateScoreString, index$6_generateTieMatchUpScore as generateTieMatchUpScore, index$6_getSetComplement as getSetComplement, index$6_getTiebreakComplement as getTiebreakComplement, help as helpers, index$6_isValidMatchUpFormat as isValidMatchUpFormat, index$6_keyValueScore as keyValueScore, mutate$3 as mutate, parse as parseMatchUpFormat, index$6_parseScoreString as parseScoreString, index$6_query as query, index$6_redo as redo, index$6_reverseScore as reverseScore, index$6_setServingSide as setServingSide, stringify as stringifyMatchUpFormat, index$6_tidyScore as tidyScore, index$6_umo as umo, index$6_undo as undo, index$6_validateScore as validateScore, index$6_validateTieFormat as validateTieFormat };
8777
8790
  }
8778
8791
 
8779
8792
  type ModifyCollectionDefinitionArgs = {
@@ -10602,15 +10615,16 @@ declare const fixtures: {
10602
10615
  };
10603
10616
  POLICY_SCORING_DEFAULT: {
10604
10617
  scoring: {
10618
+ processCodes: {
10619
+ incompleteAssignmentsOnDefault: string[];
10620
+ };
10605
10621
  defaultMatchUpFormat: string;
10606
10622
  allowDeletionWithScoresPresent: {
10607
10623
  drawDefinitions: boolean;
10608
10624
  structures: boolean;
10609
10625
  };
10610
10626
  requireAllPositionsAssigned: boolean;
10611
- processCodes: {
10612
- incompleteAssignmentsOnDefault: string[];
10613
- };
10627
+ allowChangePropagation: boolean;
10614
10628
  stage: {
10615
10629
  MAIN: {
10616
10630
  stageSequence: {
@@ -10849,6 +10863,7 @@ declare const extensionConstants: {
10849
10863
  DISABLED: string;
10850
10864
  DISABLE_LINKS: string;
10851
10865
  DISABLE_AUTO_CALC: string;
10866
+ DISPLAY: string;
10852
10867
  DRAW_DELETIONS: string;
10853
10868
  DRAW_PROFILE: string;
10854
10869
  ENTRY_PROFILE: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.40';
6
+ return '2.0.42';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -2712,6 +2712,7 @@ const DELEGATED_OUTCOME = 'delegatedOutcome';
2712
2712
  const DISABLED = 'disabled';
2713
2713
  const DISABLE_LINKS = 'disableLinks';
2714
2714
  const DISABLE_AUTO_CALC = 'disableAutoCalc';
2715
+ const DISPLAY = 'display';
2715
2716
  const DRAW_DELETIONS = 'drawDeletions';
2716
2717
  const DRAW_PROFILE = 'drawProfile';
2717
2718
  const ENTRY_PROFILE = 'entryProfile';
@@ -2743,6 +2744,7 @@ const extensionConstants = {
2743
2744
  DISABLED,
2744
2745
  DISABLE_LINKS,
2745
2746
  DISABLE_AUTO_CALC,
2747
+ DISPLAY,
2746
2748
  DRAW_DELETIONS,
2747
2749
  DRAW_PROFILE,
2748
2750
  ENTRY_PROFILE,
@@ -21072,9 +21074,9 @@ function modifyMatchUpScore(params) {
21072
21074
  }
21073
21075
 
21074
21076
  function attemptToModifyScore(params) {
21075
- const { dualWinningSideChange, matchUpStatusCodes, matchUpStatus, structure, matchUp } = params;
21077
+ const { matchUpStatusCodes, matchUpStatus, structure, matchUp, dualMatchUp } = params;
21076
21078
  const matchUpStatusIsValid = isDirectingMatchUpStatus({ matchUpStatus }) ||
21077
- ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualWinningSideChange);
21079
+ ([CANCELLED$1, ABANDONED$1].includes(matchUpStatus) && dualMatchUp);
21078
21080
  const stack = 'attemptToModifyScore';
21079
21081
  const isCollectionMatchUp = Boolean(matchUp.collectionId);
21080
21082
  const isAdHocMatchUp = isAdHoc({ structure });
@@ -21083,10 +21085,11 @@ function attemptToModifyScore(params) {
21083
21085
  return { error: MISSING_ASSIGNMENTS };
21084
21086
  }
21085
21087
  const removeScore = [WALKOVER$2].includes(matchUpStatus);
21088
+ const updatedMatchUpStatus = matchUpStatusIsValid ? matchUpStatus : (params.winningSide && COMPLETED$1) || INCOMPLETE;
21086
21089
  const result = modifyMatchUpScore({
21087
21090
  ...params,
21088
21091
  matchUpStatusCodes: (matchUpStatusIsValid && matchUpStatusCodes) || [],
21089
- matchUpStatus: (matchUpStatusIsValid && matchUpStatus) || COMPLETED$1,
21092
+ matchUpStatus: updatedMatchUpStatus,
21090
21093
  context: stack,
21091
21094
  removeScore,
21092
21095
  });
@@ -30311,6 +30314,7 @@ function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, win
30311
30314
  const matchUpScoringFormat = matchUpFormat ? parse(matchUpFormat) : undefined;
30312
30315
  const maxSetsCount = Math.max(...setsWinCounts);
30313
30316
  const maxSetsInstances = instanceCount(setsWinCounts)[maxSetsCount];
30317
+ const timed = matchUpScoringFormat?.setFormat?.timed || matchUpScoringFormat?.finalSetFormat?.timed;
30314
30318
  const bestOf = matchUpScoringFormat?.bestOf;
30315
30319
  const setsToWin = (bestOf && Math.ceil(bestOf / 2)) || 1;
30316
30320
  const relevantMatchUpStatus = matchUpStatus ?? existingMatchUpStatus;
@@ -30347,10 +30351,13 @@ function analyzeScore({ existingMatchUpStatus, matchUpFormat, matchUpStatus, win
30347
30351
  maxSetsInstances === 1 &&
30348
30352
  setsWinCounts.indexOf(maxSetsCount) + 1) ||
30349
30353
  undefined;
30350
- const valid = validSets &&
30354
+ const valid = !!(validSets &&
30351
30355
  ((winningSide && winningSideSetsCount > losingSideSetsCount && winningSide === calculatedWinningSide) ||
30352
- (!winningSide && !calculatedWinningSide) ||
30353
- irregularEnding);
30356
+ (winningSide && irregularEnding) ||
30357
+ (!winningSide &&
30358
+ !calculatedWinningSide &&
30359
+ (![COMPLETED$1, DEFAULTED, RETIRED$1, WALKOVER$2].includes(relevantMatchUpStatus) ||
30360
+ (timed && relevantMatchUpStatus === COMPLETED$1)))));
30354
30361
  return { valid };
30355
30362
  }
30356
30363
 
@@ -30760,6 +30767,7 @@ function checkValidTiebreakSetOutcome({ setObject, setFormat, sideTiebreakScores
30760
30767
 
30761
30768
  var query$a = {
30762
30769
  __proto__: null,
30770
+ analyzeScore: analyzeScore,
30763
30771
  analyzeSet: analyzeSet,
30764
30772
  checkScoreHasValue: checkScoreHasValue,
30765
30773
  checkSetIsComplete: checkSetIsComplete,
@@ -30777,6 +30785,7 @@ var scoreGovernor = {
30777
30785
  addPoint: addPoint,
30778
30786
  addSet: addSet,
30779
30787
  addShot: addShot,
30788
+ analyzeScore: analyzeScore,
30780
30789
  analyzeSet: analyzeSet,
30781
30790
  calculateHistoryScore: calculateHistoryScore,
30782
30791
  checkScoreHasValue: checkScoreHasValue,
@@ -34113,6 +34122,7 @@ function getDrawData(params) {
34113
34122
  drawType,
34114
34123
  drawId,
34115
34124
  }))(drawDefinition);
34125
+ drawInfo.display = findExtension({ element: drawDefinition, name: DISPLAY }).extension?.value;
34116
34126
  let mainStageSeedAssignments, qualificationStageSeedAssignments;
34117
34127
  const { allStructuresLinked, sourceStructureIds, hasDrawFeedProfile, structureGroups } = getStructureGroups({
34118
34128
  drawDefinition,
@@ -34169,14 +34179,11 @@ function getDrawData(params) {
34169
34179
  structure,
34170
34180
  });
34171
34181
  let participantResults = positionAssignments?.filter(xa(PARTICIPANT_ID)).map((assignment) => {
34182
+ const participantResult = findExtension({ element: assignment, name: TALLY })?.extension?.value;
34172
34183
  const { drawPosition, participantId } = assignment;
34173
- const { extension } = findExtension({
34174
- element: assignment,
34175
- name: TALLY,
34176
- });
34177
34184
  participantPlacements = true;
34178
34185
  return {
34179
- participantResult: extension?.value,
34186
+ participantResult,
34180
34187
  participantId,
34181
34188
  drawPosition,
34182
34189
  };
@@ -34209,6 +34216,7 @@ function getDrawData(params) {
34209
34216
  stage,
34210
34217
  }))(structure)
34211
34218
  : {};
34219
+ structureInfo.display = findExtension({ element: structure, name: DISPLAY }).extension?.value;
34212
34220
  structureInfo.sourceStructureIds = sourceStructureIds[structureId];
34213
34221
  structureInfo.hasDrawFeedProfile = hasDrawFeedProfile[structureId];
34214
34222
  structureInfo.positionAssignments = positionAssignments;
@@ -34390,6 +34398,10 @@ function getEventData(params) {
34390
34398
  ballType,
34391
34399
  discipline,
34392
34400
  }))(event);
34401
+ eventInfo.display = findExtension({
34402
+ element: event,
34403
+ name: DISPLAY,
34404
+ }).extension?.value;
34393
34405
  const eventData = {
34394
34406
  tournamentInfo,
34395
34407
  venuesData,
@@ -44185,7 +44197,8 @@ function setMatchUpStatus(params) {
44185
44197
  params.drawDefinition = result.drawDefinition;
44186
44198
  params.event = result.event;
44187
44199
  }
44188
- const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpFormat, matchUpId, schedule, event, notes, } = params;
44200
+ const { disableScoreValidation, policyDefinitions, tournamentRecord, disableAutoCalc, enableAutoCalc, drawDefinition, matchUpId, schedule, event, notes, } = params;
44201
+ const matchUpFormat = params.matchUpFormat || params.outcome?.matchUpFormat;
44189
44202
  const { policy } = findPolicy({
44190
44203
  policyType: POLICY_TYPE_SCORING,
44191
44204
  tournamentRecord,
@@ -47485,12 +47498,12 @@ var namesData = [
47485
47498
  "Sandeaters",
47486
47499
  "Sun Seekers",
47487
47500
  "Slicer Dicers",
47488
- "Sparkle Soul Tribe",
47489
47501
  "Stacked Deck",
47490
47502
  "Cross Stringers",
47491
47503
  "The Emergence",
47492
47504
  "Total Demolition",
47493
47505
  "Touch and Go",
47506
+ "Unreturnables",
47494
47507
  "Upside Downers",
47495
47508
  "Vertically Challenged",
47496
47509
  "Visual Spectacle"
@@ -49707,10 +49720,13 @@ function processLeagueProfiles(params) {
49707
49720
  const mockTournamentNames = [
49708
49721
  'Generated Tournament',
49709
49722
  'CourtHive Challenge',
49723
+ 'Replication Crisis',
49710
49724
  'Open Competition',
49711
49725
  'Factory Follies',
49712
49726
  'Mock Tournament',
49727
+ 'Atomic Culture',
49713
49728
  'Racket Rally',
49729
+ 'Stats Fail',
49714
49730
  ];
49715
49731
  function generateTournamentRecord(params) {
49716
49732
  let { startDate, endDate } = params ?? {};
@@ -57721,15 +57737,14 @@ const POLICY_PRIVACY_DEFAULT = {
57721
57737
 
57722
57738
  const POLICY_SCORING_DEFAULT = {
57723
57739
  [POLICY_TYPE_SCORING]: {
57740
+ processCodes: { incompleteAssignmentsOnDefault: ['RANKING.IGNORE'] },
57724
57741
  defaultMatchUpFormat: FORMAT_STANDARD,
57725
57742
  allowDeletionWithScoresPresent: {
57726
57743
  drawDefinitions: false,
57727
57744
  structures: false,
57728
57745
  },
57729
57746
  requireAllPositionsAssigned: false,
57730
- processCodes: {
57731
- incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
57732
- },
57747
+ allowChangePropagation: false,
57733
57748
  stage: {
57734
57749
  [MAIN]: {
57735
57750
  stageSequence: {