tods-competition-factory 1.8.27 → 1.8.29

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.
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
2929
2929
  };
2930
2930
 
2931
2931
  function factoryVersion() {
2932
- return '1.8.27';
2932
+ return '1.8.29';
2933
2933
  }
2934
2934
 
2935
2935
  function getObjectTieFormat(obj) {
@@ -3599,9 +3599,10 @@ function genderValidityCheck(_a) {
3599
3599
  stack: stack,
3600
3600
  });
3601
3601
  }
3602
- if (matchUpType === TypeEnum.Singles && referenceGender === MIXED)
3602
+ if (referenceGender === MIXED &&
3603
+ (gender !== MIXED || matchUpType === TypeEnum.Singles))
3603
3604
  return decorateResult({
3604
- info: 'matchUpType SINGLES is invalid for gender MIXED',
3605
+ info: 'MIXED events can only contain MIXED doubles collections',
3605
3606
  result: { error: INVALID_GENDER, valid: false },
3606
3607
  stack: stack,
3607
3608
  });
@@ -4186,8 +4187,8 @@ var validMatchUpStatuses = [
4186
4187
  ];
4187
4188
  var directingMatchUpStatuses = [
4188
4189
  BYE,
4189
- DOUBLE_WALKOVER,
4190
- DOUBLE_DEFAULT,
4190
+ DOUBLE_WALKOVER, // directing because of a produced WALKOVER
4191
+ DOUBLE_DEFAULT, // directing because of a produced WALKOVER
4191
4192
  COMPLETED$1,
4192
4193
  DEFAULTED,
4193
4194
  RETIRED$1,
@@ -5505,31 +5506,31 @@ var TIE_FORMAT_MODIFICATIONS = 'tieFormatModification';
5505
5506
  var extensionConstants = {
5506
5507
  APPLIED_POLICIES: APPLIED_POLICIES,
5507
5508
  AUDIT_POSITION_ACTIONS: AUDIT_POSITION_ACTIONS,
5508
- CONTEXT: CONTEXT,
5509
+ CONTEXT: CONTEXT, // used to capture, e.g. context in which a venue was added
5509
5510
  DELEGATED_OUTCOME: DELEGATED_OUTCOME,
5510
5511
  DISABLED: DISABLED,
5511
5512
  DISABLE_LINKS: DISABLE_LINKS,
5512
5513
  DISABLE_AUTO_CALC: DISABLE_AUTO_CALC,
5513
5514
  DRAW_DELETIONS: DRAW_DELETIONS,
5514
5515
  DRAW_PROFILE: DRAW_PROFILE,
5515
- ENTRY_PROFILE: ENTRY_PROFILE,
5516
+ ENTRY_PROFILE: ENTRY_PROFILE, // used for drawGeneration; not relevant for anonymized tournaments
5516
5517
  EVENT_PROFILE: EVENT_PROFILE,
5517
5518
  FLIGHT_PROFILE: FLIGHT_PROFILE,
5518
- GROUPING_ATTRIBUTE: GROUPING_ATTRIBUTE,
5519
+ GROUPING_ATTRIBUTE: GROUPING_ATTRIBUTE, // for generating teams; not relevant for anonymized tournaments
5519
5520
  LINEUPS: LINEUPS,
5520
5521
  LINKED_TOURNAMENTS: LINKED_TOURNAMENTS,
5521
5522
  MATCHUP_HISTORY: MATCHUP_HISTORY,
5522
5523
  PARTICIPANT_REPRESENTATIVES: PARTICIPANT_REPRESENTATIVES,
5523
5524
  PERSON_REQUESTS: PERSON_REQUESTS,
5524
- RANKING_POINTS: RANKING_POINTS,
5525
+ RANKING_POINTS: RANKING_POINTS, // for attaching points awarded to tournamentRecord
5525
5526
  ROUND_TARGET: ROUND_TARGET,
5526
5527
  SCHEDULE_LIMITS: SCHEDULE_LIMITS,
5527
5528
  SCHEDULE_TIMING: SCHEDULE_TIMING,
5528
5529
  SCHEDULING_PROFILE: SCHEDULING_PROFILE,
5529
- STATUS_DETAIL: STATUS_DETAIL,
5530
+ STATUS_DETAIL: STATUS_DETAIL, // attached to event.entries
5530
5531
  SUB_ORDER: SUB_ORDER,
5531
5532
  TALLY: TALLY,
5532
- TIE_FORMAT_MODIFICATIONS: TIE_FORMAT_MODIFICATIONS,
5533
+ TIE_FORMAT_MODIFICATIONS: TIE_FORMAT_MODIFICATIONS, // for auditing, not important when anonymized
5533
5534
  FACTORY: FACTORY$1,
5534
5535
  };
5535
5536
  var internalExtensions = [
@@ -6637,8 +6638,8 @@ var topicConstants = {
6637
6638
  DELETED_DRAW_IDS: DELETED_DRAW_IDS,
6638
6639
  DELETED_MATCHUP_IDS: DELETED_MATCHUP_IDS,
6639
6640
  MODIFY_DRAW_DEFINITION: MODIFY_DRAW_DEFINITION,
6640
- MODIFY_DRAW_ENTRIES: MODIFY_DRAW_ENTRIES,
6641
- MODIFY_EVENT_ENTRIES: MODIFY_EVENT_ENTRIES,
6641
+ MODIFY_DRAW_ENTRIES: MODIFY_DRAW_ENTRIES, // TODO
6642
+ MODIFY_EVENT_ENTRIES: MODIFY_EVENT_ENTRIES, // TODO
6642
6643
  MODIFY_MATCHUP: MODIFY_MATCHUP,
6643
6644
  MODIFY_PARTICIPANTS: MODIFY_PARTICIPANTS,
6644
6645
  MODIFY_POSITION_ASSIGNMENTS: MODIFY_POSITION_ASSIGNMENTS,
@@ -8525,7 +8526,7 @@ function getStructureSeedAssignments(_a) {
8525
8526
  return {
8526
8527
  participantId: entry.participantId,
8527
8528
  seedValue: seedNumber,
8528
- seedProxy: true,
8529
+ seedProxy: true, // flag so that proxy seeding information doesn't get used externally
8529
8530
  seedNumber: seedNumber,
8530
8531
  };
8531
8532
  })
@@ -11196,7 +11197,7 @@ function targetByRoundOutcome(_a) {
11196
11197
  function targetByWinRatio(_a) {
11197
11198
  var matchUp = _a.matchUp;
11198
11199
  return {
11199
- targetLinks: { loserTargetLink: undefined, winnerTargetLink: undefined },
11200
+ targetLinks: { loserTargetLink: undefined, winnerTargetLink: undefined }, // returned for testing
11200
11201
  targetMatchUps: { loserMatchUp: undefined, winnerMatchUp: undefined },
11201
11202
  matchUp: matchUp,
11202
11203
  };
@@ -11748,7 +11749,7 @@ function modifyMatchUpScore(_a) {
11748
11749
  // participantsProfile: { withGroupings: true },
11749
11750
  matchUpFilters: { matchUpIds: [matchUpId] },
11750
11751
  nextMatchUps: true,
11751
- tournamentRecord: tournamentRecord,
11752
+ tournamentRecord: tournamentRecord, // required to hydrate participants
11752
11753
  inContext: true,
11753
11754
  drawDefinition: drawDefinition,
11754
11755
  matchUpsMap: matchUpsMap,
@@ -16692,14 +16693,14 @@ var POLICY_POSITION_ACTIONS_DEFAULT = (_a$e = {},
16692
16693
  // enabledStructures: [] => all structures are enabled
16693
16694
  enabledStructures: [
16694
16695
  {
16695
- stages: [QUALIFYING, MAIN],
16696
- stageSequences: [1],
16697
- enabledActions: [],
16696
+ stages: [QUALIFYING, MAIN], // stages to which this policy applies
16697
+ stageSequences: [1], // stageSequences to which this policy applies
16698
+ enabledActions: [], // enabledActions: [] => all actions are enabled
16698
16699
  disabledActions: [], // disabledActions: [] => no actions are disabled
16699
16700
  },
16700
16701
  {
16701
- stages: [],
16702
- stageSequences: [],
16702
+ stages: [], // stages: [] => applies to all stages
16703
+ stageSequences: [], // stageSequences: [] => applies to all stageSequences
16703
16704
  enabledActions: [
16704
16705
  ADD_NICKNAME,
16705
16706
  ADD_PENALTY,
@@ -16737,8 +16738,8 @@ var POLICY_POSITION_ACTIONS_NO_MOVEMENT = (_a$c = {},
16737
16738
  // enabledStructures: [] => all structures are enabled
16738
16739
  enabledStructures: [
16739
16740
  {
16740
- stages: [],
16741
- stageSequences: [],
16741
+ stages: [], // stages: [] => applies to all stages
16742
+ stageSequences: [], // stageSequences: [] => applies to all stageSequences
16742
16743
  enabledActions: [SEED_VALUE, ADD_NICKNAME, ADD_PENALTY],
16743
16744
  disabledActions: [], // disabledActions: [] => no actions are disabled
16744
16745
  },
@@ -16862,7 +16863,7 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16862
16863
  _c),
16863
16864
  matchUpAverageTimes: [
16864
16865
  {
16865
- matchUpFormatCodes: [FORMAT_STANDARD],
16866
+ matchUpFormatCodes: [FORMAT_STANDARD], // Best of 3 tiebreak sets
16866
16867
  averageTimes: [
16867
16868
  {
16868
16869
  categoryNames: [],
@@ -16875,31 +16876,31 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16875
16876
  ],
16876
16877
  },
16877
16878
  {
16878
- matchUpFormatCodes: ['SET3-S:6/TB7-F:TB10'],
16879
+ matchUpFormatCodes: ['SET3-S:6/TB7-F:TB10'], // Two tiebreak sets, 10-point match tiebreak at one set all
16879
16880
  averageTimes: [{ categoryNames: [], minutes: { default: 85 } }],
16880
16881
  },
16881
16882
  {
16882
- matchUpFormatCodes: ['SET3-S:6/TB7-F:TB7'],
16883
+ matchUpFormatCodes: ['SET3-S:6/TB7-F:TB7'], // Two tiebreak sets, 7-point match tiebreak at one set all
16883
16884
  averageTimes: [{ categoryNames: [], minutes: { default: 70 } }],
16884
16885
  },
16885
16886
  {
16886
- matchUpFormatCodes: ['SET3-S:4NOAD-F:TB7'],
16887
+ matchUpFormatCodes: ['SET3-S:4NOAD-F:TB7'], // Two short sets to 4 with deciding game at 3-3, 7-point match tiebreak at one set all
16887
16888
  averageTimes: [{ categoryNames: [], minutes: { default: 55 } }],
16888
16889
  },
16889
16890
  {
16890
- matchUpFormatCodes: ['SET3-S:4/TB7'],
16891
+ matchUpFormatCodes: ['SET3-S:4/TB7'], // Best of 3 sets to 4
16891
16892
  averageTimes: [{ categoryNames: [], minutes: { default: 60 } }],
16892
16893
  },
16893
16894
  {
16894
- matchUpFormatCodes: ['SET3-S:4/TB7-F:TB7'],
16895
+ matchUpFormatCodes: ['SET3-S:4/TB7-F:TB7'], // Two short sets to 4, 7-point match tiebreak at one set all
16895
16896
  averageTimes: [{ categoryNames: [], minutes: { default: 50 } }],
16896
16897
  },
16897
16898
  {
16898
- matchUpFormatCodes: ['SET3-S:4/TB7-F:TB10'],
16899
+ matchUpFormatCodes: ['SET3-S:4/TB7-F:TB10'], // Two short sets to 4, 10-point match tiebreak at one set all
16899
16900
  averageTimes: [{ categoryNames: [], minutes: { default: 55 } }],
16900
16901
  },
16901
16902
  {
16902
- matchUpFormatCodes: ['SET3-S:4/TB5@3'],
16903
+ matchUpFormatCodes: ['SET3-S:4/TB5@3'], // Two out of three short sets to 4 with 5-point tiebreak at 3 games all
16903
16904
  averageTimes: [{ categoryNames: [], minutes: { default: 45 } }],
16904
16905
  },
16905
16906
  {
@@ -16910,15 +16911,15 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16910
16911
  averageTimes: [{ categoryNames: [], minutes: { default: 40 } }],
16911
16912
  },
16912
16913
  {
16913
- matchUpFormatCodes: ['SET1-S:5/TB9@4'],
16914
+ matchUpFormatCodes: ['SET1-S:5/TB9@4'], // One no advantage set to 5, tiebreak to 9 at 4-4
16914
16915
  averageTimes: [{ categoryNames: [], minutes: { default: 30 } }],
16915
16916
  },
16916
16917
  {
16917
- matchUpFormatCodes: ['SET1-S:6/TB7'],
16918
+ matchUpFormatCodes: ['SET1-S:6/TB7'], // One standard tiebreak set to 6, 7-point tiebreak at 6 games all
16918
16919
  averageTimes: [{ categoryNames: [], minutes: { default: 30 } }],
16919
16920
  },
16920
16921
  {
16921
- matchUpFormatCodes: ['SET1-S:6NOAD'],
16922
+ matchUpFormatCodes: ['SET1-S:6NOAD'], // One set to 6 with deciding game at 5 games all
16922
16923
  averageTimes: [{ categoryNames: [], minutes: { default: 30 } }],
16923
16924
  },
16924
16925
  {
@@ -16931,11 +16932,11 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16931
16932
  averageTimes: [{ categoryNames: [], minutes: { default: 20 } }],
16932
16933
  },
16933
16934
  {
16934
- matchUpFormatCodes: ['SET1-S:4NOAD'],
16935
+ matchUpFormatCodes: ['SET1-S:4NOAD'], // One short set to 4, deciding game is played at 3 games all
16935
16936
  averageTimes: [{ categoryNames: [], minutes: { default: 20 } }],
16936
16937
  },
16937
16938
  {
16938
- matchUpFormatCodes: ['SET1-S:TB10'],
16939
+ matchUpFormatCodes: ['SET1-S:TB10'], // One 10-point tiebreak game
16939
16940
  averageTimes: [{ categoryNames: [], minutes: { default: 10 } }],
16940
16941
  },
16941
16942
  ],
@@ -16996,7 +16997,7 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
16996
16997
  ],
16997
16998
  },
16998
16999
  {
16999
- matchUpFormatCodes: ['SET1-S:4/TB5@3'],
17000
+ matchUpFormatCodes: ['SET1-S:4/TB5@3'], // One short set to 4, 5-point tiebreak at 3 games all
17000
17001
  recoveryTimes: [
17001
17002
  {
17002
17003
  categoryTypes: [ADULT, JUNIOR],
@@ -17009,7 +17010,7 @@ var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
17009
17010
  ],
17010
17011
  },
17011
17012
  {
17012
- matchUpFormatCodes: ['SET1-S:TB10'],
17013
+ matchUpFormatCodes: ['SET1-S:TB10'], // One 10-point tiebreak game
17013
17014
  recoveryTimes: [
17014
17015
  {
17015
17016
  categoryNames: [],
@@ -18121,7 +18122,7 @@ function addFinishingRounds(_a) {
18121
18122
  if (!validMatchUps(matchUps))
18122
18123
  return [];
18123
18124
  var _d = getRoundMatchUps$1({
18124
- interpolate: true,
18125
+ interpolate: true, // for structures which do not contain a final round of one matchUps (structure winner)
18125
18126
  matchUps: matchUps,
18126
18127
  }), roundProfile = _d.roundProfile, _e = _d.roundNumbers, roundNumbers = _e === void 0 ? [] : _e;
18127
18128
  roundsCount = roundsCount || Math.max.apply(Math, __spreadArray(__spreadArray([], __read(roundNumbers), false), [0], false));
@@ -19079,7 +19080,7 @@ var baseAttributeKeys = [
19079
19080
  'tieMatchUps',
19080
19081
  'roundPosition',
19081
19082
  'score',
19082
- 'sides',
19083
+ 'sides', // can be removed only if drawPositions is present and is not a TEAM matchUp
19083
19084
  'winnerMatchUpId',
19084
19085
  'loserMatchUpId',
19085
19086
  'matchUpDuration',
@@ -21585,8 +21586,8 @@ function tidyScore(params) {
21585
21586
  var doProcess = function (methods) {
21586
21587
  methods.forEach(function (method) {
21587
21588
  result = transforms[method]({
21588
- profile: profile,
21589
- identifier: identifier,
21589
+ profile: profile, // config object compatible with provider profiles
21590
+ identifier: identifier, // optional identifier (used in test harness)
21590
21591
  matchUpStatus: matchUpStatus,
21591
21592
  attributes: attributes,
21592
21593
  applied: applied,
@@ -25715,7 +25716,7 @@ function roundRobinMatchUps(_a) {
25715
25716
  matchUpStatus: roundNumber
25716
25717
  ? MatchUpStatusEnum.ToBePlayed
25717
25718
  : MatchUpStatusEnum.Bye,
25718
- matchUpType: matchUpType,
25719
+ matchUpType: matchUpType, // does not (perhaps) need to be included; but because structures[].structure unsure about derivation inContext
25719
25720
  // finishingPositionRange in RR is not very useful, but provided for consistency
25720
25721
  finishingPositionRange: { winner: range, loser: range },
25721
25722
  drawPositions: drawPositions,
@@ -28046,7 +28047,7 @@ function setMatchUpStatus$2(params) {
28046
28047
  var matchUpTieId = inContextMatchUp === null || inContextMatchUp === void 0 ? void 0 : inContextMatchUp.matchUpTieId;
28047
28048
  // Get winner/loser position targets ----------------------------------------
28048
28049
  var targetData = positionTargets({
28049
- matchUpId: matchUpTieId || matchUpId,
28050
+ matchUpId: matchUpTieId || matchUpId, // get targets for TEAM matchUp if tieMatchUp
28050
28051
  inContextDrawMatchUps: inContextDrawMatchUps,
28051
28052
  drawDefinition: drawDefinition,
28052
28053
  });
@@ -28754,7 +28755,7 @@ function addDrawDefinition$1(params) {
28754
28755
  else {
28755
28756
  var flights = (flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) || [];
28756
28757
  flights.push({
28757
- manuallyAdded: true,
28758
+ manuallyAdded: true, // this drawDefinition was not part of automated split
28758
28759
  flightNumber: drawOrder,
28759
28760
  drawEntries: drawEntries,
28760
28761
  drawName: drawName,
@@ -29100,7 +29101,7 @@ function getEventPublishStatuses(_a) {
29100
29101
  if ((_b = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _b === void 0 ? void 0 : _b.PUBLIC) {
29101
29102
  var _c = timeItem.itemValue.PUBLIC || {}, _d = _c.drawIds, publishedDrawIds = _d === void 0 ? [] : _d, seeding = _c.seeding;
29102
29103
  var publishedSeeding = {
29103
- published: undefined,
29104
+ published: undefined, // seeding can be present for all entries in an event when no flights have been defined
29104
29105
  seedingScaleNames: [],
29105
29106
  drawIds: [], // seeding can be specific to drawIds
29106
29107
  };
@@ -31625,13 +31626,13 @@ function modifyCollectionDefinition$1(_a) {
31625
31626
 
31626
31627
  function resolveTournamentRecord(params) {
31627
31628
  var method = params.method, tournamentRecords = params.tournamentRecords, args = __rest(params, ["method", "tournamentRecords"]);
31629
+ if (!method)
31630
+ return { error: MISSING_VALUE };
31628
31631
  // find tournamentId by brute force if not provided
31629
- var tournamentId = params.tournamentId || findTournamentId(args);
31632
+ var tournamentId = params.tournamentId || findTournamentId(__assign({ tournamentRecords: tournamentRecords }, args));
31630
31633
  if (typeof tournamentId !== 'string')
31631
31634
  return { error: MISSING_TOURNAMENT_ID };
31632
31635
  var tournamentRecord = tournamentRecords[tournamentId];
31633
- if (!tournamentRecord)
31634
- return { error: MISSING_TOURNAMENT_RECORD };
31635
31636
  return method(__assign(__assign({}, args), { tournamentRecord: tournamentRecord }));
31636
31637
  }
31637
31638
 
@@ -32873,13 +32874,13 @@ function publicFindMatchUp(params) {
32873
32874
  function findMatchUp(_a) {
32874
32875
  var _b;
32875
32876
  var _c, _d, _e, _f;
32876
- var participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, inContext = _a.inContext, eventId = _a.eventId, drawId = _a.drawId, event = _a.event;
32877
+ var participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, nextMatchUps = _a.nextMatchUps, matchUpId = _a.matchUpId, inContext = _a.inContext, eventId = _a.eventId, drawId = _a.drawId, event = _a.event;
32877
32878
  if (!tournamentRecord)
32878
32879
  return { error: MISSING_TOURNAMENT_RECORD };
32879
32880
  if (typeof matchUpId !== 'string')
32880
32881
  return { error: MISSING_MATCHUP_ID };
32881
- if (!drawDefinition || !event) {
32882
- var matchUps = (_c = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _c !== void 0 ? _c : [];
32882
+ if (!drawDefinition || !event || nextMatchUps) {
32883
+ var matchUps = (_c = allTournamentMatchUps({ tournamentRecord: tournamentRecord, nextMatchUps: nextMatchUps }).matchUps) !== null && _c !== void 0 ? _c : [];
32883
32884
  var inContextMatchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
32884
32885
  if (!inContextMatchUp)
32885
32886
  return { error: MATCHUP_NOT_FOUND };
@@ -33209,7 +33210,7 @@ var competitionGovernor = {
33209
33210
  unlinkTournament: unlinkTournament,
33210
33211
  unlinkTournaments: unlinkTournaments,
33211
33212
  getLinkedTournamentIds: getLinkedTournamentIds,
33212
- addDrawDefinition: addDrawDefinition,
33213
+ addDrawDefinition: addDrawDefinition, // test
33213
33214
  getCompetitionParticipants: getCompetitionParticipants,
33214
33215
  getParticipants: getParticipants,
33215
33216
  addParticipant: addParticipant,
@@ -33217,10 +33218,10 @@ var competitionGovernor = {
33217
33218
  setMatchUpStatus: setMatchUpStatus,
33218
33219
  bulkMatchUpStatusUpdate: bulkMatchUpStatusUpdate,
33219
33220
  bulkScheduleMatchUps: bulkScheduleMatchUps,
33220
- addPenalty: addPenalty,
33221
- removePenalty: removePenalty,
33222
- modifyPenalty: modifyPenalty,
33223
- getCompetitionPenalties: getCompetitionPenalties,
33221
+ addPenalty: addPenalty, // test
33222
+ removePenalty: removePenalty, // test
33223
+ modifyPenalty: modifyPenalty, // test
33224
+ getCompetitionPenalties: getCompetitionPenalties, // test
33224
33225
  findParticipant: publicFindParticipant,
33225
33226
  };
33226
33227
 
@@ -34521,8 +34522,8 @@ function competitionScheduleMatchUps(params) {
34521
34522
  courtsData: courtsData,
34522
34523
  completedMatchUps: alwaysReturnCompleted
34523
34524
  ? allCompletedMatchUps
34524
- : completedMatchUps,
34525
- dateMatchUps: dateMatchUps,
34525
+ : completedMatchUps, // completed matchUps for the filter date
34526
+ dateMatchUps: dateMatchUps, // all incomplete matchUps for the filter date
34526
34527
  venues: venues,
34527
34528
  };
34528
34529
  if (withCourtGridRows) {
@@ -34676,7 +34677,7 @@ function calculateScheduleTimes(_a) {
34676
34677
  // need to reduce courts available for a given time period by the number of matchUps scheduled at a given venue
34677
34678
  var matchUpFilters = { scheduledDate: scheduleDate, venueIds: venueIds };
34678
34679
  var matchUpsWithSchedule = competitionScheduleMatchUps({
34679
- sortDateMatchUps: false,
34680
+ sortDateMatchUps: false, // unnecessary for extracting bookings; reduce processing overhead;
34680
34681
  tournamentRecords: tournamentRecords,
34681
34682
  matchUpFilters: matchUpFilters,
34682
34683
  });
@@ -34796,8 +34797,8 @@ function checkParticipantProfileInitialization(_a) {
34796
34797
  typeChangeTimeAfterRecovery: undefined,
34797
34798
  timeAfterRecovery: undefined,
34798
34799
  priorMatchUpType: undefined,
34799
- potentialRecovery: {},
34800
- potentialCounted: {},
34800
+ potentialRecovery: {}, // { [drawId]: [timeString] } - timeAfterRecovery for potential matchUps by drawId
34801
+ potentialCounted: {}, // whether a potential matchUp has been counted for daily limits for a specific drawId
34801
34802
  potentialBookings: {},
34802
34803
  bookings: [],
34803
34804
  counters: {},
@@ -35405,7 +35406,7 @@ function getVenueSchedulingDetails(_a) {
35405
35406
  }), matchUpsToSchedule = _g.matchUpsToSchedule, matchUpMap = _g.matchUpMap;
35406
35407
  var venueCourts = courts.filter(function (court) { return court.venueId === venueId; });
35407
35408
  venueScheduledRoundDetails[venueId] = {
35408
- previousRemainingScheduleTimes: [],
35409
+ previousRemainingScheduleTimes: [], // keep track of sheduleTimes not used on previous iteration
35409
35410
  courtsCount: venueCourts.length,
35410
35411
  greatestAverageMinutes: greatestAverageMinutes,
35411
35412
  scheduledRoundsDetails: scheduledRoundsDetails,
@@ -37670,10 +37671,10 @@ function getRoundId(obj) {
37670
37671
  var relevantStructureId = isRoundRobin ? containerStructureId : structureId;
37671
37672
  // retain order
37672
37673
  var id = [
37673
- tournamentId,
37674
- eventId,
37675
- drawId,
37676
- relevantStructureId,
37674
+ tournamentId, // 1
37675
+ eventId, // 2
37676
+ drawId, // 3
37677
+ relevantStructureId, // 4
37677
37678
  roundNumber, // 5
37678
37679
  ].join('|');
37679
37680
  return definedAttributes({
@@ -38826,7 +38827,7 @@ var scheduleGovernor$1 = {
38826
38827
  getMatchUpFormatTimingUpdate: getMatchUpFormatTimingUpdate$1,
38827
38828
  getEventMatchUpFormatTiming: getEventMatchUpFormatTiming,
38828
38829
  removeEventMatchUpFormatTiming: removeEventMatchUpFormatTiming,
38829
- getMatchUpDailyLimitsUpdate: getMatchUpDailyLimitsUpdate$1,
38830
+ getMatchUpDailyLimitsUpdate: getMatchUpDailyLimitsUpdate$1, // document
38830
38831
  getMatchUpDailyLimits: getMatchUpDailyLimits,
38831
38832
  setMatchUpDailyLimits: setMatchUpDailyLimits,
38832
38833
  getProfileRounds: getProfileRounds,
@@ -38834,7 +38835,7 @@ var scheduleGovernor$1 = {
38834
38835
  assignMatchUpVenue: assignMatchUpVenue,
38835
38836
  assignMatchUpCourt: assignMatchUpCourt,
38836
38837
  allocateTeamMatchUpCourts: allocateTeamMatchUpCourts,
38837
- addMatchUpScheduleItems: addMatchUpScheduleItems,
38838
+ addMatchUpScheduleItems: addMatchUpScheduleItems, // test
38838
38839
  addMatchUpScheduledDate: addMatchUpScheduledDate,
38839
38840
  addMatchUpScheduledTime: addMatchUpScheduledTime,
38840
38841
  addMatchUpCourtOrder: addMatchUpCourtOrder,
@@ -38842,7 +38843,7 @@ var scheduleGovernor$1 = {
38842
38843
  addMatchUpStopTime: addMatchUpStopTime,
38843
38844
  addMatchUpResumeTime: addMatchUpResumeTime,
38844
38845
  addMatchUpEndTime: addMatchUpEndTime,
38845
- addMatchUpOfficial: addMatchUpOfficial,
38846
+ addMatchUpOfficial: addMatchUpOfficial, // test
38846
38847
  getSchedulingProfile: getSchedulingProfile$1,
38847
38848
  setSchedulingProfile: setSchedulingProfile$1,
38848
38849
  addSchedulingProfileRound: addSchedulingProfileRound,
@@ -39109,7 +39110,7 @@ function getSchedulingProfileIssues(params) {
39109
39110
  }
39110
39111
 
39111
39112
  function credits() {
39112
- return "\n This project would not have been possible without the generous input and patience\n of tournament organizers and directors who worked with early versions of CourtHive/TMX.\n\n Thanks to Pavel, Ivan, Mladen, Zdenko, Antoina, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few. \n\n The project would not have even begun without the support of Miro, or the introduction by Sretchko.\n The project would not have succeeded without the enthusiasm of Randy and Bruce.\n Thanks to serendipity and Luca and the ensuing TODS conversations with ITF.\n Thanks to Scott and Jake for sanity checks, suggestions, and camaraderie.\n Thanks to Zoran for inspiring the async support and getting into the weeds with subscriptions.\n Thanks to Dave for backing the conversion of TMX 1.x source into the factory repository.\n Thanks to Vuk and Pavle and Rich and Chris and Deepa for the direct engagement with the APIs.\n Thanks to Joe for repeatedly challenging me and the many pointers to useful tooling.\n Thanks to Shannon for the validation of the approach from his deep domain experience.\n Thanks to Nikola for the ongoing camaraderie and explorations of what we can do with TODS.\n\n And a special thanks to my family for putting up with the long days and weeks and months of coding\n and conversations at all hours.\n ";
39113
+ return "\n This project would not have been possible without the generous input and patience\n of tournament organizers and directors who worked with early versions of CourtHive/TMX.\n\n Thanks to Pavel, Ivan, Mladen, Zdenko, Antonia, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few. \n\n The project would not have even begun without the support of Miro, or the introduction by Sretchko.\n The project would not have succeeded without the enthusiasm of Randy and Bruce.\n Thanks to serendipity and Luca and the ensuing TODS conversations with ITF.\n Thanks to Scott and Jake for sanity checks, suggestions, and camaraderie.\n Thanks to Zoran for inspiring the async support and getting into the weeds with subscriptions.\n Thanks to Dave for backing the conversion of TMX 1.x source into the factory repository.\n Thanks to Vuk and Pavle and Rich and Chris and Deepa for the direct engagement with the APIs.\n Thanks to Joe for repeatedly challenging me and the many pointers to useful tooling.\n Thanks to Shannon for the validation of the approach from his deep domain experience.\n Thanks to Nikola for the ongoing camaraderie and explorations of what we can do with TODS.\n\n And a special thanks to my family for putting up with the long days and weeks and months of coding\n and conversations at all hours.\n ";
39113
39114
  }
39114
39115
 
39115
39116
  function getValidAlternatesAction(_a) {
@@ -39234,14 +39235,14 @@ var POLICY_MATCHUP_ACTIONS_DEFAULT = (_a$2 = {},
39234
39235
  // enabledStructures: [] => all structures are enabled
39235
39236
  enabledStructures: [
39236
39237
  {
39237
- stages: [],
39238
- stageSequences: [],
39238
+ stages: [], // stages: [] => applies to all stages
39239
+ stageSequences: [], // stageSequences: [] => applies to all stageSequences
39239
39240
  enabledActions: [],
39240
39241
  disabledActions: [], // disabledActions: [] => no actions are disabled
39241
39242
  },
39242
39243
  ],
39243
39244
  participants: {
39244
- enforceCategory: true,
39245
+ enforceCategory: true, // validate collectionDefinition.category against event.category
39245
39246
  enforceGender: true, // disallow placing FEMALEs in MALE events and vice versa
39246
39247
  },
39247
39248
  processCodes: {
@@ -39627,7 +39628,7 @@ function matchUpActions$2(_a) {
39627
39628
  };
39628
39629
  validActions.push({
39629
39630
  info: 'set outcome and winningSide',
39630
- method: SCHEDULE_METHOD,
39631
+ method: SCHEDULE_METHOD, // setMatchUpStatus
39631
39632
  type: SCORE,
39632
39633
  payload: payload,
39633
39634
  });
@@ -41920,7 +41921,7 @@ function generateQualifyingLink(_a) {
41920
41921
  finishingPositions: finishingPositions,
41921
41922
  },
41922
41923
  target: {
41923
- feedProfile: DRAW,
41924
+ feedProfile: DRAW, // positions are not automatically placed
41924
41925
  roundNumber: targetEntryRound,
41925
41926
  structureId: targetStructureId,
41926
41927
  },
@@ -42138,7 +42139,7 @@ function generateQualifyingStructures(_a) {
42138
42139
  matchUpFormat: matchUpFormat,
42139
42140
  stageSequence: stageSequence,
42140
42141
  matchUpType: matchUpType,
42141
- roundLimit: roundLimit,
42142
+ roundLimit: roundLimit, // redundant
42142
42143
  matchUps: matchUps,
42143
42144
  });
42144
42145
  if (roundTarget) {
@@ -42449,7 +42450,7 @@ function getAvailablePlayoffProfiles$1(_a) {
42449
42450
  else {
42450
42451
  return {
42451
42452
  availablePlayoffProfiles: Object.values(available),
42452
- availablePlayoffRounds: Object.values(available),
42453
+ availablePlayoffRounds: Object.values(available), // to be deprecated
42453
42454
  positionsPlayedOff: positionsPlayedOff,
42454
42455
  };
42455
42456
  }
@@ -47247,7 +47248,7 @@ function generateQualifyingStructure$1(params) {
47247
47248
  matchUpFormat: matchUpFormat,
47248
47249
  stageSequence: stageSequence,
47249
47250
  matchUpType: matchUpType,
47250
- roundLimit: roundLimit,
47251
+ roundLimit: roundLimit, // redundant
47251
47252
  matchUps: matchUps,
47252
47253
  });
47253
47254
  if (roundTarget) {
@@ -48143,7 +48144,7 @@ var structureGovernor = {
48143
48144
  generateQualifyingStructure: generateQualifyingStructure$1,
48144
48145
  attachQualifyingStructure: attachQualifyingStructure$1,
48145
48146
  addQualifyingStructure: addQualifyingStructure$1,
48146
- getAvailablePlayoffRounds: getAvailablePlayoffProfiles$1,
48147
+ getAvailablePlayoffRounds: getAvailablePlayoffProfiles$1, // to be deprecated,
48147
48148
  getAvailablePlayoffProfiles: getAvailablePlayoffProfiles$1,
48148
48149
  getSourceRounds: getSourceRounds,
48149
48150
  getDrawStructures: getDrawStructures,
@@ -48156,7 +48157,7 @@ var structureGovernor = {
48156
48157
  addVoluntaryConsolationStage: addVoluntaryConsolationStage$1,
48157
48158
  addVoluntaryConsolationStructure: addVoluntaryConsolationStructure$1,
48158
48159
  generateVoluntaryConsolation: generateVoluntaryConsolation$1,
48159
- buildDrawHierarchy: buildDrawHierarchy,
48160
+ buildDrawHierarchy: buildDrawHierarchy, // obsolete
48160
48161
  generateDrawTypeAndModifyDrawDefinition: generateDrawTypeAndModifyDrawDefinition$1,
48161
48162
  generateDrawStructuresAndLinks: generateDrawStructuresAndLinks$1,
48162
48163
  };
@@ -49550,7 +49551,7 @@ function addEventEntries(params) {
49550
49551
  removedEntries.push.apply(removedEntries, __spreadArray([], __read(ungroupedParticipantIdsToRemove), false));
49551
49552
  removeEventEntries({
49552
49553
  participantIds: ungroupedParticipantIdsToRemove,
49553
- autoEntryPositions: false,
49554
+ autoEntryPositions: false, // because the method will be called below if necessary
49554
49555
  event: event,
49555
49556
  });
49556
49557
  }
@@ -52168,16 +52169,16 @@ function getValidQualifiersAction(_a) {
52168
52169
  // disallow placing qualifiers until source structure is completed
52169
52170
  var requireCompletedStructures = policy === null || policy === void 0 ? void 0 : policy.requireCompletedStructures;
52170
52171
  var _h = getSourceStructureIdsAndRelevantLinks({
52171
- targetRoundNumber: targetRoundNumber,
52172
- linkType: WINNER,
52172
+ targetRoundNumber: targetRoundNumber, // look for soure structrues targeting roundNumber
52173
+ linkType: WINNER, // WINNER of qualifying structures will traverse link
52173
52174
  drawDefinition: drawDefinition,
52174
52175
  structureId: structureId,
52175
52176
  }) || {}, eliminationSoureStructureIds = _h.sourceStructureIds, eliminationSourceLinks = _h.relevantLinks;
52176
52177
  if (eliminationSoureStructureIds === null || eliminationSoureStructureIds === void 0 ? void 0 : eliminationSoureStructureIds.length)
52177
52178
  sourceStructureIds.push.apply(sourceStructureIds, __spreadArray([], __read(eliminationSoureStructureIds), false));
52178
52179
  var _j = getSourceStructureIdsAndRelevantLinks({
52179
- targetRoundNumber: targetRoundNumber,
52180
- linkType: POSITION,
52180
+ targetRoundNumber: targetRoundNumber, // look for soure structrues targeting roundNumber
52181
+ linkType: POSITION, // link will define how many finishingPositions traverse the link
52181
52182
  drawDefinition: drawDefinition,
52182
52183
  structureId: structureId,
52183
52184
  }) || {}, roundRobinSourceStructureIds = _j.sourceStructureIds, roundRobinSourceLinks = _j.relevantLinks;
@@ -52306,7 +52307,7 @@ function getValidQualifiersAction(_a) {
52306
52307
  if (qualifyingParticipantIds.length) {
52307
52308
  validAssignmentActions.push(definedAttributes({
52308
52309
  payload: {
52309
- qualifyingParticipantId: undefined,
52310
+ qualifyingParticipantId: undefined, // to be provided by client
52310
52311
  drawPosition: drawPosition,
52311
52312
  structureId: structureId,
52312
52313
  drawId: drawId,
@@ -54968,7 +54969,7 @@ function addParticipantContext(params) {
54968
54969
  if ((event === null || event === void 0 ? void 0 : event.eventType) === TEAM$2) {
54969
54970
  // add back lineUps extension for team resolution when { matchUpType: TEAM } is missing side.lineUps
54970
54971
  var extension = findExtension$2({
54971
- element: rawEvent.drawDefinitions[i],
54972
+ element: rawEvent.drawDefinitions[i], // rawEvent because deepCopy has converted extensions
54972
54973
  name: LINEUPS,
54973
54974
  }).extension;
54974
54975
  if (extension)
@@ -54988,7 +54989,7 @@ function addParticipantContext(params) {
54988
54989
  if ((_c = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _c === void 0 ? void 0 : _c.PUBLIC) {
54989
54990
  var _h = timeItem.itemValue.PUBLIC || {}, _j = _h.drawIds, publishedDrawIds = _j === void 0 ? [] : _j, seeding = _h.seeding;
54990
54991
  var publishedSeeding = {
54991
- published: undefined,
54992
+ published: undefined, // seeding can be present for all entries in an event when no flights have been defined
54992
54993
  seedingScaleNames: [],
54993
54994
  drawIds: [], // seeding can be specific to drawIds
54994
54995
  };
@@ -58751,9 +58752,9 @@ function analyzeDraws(_a) {
58751
58752
  if (!tournamentRecord)
58752
58753
  return { error: MISSING_TOURNAMENT_RECORD };
58753
58754
  var drawsAnalysis = {
58754
- positionsNoOutcomes: [],
58755
- canBePruned: [],
58756
- matchPlay: [],
58755
+ positionsNoOutcomes: [], // all positions assigned and no outcomes
58756
+ canBePruned: [], // partially assigned positions with outcomes => drawSizes can be reduced
58757
+ matchPlay: [], // only first round has active matchUps; some unassigned positions
58757
58758
  inactive: [],
58758
58759
  drawAnalysis: {},
58759
58760
  };
@@ -59292,9 +59293,9 @@ var scheduleGovernor = {
59292
59293
  removeEventMatchUpFormatTiming: removeEventMatchUpFormatTiming$1,
59293
59294
  getMatchUpFormatTimingUpdate: getMatchUpFormatTimingUpdate,
59294
59295
  getMatchUpDependencies: getMatchUpDependencies,
59295
- getMatchUpDailyLimits: getMatchUpDailyLimits$1,
59296
- setMatchUpDailyLimits: setMatchUpDailyLimits$1,
59297
- getMatchUpDailyLimitsUpdate: getMatchUpDailyLimitsUpdate,
59296
+ getMatchUpDailyLimits: getMatchUpDailyLimits$1, // document
59297
+ setMatchUpDailyLimits: setMatchUpDailyLimits$1, // document
59298
+ getMatchUpDailyLimitsUpdate: getMatchUpDailyLimitsUpdate, // document
59298
59299
  validateSchedulingProfile: validateSchedulingProfile,
59299
59300
  setSchedulingProfile: setSchedulingProfile,
59300
59301
  getSchedulingProfile: getSchedulingProfile,
@@ -59401,7 +59402,7 @@ function getEntryStatusReports(_a) {
59401
59402
  var tournamentId = tournamentRecord.tournamentId;
59402
59403
  var participantMap = getParticipants$1({
59403
59404
  withScaleValues: true,
59404
- withEvents: true,
59405
+ withEvents: true, // so that event rankings will be present
59405
59406
  withSeeding: true,
59406
59407
  tournamentRecord: tournamentRecord,
59407
59408
  withDraws: true,
@@ -59602,8 +59603,7 @@ function getParticipantStats(_a) {
59602
59603
  return { error: INVALID_MATCHUP };
59603
59604
  var participantsProfile = withScaleValues ? { withScaleValues: withScaleValues } : undefined;
59604
59605
  matchUps =
59605
- matchUps ||
59606
- allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
59606
+ matchUps !== null && matchUps !== void 0 ? matchUps : allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
59607
59607
  if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length))
59608
59608
  return { error: MISSING_MATCHUPS };
59609
59609
  var teamParticipantIds = [];
@@ -59682,6 +59682,9 @@ function getParticipantStats(_a) {
59682
59682
  participantName: participant.participantName,
59683
59683
  ratings: participant.ratings,
59684
59684
  });
59685
+ var stats = participantStats.get(participant.participantId);
59686
+ if (stats)
59687
+ stats.participantName = participant.participantName;
59685
59688
  }
59686
59689
  }
59687
59690
  }
@@ -59754,18 +59757,19 @@ function getParticipantStats(_a) {
59754
59757
  if (teamParticipantId) {
59755
59758
  var processForTeam = !opponentParticipantId ||
59756
59759
  sides.every(function (side) {
59757
- side.participant &&
59760
+ return (side.participant &&
59758
59761
  (getCompetitorIds({
59759
- side: side,
59760
59762
  individualParticipantIds: teamMap.get(teamParticipantId),
59763
+ side: side,
59761
59764
  }) ||
59762
59765
  getCompetitorIds({
59763
- side: side,
59764
59766
  individualParticipantIds: teamMap.get(opponentParticipantId),
59765
- }));
59767
+ side: side,
59768
+ })));
59766
59769
  });
59767
- if (processForTeam)
59770
+ if (processForTeam) {
59768
59771
  processSides(teamParticipantId, teamMap.get(teamParticipantId));
59772
+ }
59769
59773
  }
59770
59774
  else {
59771
59775
  try {
@@ -62490,7 +62494,7 @@ function setEntryPositions(_a) {
62490
62494
  var positioning = entryPositions_1_1.value;
62491
62495
  var participantId = positioning.participantId, entryPosition = positioning.entryPosition;
62492
62496
  var result = setEntryPosition({
62493
- skipRefresh: true,
62497
+ skipRefresh: true, // avoid redundant processing
62494
62498
  tournamentRecord: tournamentRecord,
62495
62499
  drawDefinition: drawDefinition,
62496
62500
  participantId: participantId,
@@ -65030,7 +65034,7 @@ var eventGovernor = {
65030
65034
  addDrawEntries: addDrawEntries,
65031
65035
  removeSeeding: removeSeeding,
65032
65036
  autoSeeding: autoSeeding,
65033
- getAvailablePlayoffRounds: getAvailablePlayoffProfiles,
65037
+ getAvailablePlayoffRounds: getAvailablePlayoffProfiles, // to be deprecated
65034
65038
  getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
65035
65039
  getAssignedParticipantIds: getAssignedParticipantIds,
65036
65040
  deleteDrawDefinitions: deleteDrawDefinitions,
@@ -66042,7 +66046,7 @@ function getEventProperties(_a) {
66042
66046
  hasRatedParticipants = !!(hasRatedParticipants || rating);
66043
66047
  return {
66044
66048
  participantId: participantId,
66045
- participantName: participantName || name,
66049
+ participantName: participantName || name, // support legacy
66046
66050
  seed: seed,
66047
66051
  ranking: ranking,
66048
66052
  rating: rating,
@@ -67031,10 +67035,10 @@ function kSet(maxCountables, counted) {
67031
67035
  return isNaN(kset) ? eloConfig.kDefault() : kset;
67032
67036
  }
67033
67037
  var eloConfig = {
67034
- nSpread: 400,
67038
+ nSpread: 400, // determines the 'spread' of the scale
67035
67039
  diffThreshold: 0.125,
67036
- kCalc: k538,
67037
- kMultiplier: kSet,
67040
+ kCalc: k538, // use calculation defined by FiveThirtyEight.com
67041
+ kMultiplier: kSet, // change to kDefault for value of 1
67038
67042
  kDefault: kDefault,
67039
67043
  };
67040
67044
  function calculateNewRatings(params) {
@@ -67576,6 +67580,7 @@ var lastNames = [
67576
67580
  "Dallas",
67577
67581
  "Diamond",
67578
67582
  "Deckard",
67583
+ "Drazic",
67579
67584
  "Dunbar",
67580
67585
  "Earhart",
67581
67586
  "Eisenstein",
@@ -67656,7 +67661,7 @@ var firstFemale = [
67656
67661
  "Amelie",
67657
67662
  "America",
67658
67663
  "Anne",
67659
- "Antoina",
67664
+ "Antonia",
67660
67665
  "Aravis",
67661
67666
  "Astrid",
67662
67667
  "Beatrice",
@@ -68661,7 +68666,7 @@ function anonymizeTournamentRecord(_a) {
68661
68666
  var _b;
68662
68667
  return (_a = {},
68663
68668
  _a[gender] = ((_b = generatePersons({
68664
- category: { ageCategoryCode: 'O18' },
68669
+ category: { ageCategoryCode: 'O18' }, // ageCategoryCode is unimportant since birthYear will be replaced
68665
68670
  count: gendersCount[gender],
68666
68671
  addressProps: { citiesCount: 10 },
68667
68672
  personExtensions: [],