tods-competition-factory 1.8.36 → 1.8.37

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.
@@ -1531,7 +1531,9 @@ type MappedParticipant = {
1531
1531
  eventId: string;
1532
1532
  drawId: string;
1533
1533
  }[];
1534
- scheduleConflicts: ScheduleConflict[];
1534
+ scheduleConflicts: {
1535
+ [key: string]: ScheduleConflict;
1536
+ };
1535
1537
  scheduleItems: any[];
1536
1538
  participant: HydratedParticipant & {
1537
1539
  groupParticipantIds: string[];
@@ -3544,15 +3544,16 @@ function addNationalityCode({
3544
3544
  persons.forEach(annotatePerson);
3545
3545
  }
3546
3546
 
3547
- function addIndividualParticipants({ participantMap }) {
3547
+ function addIndividualParticipants({ participantMap, template }) {
3548
3548
  const participantObjects = Object.values(participantMap);
3549
3549
  for (const participantObject of participantObjects) {
3550
3550
  const participant = participantObject.participant;
3551
3551
  if (participant.individualParticipantIds?.length) {
3552
3552
  participant.individualParticipants = [];
3553
3553
  for (const participantId of participant.individualParticipantIds) {
3554
+ const source = participantMap[participantId].participant;
3554
3555
  participant.individualParticipants.push(
3555
- participantMap[participantId].participant
3556
+ template ? attributeFilter({ template, source }) : source
3556
3557
  );
3557
3558
  }
3558
3559
  }
@@ -3693,8 +3694,10 @@ function getParticipantMap({
3693
3694
  withIOC
3694
3695
  });
3695
3696
  }
3696
- if (withIndividualParticipants)
3697
- addIndividualParticipants({ participantMap });
3697
+ if (withIndividualParticipants) {
3698
+ const template = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
3699
+ addIndividualParticipants({ participantMap, template });
3700
+ }
3698
3701
  return { participantMap };
3699
3702
  }
3700
3703
  function signedIn(participant) {
@@ -3754,7 +3757,7 @@ function initializeParticipantId({ participantMap, participantId }) {
3754
3757
  participantMap[participantId] = {
3755
3758
  structureParticipation: {},
3756
3759
  potentialMatchUps: {},
3757
- scheduleConflicts: [],
3760
+ scheduleConflicts: {},
3758
3761
  scheduleItems: [],
3759
3762
  participant: {
3760
3763
  groupParticipantIds: [],
@@ -12822,15 +12825,16 @@ function getParticipantEntries(params) {
12822
12825
  const itemIsPrior = consideredMinutes >= scheduledMinutes;
12823
12826
  const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
12824
12827
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
12825
- participantAggregator.scheduleConflicts.push({
12828
+ const key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort().join("|");
12829
+ participantAggregator.scheduleConflicts[key] = {
12826
12830
  priorScheduledMatchUpId: scheduleItem.matchUpId,
12827
12831
  matchUpIdWithConflict: consideredItem.matchUpId
12828
- });
12832
+ };
12829
12833
  }
12830
12834
  }
12831
12835
  }
12832
12836
  const pid = participantAggregator.participant.participantId;
12833
- if (participantAggregator.scheduleConflicts.length) {
12837
+ if (Object.keys(participantAggregator.scheduleConflicts).length) {
12834
12838
  participantIdsWithConflicts.push(pid);
12835
12839
  }
12836
12840
  participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
@@ -12941,7 +12945,7 @@ function getParticipants(params) {
12941
12945
  return definedAttributes(
12942
12946
  {
12943
12947
  ...participant,
12944
- scheduleConflicts: scheduleAnalysis ? scheduleConflicts : void 0,
12948
+ scheduleConflicts: scheduleAnalysis ? Object.values(scheduleConflicts) : void 0,
12945
12949
  draws: withDraws || withRankingProfile ? participantDraws : void 0,
12946
12950
  events: withEvents || withRankingProfile ? Object.values(events) : void 0,
12947
12951
  matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
@@ -12968,12 +12972,14 @@ function getParticipants(params) {
12968
12972
  tournamentRecord
12969
12973
  });
12970
12974
  if (withIndividualParticipants) {
12975
+ const template2 = isObject(withIndividualParticipants) ? withIndividualParticipants : void 0;
12971
12976
  for (const participant of filteredParticipants) {
12972
12977
  for (const individualParticipantId of participant.individualParticipantIds ?? []) {
12973
12978
  if (!participant.individualParticipants)
12974
12979
  participant.individualParticipants = [];
12980
+ const source = ppMap.get(individualParticipantId);
12975
12981
  participant.individualParticipants.push(
12976
- ppMap.get(individualParticipantId)
12982
+ template2 ? attributeFilter({ template: template2, source }) : source
12977
12983
  );
12978
12984
  }
12979
12985
  }