tods-competition-factory 1.8.38 → 1.8.40

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.38';
2932
+ return '1.8.40';
2933
2933
  }
2934
2934
 
2935
2935
  function getObjectTieFormat(obj) {
@@ -22848,7 +22848,7 @@ function getDrawDefinition$1(_a) {
22848
22848
  function bulkScheduleMatchUps$1(_a) {
22849
22849
  var e_1, _b, e_2, _c;
22850
22850
  var _d, _e, _f, _g;
22851
- var _h = _a.errorOnAnachronism, errorOnAnachronism = _h === void 0 ? false : _h, _j = _a.checkChronology, checkChronology = _j === void 0 ? true : _j, matchUpDependencies = _a.matchUpDependencies, tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, matchUpDetails = _a.matchUpDetails, matchUpIds = _a.matchUpIds, schedule = _a.schedule;
22851
+ var _h = _a.scheduleCompletedMatchUps, scheduleCompletedMatchUps = _h === void 0 ? false : _h, _j = _a.scheduleByeMatchUps, scheduleByeMatchUps = _j === void 0 ? false : _j, _k = _a.errorOnAnachronism, errorOnAnachronism = _k === void 0 ? false : _k, _l = _a.checkChronology, checkChronology = _l === void 0 ? true : _l, matchUpDependencies = _a.matchUpDependencies, tournamentRecords = _a.tournamentRecords, tournamentRecord = _a.tournamentRecord, matchUpDetails = _a.matchUpDetails, matchUpIds = _a.matchUpIds, schedule = _a.schedule;
22852
22852
  if (!tournamentRecord)
22853
22853
  return { error: MISSING_TOURNAMENT_RECORD };
22854
22854
  if (!matchUpDetails && (!matchUpIds || !Array.isArray(matchUpIds)))
@@ -22875,19 +22875,23 @@ function bulkScheduleMatchUps$1(_a) {
22875
22875
  }
22876
22876
  // first organize matchUpIds by drawId
22877
22877
  var drawIdMap = inContextMatchUps.reduce(function (drawIdMap, matchUp) {
22878
- var matchUpId = matchUp.matchUpId, drawId = matchUp.drawId;
22879
- if (drawIdMap[drawId]) {
22880
- drawIdMap[drawId].push(matchUpId);
22881
- }
22882
- else {
22883
- drawIdMap[drawId] = [matchUpId];
22878
+ var matchUpId = matchUp.matchUpId, drawId = matchUp.drawId, matchUpStatus = matchUp.matchUpStatus;
22879
+ if ((scheduleByeMatchUps || matchUpStatus !== BYE) &&
22880
+ (scheduleCompletedMatchUps ||
22881
+ !completedMatchUpStatuses.includes(matchUpStatus))) {
22882
+ if (drawIdMap[drawId]) {
22883
+ drawIdMap[drawId].push(matchUpId);
22884
+ }
22885
+ else {
22886
+ drawIdMap[drawId] = [matchUpId];
22887
+ }
22884
22888
  }
22885
22889
  return drawIdMap;
22886
22890
  }, {});
22887
22891
  var detailMatchUpIds = matchUpDetails === null || matchUpDetails === void 0 ? void 0 : matchUpDetails.map(function (detail) { return detail.matchUpId; });
22888
22892
  try {
22889
- for (var _k = __values(Object.keys(drawIdMap)), _l = _k.next(); !_l.done; _l = _k.next()) {
22890
- var drawId = _l.value;
22893
+ for (var _m = __values(Object.keys(drawIdMap)), _o = _m.next(); !_o.done; _o = _m.next()) {
22894
+ var drawId = _o.value;
22891
22895
  var drawDefinition = getDrawDefinition$1({
22892
22896
  tournamentRecord: tournamentRecord,
22893
22897
  drawId: drawId,
@@ -22941,7 +22945,7 @@ function bulkScheduleMatchUps$1(_a) {
22941
22945
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
22942
22946
  finally {
22943
22947
  try {
22944
- if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
22948
+ if (_o && !_o.done && (_b = _m.return)) _b.call(_m);
22945
22949
  }
22946
22950
  finally { if (e_1) throw e_1.error; }
22947
22951
  }
@@ -22952,7 +22956,7 @@ function bulkScheduleMatchUps$1(_a) {
22952
22956
  function bulkScheduleMatchUps(_a) {
22953
22957
  var e_1, _b;
22954
22958
  var _c;
22955
- var errorOnAnachronism = _a.errorOnAnachronism, matchUpContextIds = _a.matchUpContextIds, tournamentRecords = _a.tournamentRecords, checkChronology = _a.checkChronology, matchUpDetails = _a.matchUpDetails, schedule = _a.schedule;
22959
+ var _d = _a.scheduleCompletedMatchUps, scheduleCompletedMatchUps = _d === void 0 ? false : _d, _e = _a.scheduleByeMatchUps, scheduleByeMatchUps = _e === void 0 ? false : _e, errorOnAnachronism = _a.errorOnAnachronism, matchUpContextIds = _a.matchUpContextIds, tournamentRecords = _a.tournamentRecords, checkChronology = _a.checkChronology, matchUpDetails = _a.matchUpDetails, schedule = _a.schedule;
22956
22960
  if (!tournamentRecords)
22957
22961
  return { error: MISSING_TOURNAMENT_RECORDS };
22958
22962
  if (!Array.isArray(matchUpContextIds) && !Array.isArray(matchUpDetails))
@@ -22971,6 +22975,8 @@ function bulkScheduleMatchUps(_a) {
22971
22975
  if ((matchUpIds === null || matchUpIds === void 0 ? void 0 : matchUpIds.length) || (tournamentMatchUpDetails === null || tournamentMatchUpDetails === void 0 ? void 0 : tournamentMatchUpDetails.length)) {
22972
22976
  var result = bulkScheduleMatchUps$1({
22973
22977
  matchUpDetails: tournamentMatchUpDetails,
22978
+ scheduleCompletedMatchUps: scheduleCompletedMatchUps,
22979
+ scheduleByeMatchUps: scheduleByeMatchUps,
22974
22980
  matchUpDependencies: matchUpDependencies,
22975
22981
  errorOnAnachronism: errorOnAnachronism,
22976
22982
  tournamentRecords: tournamentRecords,
@@ -22988,8 +22994,8 @@ function bulkScheduleMatchUps(_a) {
22988
22994
  }
22989
22995
  };
22990
22996
  try {
22991
- for (var _d = __values(Object.values(tournamentRecords)), _e = _d.next(); !_e.done; _e = _d.next()) {
22992
- var tournamentRecord = _e.value;
22997
+ for (var _f = __values(Object.values(tournamentRecords)), _g = _f.next(); !_g.done; _g = _f.next()) {
22998
+ var tournamentRecord = _g.value;
22993
22999
  var state_1 = _loop_1(tournamentRecord);
22994
23000
  if (typeof state_1 === "object")
22995
23001
  return state_1.value;
@@ -22998,7 +23004,7 @@ function bulkScheduleMatchUps(_a) {
22998
23004
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
22999
23005
  finally {
23000
23006
  try {
23001
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
23007
+ if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
23002
23008
  }
23003
23009
  finally { if (e_1) throw e_1.error; }
23004
23010
  }
@@ -29754,7 +29760,7 @@ function getParticipantEntries(params) {
29754
29760
  if ((participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.eventIds) &&
29755
29761
  !participantFilters.eventIds.includes(event_1.eventId))
29756
29762
  return "continue";
29757
- var _p = event_1.drawDefinitions, drawDefinitions = _p === void 0 ? [] : _p, eventType = event_1.eventType, eventName = event_1.eventName, category = event_1.category, entries = event_1.entries, eventId = event_1.eventId, gender = event_1.gender;
29763
+ var _p = event_1.drawDefinitions, drawDefinitions = _p === void 0 ? [] : _p, _q = event_1.extensions, extensions = _q === void 0 ? [] : _q, eventType = event_1.eventType, eventName = event_1.eventName, category = event_1.category, entries = event_1.entries, eventId = event_1.eventId, gender = event_1.gender;
29758
29764
  var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
29759
29765
  var flights = (_c = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) !== null && _c !== void 0 ? _c : [];
29760
29766
  var publishStatuses = getEventPublishStatuses({ event: event_1 });
@@ -29762,19 +29768,15 @@ function getParticipantEntries(params) {
29762
29768
  if (publishStatuses)
29763
29769
  eventsPublishStatuses[eventId] = publishStatuses;
29764
29770
  if (withEvents || withSeeding || withRankingProfile) {
29765
- derivedEventInfo[eventId] = {
29766
- eventName: eventName,
29767
- eventType: eventType,
29768
- category: category,
29769
- eventId: eventId,
29770
- gender: gender,
29771
- };
29771
+ var extensionConversions = convertExtensions
29772
+ ? Object.assign.apply(Object, __spreadArray([{}], __read(extensionsToAttributes(extensions)), false)) : {};
29773
+ derivedEventInfo[eventId] = __assign(__assign({}, extensionConversions), { eventName: eventName, eventType: eventType, category: category, eventId: eventId, gender: gender });
29772
29774
  var scaleNames = [
29773
29775
  category === null || category === void 0 ? void 0 : category.categoryName,
29774
29776
  category === null || category === void 0 ? void 0 : category.ageCategoryCode,
29775
29777
  ].filter(Boolean);
29776
29778
  var _loop_3 = function (entry) {
29777
- var _q;
29779
+ var _r;
29778
29780
  var participantId = entry.participantId;
29779
29781
  if (!participantId || !participantMap[participantId])
29780
29782
  return "continue"; // handle bad data
@@ -29783,13 +29785,13 @@ function getParticipantEntries(params) {
29783
29785
  var seedAssignments, seedValue;
29784
29786
  if (withSeeding) {
29785
29787
  var participant = participantMap[participantId].participant;
29786
- (_q = getEventSeedAssignments({
29788
+ (_r = getEventSeedAssignments({
29787
29789
  publishedSeeding: publishedSeeding,
29788
29790
  usePublishState: usePublishState,
29789
29791
  withSeeding: withSeeding,
29790
29792
  participant: participant,
29791
29793
  event: event_1,
29792
- }), seedAssignments = _q.seedAssignments, seedValue = _q.seedValue);
29794
+ }), seedAssignments = _r.seedAssignments, seedValue = _r.seedValue);
29793
29795
  }
29794
29796
  // IMPORTANT NOTE!
29795
29797
  // id is the pair, team or individual participant currently being processed
@@ -29844,11 +29846,11 @@ function getParticipantEntries(params) {
29844
29846
  };
29845
29847
  var drawIds = unique(__spreadArray(__spreadArray([], __read(drawDefinitions.map(extractAttributes('drawId'))), false), __read(flights.map(extractAttributes('drawId'))), false));
29846
29848
  var _loop_4 = function (drawId) {
29847
- var e_6, _r;
29849
+ var e_6, _s;
29848
29850
  var drawDefinition = drawDefinitions.find(function (drawDefinition) { return drawDefinition.drawId === drawId; });
29849
29851
  var flight = flights === null || flights === void 0 ? void 0 : flights.find(function (flight) { return flight.drawId === drawId; });
29850
29852
  var entries_2 = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) || (flight === null || flight === void 0 ? void 0 : flight.drawEntries);
29851
- var _s = drawDefinition !== null && drawDefinition !== void 0 ? drawDefinition : {}, _t = _s.structures, structures = _t === void 0 ? [] : _t, drawOrder = _s.drawOrder, drawName = _s.drawName, drawType = _s.drawType;
29853
+ var _t = drawDefinition !== null && drawDefinition !== void 0 ? drawDefinition : {}, _u = _t.structures, structures = _u === void 0 ? [] : _u, drawOrder = _t.drawOrder, drawName = _t.drawName, drawType = _t.drawType;
29852
29854
  var flightNumber = flight === null || flight === void 0 ? void 0 : flight.flightNumber;
29853
29855
  var scaleNames = [
29854
29856
  category === null || category === void 0 ? void 0 : category.categoryName,
@@ -30008,7 +30010,7 @@ function getParticipantEntries(params) {
30008
30010
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
30009
30011
  finally {
30010
30012
  try {
30011
- if (relevantEntries_1_1 && !relevantEntries_1_1.done && (_r = relevantEntries_1.return)) _r.call(relevantEntries_1);
30013
+ if (relevantEntries_1_1 && !relevantEntries_1_1.done && (_s = relevantEntries_1.return)) _s.call(relevantEntries_1);
30012
30014
  }
30013
30015
  finally { if (e_6) throw e_6.error; }
30014
30016
  }
@@ -30062,8 +30064,8 @@ function getParticipantEntries(params) {
30062
30064
  event: event_1,
30063
30065
  })) === null || _g === void 0 ? void 0 : _g.matchUps) !== null && _h !== void 0 ? _h : [];
30064
30066
  var _loop_5 = function (matchUp) {
30065
- var e_7, _u;
30066
- var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants, _v = matchUp.tieMatchUps, tieMatchUps = _v === void 0 ? [] : _v, _w = matchUp.sides, sides = _w === void 0 ? [] : _w, winningSide = matchUp.winningSide, matchUpType = matchUp.matchUpType, matchUpId = matchUp.matchUpId, eventId_1 = matchUp.eventId, drawId = matchUp.drawId, collectionId = matchUp.collectionId, stageSequence = matchUp.stageSequence, finishingRound = matchUp.finishingRound, matchUpStatus = matchUp.matchUpStatus, roundPosition = matchUp.roundPosition, roundNumber = matchUp.roundNumber, structureId = matchUp.structureId, schedule = matchUp.schedule, score = matchUp.score, stage = matchUp.stage;
30067
+ var e_7, _v;
30068
+ var finishingPositionRange = matchUp.finishingPositionRange, potentialParticipants = matchUp.potentialParticipants, _w = matchUp.tieMatchUps, tieMatchUps = _w === void 0 ? [] : _w, _x = matchUp.sides, sides = _x === void 0 ? [] : _x, winningSide = matchUp.winningSide, matchUpType = matchUp.matchUpType, matchUpId = matchUp.matchUpId, eventId_1 = matchUp.eventId, drawId = matchUp.drawId, collectionId = matchUp.collectionId, stageSequence = matchUp.stageSequence, finishingRound = matchUp.finishingRound, matchUpStatus = matchUp.matchUpStatus, roundPosition = matchUp.roundPosition, roundNumber = matchUp.roundNumber, structureId = matchUp.structureId, schedule = matchUp.schedule, score = matchUp.score, stage = matchUp.stage;
30067
30069
  mappedMatchUps[matchUpId] = matchUp;
30068
30070
  var baseAttrs = {
30069
30071
  finishingPositionRange: finishingPositionRange,
@@ -30083,14 +30085,14 @@ function getParticipantEntries(params) {
30083
30085
  try {
30084
30086
  for (var tieMatchUps_1 = (e_7 = void 0, __values(tieMatchUps)), tieMatchUps_1_1 = tieMatchUps_1.next(); !tieMatchUps_1_1.done; tieMatchUps_1_1 = tieMatchUps_1.next()) {
30085
30087
  var tieMatchUp = tieMatchUps_1_1.value;
30086
- var tieMatchUpWinningSide = tieMatchUp.winningSide, _x = tieMatchUp.sides, tieMatchUpSides = _x === void 0 ? [] : _x, tieMatchUpId = tieMatchUp.matchUpId, matchUpStatus_1 = tieMatchUp.matchUpStatus, matchUpType_1 = tieMatchUp.matchUpType;
30088
+ var tieMatchUpWinningSide = tieMatchUp.winningSide, _y = tieMatchUp.sides, tieMatchUpSides = _y === void 0 ? [] : _y, tieMatchUpId = tieMatchUp.matchUpId, matchUpStatus_1 = tieMatchUp.matchUpStatus, matchUpType_1 = tieMatchUp.matchUpType;
30087
30089
  processSides(__assign(__assign(__assign({}, baseAttrs), withOpts), { winningSide: tieMatchUpWinningSide, tieWinningSide: winningSide, matchUpTieId: matchUpId, matchUpId: tieMatchUpId, sides: tieMatchUpSides, matchUpSides: sides, matchUpStatus: matchUpStatus_1, matchUpType: matchUpType_1 }));
30088
30090
  }
30089
30091
  }
30090
30092
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
30091
30093
  finally {
30092
30094
  try {
30093
- if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (_u = tieMatchUps_1.return)) _u.call(tieMatchUps_1);
30095
+ if (tieMatchUps_1_1 && !tieMatchUps_1_1.done && (_v = tieMatchUps_1.return)) _v.call(tieMatchUps_1);
30094
30096
  }
30095
30097
  finally { if (e_7) throw e_7.error; }
30096
30098
  }
@@ -30164,8 +30166,8 @@ function getParticipantEntries(params) {
30164
30166
  if (withStatistics || withRankingProfile || !!scheduleAnalysis) {
30165
30167
  var aggregators = Object.values(participantMap);
30166
30168
  var _loop_2 = function (participantAggregator) {
30167
- var e_8, _y, e_9, _z, e_10, _0;
30168
- var _1 = participantAggregator.counters, wins = _1.wins, losses = _1.losses, _2 = SINGLES$1, _3 = _1[_2], singlesWins = _3.wins, singlesLosses = _3.losses, _4 = DOUBLES$1, _5 = _1[_4], doublesWins = _5.wins, doublesLosses = _5.losses;
30169
+ var e_8, _z, e_9, _0, e_10, _1;
30170
+ var _2 = participantAggregator.counters, wins = _2.wins, losses = _2.losses, _3 = SINGLES$1, _4 = _2[_3], singlesWins = _4.wins, singlesLosses = _4.losses, _5 = DOUBLES$1, _6 = _2[_5], doublesWins = _6.wins, doublesLosses = _6.losses;
30169
30171
  var addStatValue = function (statCode, wins, losses) {
30170
30172
  var denominator = wins + losses;
30171
30173
  var numerator = wins;
@@ -30188,7 +30190,7 @@ function getParticipantEntries(params) {
30188
30190
  return Math.abs(range[0] - range[1]);
30189
30191
  };
30190
30192
  var _loop_7 = function (drawId) {
30191
- var _8 = derivedDrawInfo[drawId] || {}, _9 = _8.orderedStructureIds, orderedStructureIds = _9 === void 0 ? [] : _9, flightNumber = _8.flightNumber;
30193
+ var _9 = derivedDrawInfo[drawId] || {}, _10 = _9.orderedStructureIds, orderedStructureIds = _10 === void 0 ? [] : _10, flightNumber = _9.flightNumber;
30192
30194
  if (participantAggregator.structureParticipation &&
30193
30195
  orderedStructureIds.length) {
30194
30196
  var finishingPositionRange_1;
@@ -30224,15 +30226,15 @@ function getParticipantEntries(params) {
30224
30226
  }
30225
30227
  };
30226
30228
  try {
30227
- for (var _6 = (e_8 = void 0, __values(Object.keys(participantAggregator.draws))), _7 = _6.next(); !_7.done; _7 = _6.next()) {
30228
- var drawId = _7.value;
30229
+ for (var _7 = (e_8 = void 0, __values(Object.keys(participantAggregator.draws))), _8 = _7.next(); !_8.done; _8 = _7.next()) {
30230
+ var drawId = _8.value;
30229
30231
  _loop_7(drawId);
30230
30232
  }
30231
30233
  }
30232
30234
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
30233
30235
  finally {
30234
30236
  try {
30235
- if (_7 && !_7.done && (_y = _6.return)) _y.call(_6);
30237
+ if (_8 && !_8.done && (_z = _7.return)) _z.call(_7);
30236
30238
  }
30237
30239
  finally { if (e_8) throw e_8.error; }
30238
30240
  }
@@ -30303,7 +30305,7 @@ function getParticipantEntries(params) {
30303
30305
  catch (e_10_1) { e_10 = { error: e_10_1 }; }
30304
30306
  finally {
30305
30307
  try {
30306
- if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (_0 = scheduleItemsToConsider_1.return)) _0.call(scheduleItemsToConsider_1);
30308
+ if (scheduleItemsToConsider_1_1 && !scheduleItemsToConsider_1_1.done && (_1 = scheduleItemsToConsider_1.return)) _1.call(scheduleItemsToConsider_1);
30307
30309
  }
30308
30310
  finally { if (e_10) throw e_10.error; }
30309
30311
  }
@@ -30312,7 +30314,7 @@ function getParticipantEntries(params) {
30312
30314
  catch (e_9_1) { e_9 = { error: e_9_1 }; }
30313
30315
  finally {
30314
30316
  try {
30315
- if (scheduleItems_1_1 && !scheduleItems_1_1.done && (_z = scheduleItems_1.return)) _z.call(scheduleItems_1);
30317
+ if (scheduleItems_1_1 && !scheduleItems_1_1.done && (_0 = scheduleItems_1.return)) _0.call(scheduleItems_1);
30316
30318
  }
30317
30319
  finally { if (e_9) throw e_9.error; }
30318
30320
  }
@@ -35253,10 +35255,15 @@ function processAlreadyScheduledMatchUps(_a) {
35253
35255
  var e_1, _b;
35254
35256
  var _c, _d;
35255
35257
  var matchUpPotentialParticipantIds = _a.matchUpPotentialParticipantIds, individualParticipantProfiles = _a.individualParticipantProfiles, dateScheduledMatchUpIds = _a.dateScheduledMatchUpIds, greatestAverageMinutes = _a.greatestAverageMinutes, dateScheduledMatchUps = _a.dateScheduledMatchUps, matchUpNotBeforeTimes = _a.matchUpNotBeforeTimes, matchUpScheduleTimes = _a.matchUpScheduleTimes, matchUpDependencies = _a.matchUpDependencies, clearScheduleDates = _a.clearScheduleDates, scheduleDate = _a.scheduleDate, minutesMap = _a.minutesMap, matchUps = _a.matchUps;
35258
+ var byeScheduledMatchUpIds = [];
35256
35259
  if (!dateScheduledMatchUpIds) {
35257
35260
  dateScheduledMatchUps = matchUps === null || matchUps === void 0 ? void 0 : matchUps.filter(function (matchUp) {
35258
35261
  var schedule = matchUp.schedule || {};
35259
- return (hasSchedule({ schedule: schedule }) &&
35262
+ var isByeMatchUp = matchUp.matchUpStatus === BYE;
35263
+ if (isByeMatchUp)
35264
+ byeScheduledMatchUpIds.push(matchUp.matchUpId);
35265
+ return (!isByeMatchUp &&
35266
+ hasSchedule({ schedule: schedule }) &&
35260
35267
  (!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate));
35261
35268
  });
35262
35269
  dateScheduledMatchUpIds = dateScheduledMatchUps.map(getMatchUpId);
@@ -35307,7 +35314,12 @@ function processAlreadyScheduledMatchUps(_a) {
35307
35314
  }
35308
35315
  finally { if (e_1) throw e_1.error; }
35309
35316
  }
35310
- return { clearDate: clearDate, dateScheduledMatchUpIds: dateScheduledMatchUpIds, dateScheduledMatchUps: dateScheduledMatchUps };
35317
+ return {
35318
+ dateScheduledMatchUpIds: dateScheduledMatchUpIds,
35319
+ byeScheduledMatchUpIds: byeScheduledMatchUpIds,
35320
+ dateScheduledMatchUps: dateScheduledMatchUps,
35321
+ clearDate: clearDate,
35322
+ };
35311
35323
  }
35312
35324
 
35313
35325
  // groups schedule profile rounds where adjacent hashes are equivalent
@@ -35452,7 +35464,10 @@ function generateBookings(_a) {
35452
35464
  (!scheduleDate || matchUp.schedule.scheduledDate === scheduleDate));
35453
35465
  });
35454
35466
  }
35455
- var relevantMatchUps = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.filter(function (matchUp) { return !venueIds.length || venueIds.includes(matchUp.schedule.venueId); });
35467
+ var relevantMatchUps = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.filter(function (matchUp) {
35468
+ return (!venueIds.length || venueIds.includes(matchUp.schedule.venueId)) &&
35469
+ matchUp.matchUpStatus !== BYE;
35470
+ });
35456
35471
  var bookings = relevantMatchUps === null || relevantMatchUps === void 0 ? void 0 : relevantMatchUps.map(function (_a) {
35457
35472
  var eventId = _a.eventId, schedule = _a.schedule, matchUpFormat = _a.matchUpFormat;
35458
35473
  var _b = eventDetails[eventId], event = _b.event, scheduleTiming = _b.scheduleTiming;
@@ -35545,6 +35560,7 @@ function getVenueSchedulingDetails(_a) {
35545
35560
  var venueScheduledRoundDetails = {};
35546
35561
  // checking that matchUpDependencies is scoped to only those matchUps that are already or are to be scheduled on the same date
35547
35562
  var allDateScheduledMatchUpIds = [];
35563
+ var allDateScheduledByeMatchUpIds = [];
35548
35564
  var allDateMatchUpIds = [];
35549
35565
  var _loop_1 = function (venue) {
35550
35566
  var _d;
@@ -35593,8 +35609,10 @@ function getVenueSchedulingDetails(_a) {
35593
35609
  minutesMap: minutesMap,
35594
35610
  matchUps: matchUps,
35595
35611
  });
35596
- var clearDate = processResult.clearDate;
35597
35612
  (dateScheduledMatchUpIds = processResult.dateScheduledMatchUpIds, dateScheduledMatchUps = processResult.dateScheduledMatchUps);
35613
+ var byeScheduledMatchUpIds = processResult.byeScheduledMatchUpIds, clearDate = processResult.clearDate;
35614
+ if (byeScheduledMatchUpIds === null || byeScheduledMatchUpIds === void 0 ? void 0 : byeScheduledMatchUpIds.length)
35615
+ allDateScheduledByeMatchUpIds.push.apply(allDateScheduledByeMatchUpIds, __spreadArray([], __read(byeScheduledMatchUpIds), false));
35598
35616
  var _g = getMatchUpsToSchedule({
35599
35617
  matchUpPotentialParticipantIds: matchUpPotentialParticipantIds,
35600
35618
  scheduleCompletedMatchUps: scheduleCompletedMatchUps,
@@ -35638,6 +35656,7 @@ function getVenueSchedulingDetails(_a) {
35638
35656
  finally { if (e_1) throw e_1.error; }
35639
35657
  }
35640
35658
  return {
35659
+ allDateScheduledByeMatchUpIds: allDateScheduledByeMatchUpIds,
35641
35660
  allDateScheduledMatchUpIds: allDateScheduledMatchUpIds,
35642
35661
  venueScheduledRoundDetails: venueScheduledRoundDetails,
35643
35662
  allDateMatchUpIds: allDateMatchUpIds,
@@ -36274,7 +36293,7 @@ function proScheduler(_a) {
36274
36293
  matchUps: matchUps,
36275
36294
  courts: courts,
36276
36295
  venues: venues,
36277
- }), allDateScheduledMatchUpIds = _k.allDateScheduledMatchUpIds, venueScheduledRoundDetails = _k.venueScheduledRoundDetails, allDateMatchUpIds = _k.allDateMatchUpIds;
36296
+ }), allDateScheduledByeMatchUpIds = _k.allDateScheduledByeMatchUpIds, allDateScheduledMatchUpIds = _k.allDateScheduledMatchUpIds, venueScheduledRoundDetails = _k.venueScheduledRoundDetails, allDateMatchUpIds = _k.allDateMatchUpIds;
36278
36297
  var dateScheduledMatchUps = matchUps.filter(function (_a) {
36279
36298
  var matchUpId = _a.matchUpId;
36280
36299
  return allDateScheduledMatchUpIds.includes(matchUpId);
@@ -36595,6 +36614,7 @@ function proScheduler(_a) {
36595
36614
  }
36596
36615
  finally { if (e_3) throw e_3.error; }
36597
36616
  }
36617
+ if (!dryRun && (allDateScheduledByeMatchUpIds === null || allDateScheduledByeMatchUpIds === void 0 ? void 0 : allDateScheduledByeMatchUpIds.length)) ;
36598
36618
  try {
36599
36619
  for (var _l = (e_4 = void 0, __values(dateSchedulingProfile.venues)), _m = _l.next(); !_m.done; _m = _l.next()) {
36600
36620
  var venue = _m.value;
@@ -37942,8 +37962,10 @@ function getRoundProfile(matchUps) {
37942
37962
  return winningSide || completedMatchUpStatuses.includes(matchUpStatus);
37943
37963
  }).length || 0;
37944
37964
  var scheduledCount = matchUps.filter(function (_a) {
37945
- var schedule = _a.schedule;
37946
- return (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledDate) && (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledTime);
37965
+ var schedule = _a.schedule, matchUpStatus = _a.matchUpStatus;
37966
+ return (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledDate) &&
37967
+ (schedule === null || schedule === void 0 ? void 0 : schedule.scheduledTime) &&
37968
+ matchUpStatus !== BYE;
37947
37969
  }).length || 0;
37948
37970
  var consideredCount = matchUpsCount - byeCount;
37949
37971
  var isComplete = consideredCount === completedCount;
@@ -63165,7 +63187,7 @@ function refreshEventDrawOrder(_a) {
63165
63187
 
63166
63188
  function deleteFlightAndFlightDraw(_a) {
63167
63189
  var _b, _c;
63168
- var _d = _a.autoPublish, autoPublish = _d === void 0 ? true : _d, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, drawId = _a.drawId, event = _a.event;
63190
+ var _d = _a.autoPublish, autoPublish = _d === void 0 ? true : _d, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, drawId = _a.drawId, event = _a.event, force = _a.force;
63169
63191
  if (!tournamentRecord)
63170
63192
  return { error: MISSING_TOURNAMENT_RECORD };
63171
63193
  if (!drawId)
@@ -63195,6 +63217,7 @@ function deleteFlightAndFlightDraw(_a) {
63195
63217
  autoPublish: autoPublish,
63196
63218
  auditData: auditData,
63197
63219
  event: event,
63220
+ force: force,
63198
63221
  });
63199
63222
  if (result.error)
63200
63223
  return result;
@@ -64481,7 +64504,7 @@ function generateDrawDefinition(params) {
64481
64504
  tournamentRecord: tournamentRecord,
64482
64505
  event: event,
64483
64506
  }).appliedPolicies) !== null && _j !== void 0 ? _j : {};
64484
- var policyDefinitions = (_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {};
64507
+ var policyDefinitions = makeDeepCopy((_k = params.policyDefinitions) !== null && _k !== void 0 ? _k : {}, false, true);
64485
64508
  var drawTypeCoercion = (_q = (_o = (_l = params.drawTypeCoercion) !== null && _l !== void 0 ? _l : (_m = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_DRAWS]) === null || _m === void 0 ? void 0 : _m.drawTypeCoercion) !== null && _o !== void 0 ? _o : (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_DRAWS]) === null || _p === void 0 ? void 0 : _p.drawTypeCoercion) !== null && _q !== void 0 ? _q : true;
64486
64509
  var drawType = (drawTypeCoercion &&
64487
64510
  params.drawSize === 2 &&