tods-competition-factory 2.2.48 → 2.2.49

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.
@@ -5739,6 +5739,7 @@ declare function bulkMatchUpStatusUpdate(params: any): ResultType | {
5739
5739
  message: string;
5740
5740
  code: string;
5741
5741
  };
5742
+ info?: undefined;
5742
5743
  } | {
5743
5744
  error: {
5744
5745
  message: string;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.48';
6
+ return '2.2.49';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -2256,7 +2256,7 @@ function isValidMatchUpFormat({ matchUpFormat }) {
2256
2256
  const preserveRedundant = !!((setParts && tiebreakTo && setsTo === tiebreakAt) ||
2257
2257
  (finalSetParts && finalSetTiebreakTo && finalSetTo === finalTiebreakAt));
2258
2258
  const stringified = stringify(parsedFormat, preserveRedundant);
2259
- return stringified === matchUpFormat;
2259
+ return stringified === matchUpFormat.replace(/G/, '');
2260
2260
  }
2261
2261
 
2262
2262
  const validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
@@ -55530,12 +55530,12 @@ function proConflicts({ tournamentRecords, matchUps, }) {
55530
55530
  const sourceMatchUpIds = deps[matchUpId].matchUpIds;
55531
55531
  sourceMatchUpIds.length && profile.sourceMatchUpIds.push(...sourceMatchUpIds);
55532
55532
  const matchUpParticipantIds = sides
55533
- ?.map((side) => [side.participant?.individualParticipantIds, side.participantId])
55533
+ ?.flatMap((side) => [side.participant?.individualParticipantIds, side.participantId])
55534
55534
  .flat()
55535
55535
  .filter(Boolean) ?? [];
55536
55536
  const potentialMatchUpParticipantIds = potentialParticipants
55537
55537
  ?.flat()
55538
- .map(({ individualParticipantIds, participantId }) => [individualParticipantIds, participantId])
55538
+ .flatMap(({ individualParticipantIds, participantId }) => [individualParticipantIds, participantId])
55539
55539
  .flat()
55540
55540
  .filter(Boolean) || [];
55541
55541
  profile.participantIds.push(...potentialMatchUpParticipantIds, ...matchUpParticipantIds);
@@ -55550,6 +55550,41 @@ function proConflicts({ tournamentRecords, matchUps, }) {
55550
55550
  }));
55551
55551
  const sourceDistance = (a, b) => deps[a].sources.reduce((distance, round, index) => (round.includes(b) && index + 1) || distance, 0);
55552
55552
  const rowIssues = rowProfiles.map(() => []);
55553
+ const addWarningToMatchUp = (matchUpId, warnedMatchUpIds, participantConflicts) => {
55554
+ if (!participantConflicts[matchUpId])
55555
+ participantConflicts[matchUpId] = {};
55556
+ if (!participantConflicts[matchUpId][SCHEDULE_WARNING]) {
55557
+ participantConflicts[matchUpId][SCHEDULE_WARNING] = warnedMatchUpIds.filter((id) => id !== matchUpId);
55558
+ }
55559
+ };
55560
+ const processParticipantWarnings = (previousRow, row, participantConflicts) => {
55561
+ const previousRowWarnings = row.participantIds.filter((id) => previousRow.participantIds.includes(id));
55562
+ previousRowWarnings.forEach((participantId) => {
55563
+ const warnedMatchUpIds = row.matchUpIds
55564
+ .concat(previousRow.matchUpIds)
55565
+ .filter((matchUpId) => deps[matchUpId].participantIds.includes(participantId));
55566
+ warnedMatchUpIds.forEach((matchUpId) => {
55567
+ addWarningToMatchUp(matchUpId, warnedMatchUpIds, participantConflicts);
55568
+ });
55569
+ });
55570
+ };
55571
+ const addConflictToMatchUp = (matchUpId, conflictedMatchUpIds, participantConflicts) => {
55572
+ if (!participantConflicts[matchUpId])
55573
+ participantConflicts[matchUpId] = {};
55574
+ if (!participantConflicts[matchUpId][SCHEDULE_CONFLICT]) {
55575
+ participantConflicts[matchUpId][SCHEDULE_CONFLICT] = conflictedMatchUpIds.filter((id) => id !== matchUpId);
55576
+ }
55577
+ };
55578
+ const processParticipantConflicts = (row) => {
55579
+ const participantConflicts = {};
55580
+ const instances = instanceCount(row.participantIds);
55581
+ const conflictedParticipantIds = new Set(Object.keys(instances).filter((key) => instances[key] > 1));
55582
+ const conflictedMatchUpIds = row.matchUpIds.filter((matchUpId) => deps[matchUpId].participantIds.some((id) => conflictedParticipantIds.has(id)));
55583
+ conflictedMatchUpIds.forEach((matchUpId) => {
55584
+ addConflictToMatchUp(matchUpId, conflictedMatchUpIds, participantConflicts);
55585
+ });
55586
+ return participantConflicts;
55587
+ };
55553
55588
  const annotate = (matchUpId, issue, issueType, issueIds) => {
55554
55589
  if (!mappedMatchUps[matchUpId].schedule[SCHEDULE_STATE]) {
55555
55590
  mappedMatchUps[matchUpId].schedule[SCHEDULE_STATE] = issue;
@@ -55569,31 +55604,9 @@ function proConflicts({ tournamentRecords, matchUps, }) {
55569
55604
  rowProfiles.forEach((row, rowIndex) => {
55570
55605
  const previousRow = rowIndex ? rowProfiles[rowIndex - 1] : undefined;
55571
55606
  const subsequentRows = rowProfiles.slice(rowIndex + 1);
55572
- const participantConflicts = {};
55573
- const instances = instanceCount(row.participantIds);
55574
- const conflictedParticipantIds = Object.keys(instances).filter((key) => instances[key] > 1);
55575
- const conflictedMatchUpIds = row.matchUpIds.filter((matchUpId) => deps[matchUpId].participantIds.some((id) => conflictedParticipantIds.includes(id)));
55576
- conflictedMatchUpIds.forEach((matchUpId) => {
55577
- if (!participantConflicts[matchUpId])
55578
- participantConflicts[matchUpId] = {};
55579
- if (!participantConflicts[matchUpId][SCHEDULE_CONFLICT]) {
55580
- participantConflicts[matchUpId][SCHEDULE_CONFLICT] = conflictedMatchUpIds.filter((id) => id !== matchUpId);
55581
- }
55582
- });
55583
- const previousRowWarnings = previousRow && row.participantIds.filter((id) => previousRow.participantIds.includes(id));
55584
- if (previousRowWarnings) {
55585
- previousRowWarnings.forEach((participantId) => {
55586
- const warnedMatchUpIds = row.matchUpIds
55587
- .concat(previousRow.matchUpIds)
55588
- .filter((matchUpId) => deps[matchUpId].participantIds.includes(participantId));
55589
- warnedMatchUpIds.forEach((matchUpId) => {
55590
- if (!participantConflicts[matchUpId])
55591
- participantConflicts[matchUpId] = {};
55592
- if (!participantConflicts[matchUpId][SCHEDULE_WARNING]) {
55593
- participantConflicts[matchUpId][SCHEDULE_WARNING] = warnedMatchUpIds.filter((id) => id !== matchUpId);
55594
- }
55595
- });
55596
- });
55607
+ const participantConflicts = processParticipantConflicts(row);
55608
+ if (previousRow) {
55609
+ processParticipantWarnings(previousRow, row, participantConflicts);
55597
55610
  }
55598
55611
  row.matchUpIds.forEach((matchUpId) => {
55599
55612
  const sourceMatchUpIds = deps[matchUpId].matchUpIds;