tods-competition-factory 2.0.47 → 2.0.48

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.47';
6
+ return '2.0.48';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -34189,7 +34189,9 @@ function getDrawData(params) {
34189
34189
  drawPosition,
34190
34190
  };
34191
34191
  });
34192
- if (matchUps.length && ((!participantResults?.length && params.allParticipantResults) || refreshResults)) {
34192
+ if (matchUps.length &&
34193
+ ((!participantResults?.length && params.allParticipantResults) ||
34194
+ (refreshResults && !structure.structures))) {
34193
34195
  const { subOrderMap } = createSubOrderMap({ positionAssignments });
34194
34196
  const result = tallyParticipantResults({
34195
34197
  matchUpFormat: structure.matchUpFormat,
@@ -40967,10 +40969,10 @@ function modifyParticipant(params) {
40967
40969
  newValues.contacts = contacts;
40968
40970
  if (onlineResources)
40969
40971
  newValues.onlineResources = onlineResources;
40970
- if (participantName && typeof participantName === 'string')
40971
- newValues.participantName = participantName;
40972
- if (participantOtherName && typeof participantOtherName === 'string')
40972
+ if (participantOtherName && isString(participantOtherName))
40973
40973
  newValues.participantOtherName = participantOtherName;
40974
+ if (participantName && isString(participantName))
40975
+ newValues.participantName = participantName;
40974
40976
  if (Array.isArray(individualParticipantIds)) {
40975
40977
  const { participants: individualParticipants } = getParticipants({
40976
40978
  participantFilters: { participantTypes: [INDIVIDUAL] },
@@ -40978,7 +40980,7 @@ function modifyParticipant(params) {
40978
40980
  });
40979
40981
  const allIndividualParticipantIds = individualParticipants?.map(getParticipantId);
40980
40982
  if (allIndividualParticipantIds) {
40981
- const updatedIndividualParticipantIds = individualParticipantIds.filter((participantId) => typeof participantId === 'string' && allIndividualParticipantIds.includes(participantId));
40983
+ const updatedIndividualParticipantIds = individualParticipantIds.filter((participantId) => isString(participantId) && allIndividualParticipantIds.includes(participantId));
40982
40984
  if ([GROUP, TEAM$1].includes(participantType || existingParticipant.participantType) ||
40983
40985
  (participantType === PAIR && (updatedIndividualParticipantIds.length === 2 || pairOverride))) {
40984
40986
  newValues.individualParticipantIds = updatedIndividualParticipantIds;
@@ -41040,23 +41042,22 @@ function generatePairParticipantName$1({ individualParticipants, newValues }) {
41040
41042
  }
41041
41043
  function updatePerson({ updateParticipantName, existingParticipant, newValues, person }) {
41042
41044
  const newPersonValues = {};
41043
- const { standardFamilyName, standardGivenName, nationalityCode, personId, sex } = person;
41045
+ const { standardFamilyName, standardGivenName, nationalityCode, personId, birthdate, tennisId, sex } = person;
41044
41046
  if (sex && Object.keys(genderConstants).includes(sex))
41045
41047
  newPersonValues.sex = sex;
41046
41048
  let personNameModified;
41047
- if (personId && typeof personId === 'string') {
41049
+ if (isString(personId))
41048
41050
  newPersonValues.personId = personId;
41049
- }
41050
41051
  if (nationalityCode &&
41051
- typeof nationalityCode === 'string' &&
41052
+ isString(nationalityCode) &&
41052
41053
  (validNationalityCode(nationalityCode) || nationalityCode === '')) {
41053
41054
  newPersonValues.nationalityCode = nationalityCode;
41054
41055
  }
41055
- if (standardFamilyName && typeof standardFamilyName === 'string' && standardFamilyName.length > 1) {
41056
+ if (standardFamilyName && typeof isString(standardFamilyName) && standardFamilyName.length > 1) {
41056
41057
  newPersonValues.standardFamilyName = standardFamilyName;
41057
41058
  personNameModified = true;
41058
41059
  }
41059
- if (standardGivenName && typeof standardGivenName === 'string' && standardGivenName.length > 1) {
41060
+ if (standardGivenName && typeof isString(standardGivenName) && standardGivenName.length > 1) {
41060
41061
  newPersonValues.standardGivenName = standardGivenName;
41061
41062
  personNameModified = true;
41062
41063
  }
@@ -41064,6 +41065,12 @@ function updatePerson({ updateParticipantName, existingParticipant, newValues, p
41064
41065
  const participantName = `${newPersonValues.standardGivenName} ${newPersonValues.standardFamilyName}`;
41065
41066
  newValues.participantName = participantName;
41066
41067
  }
41068
+ if (birthdate && isValidDateString(birthdate)) {
41069
+ newPersonValues.birthdate = birthdate;
41070
+ }
41071
+ if (tennisId && isString(tennisId)) {
41072
+ newPersonValues.tennisId = tennisId;
41073
+ }
41067
41074
  Object.assign(existingParticipant.person, newPersonValues);
41068
41075
  }
41069
41076
  function validNationalityCode(code) {
@@ -47716,13 +47723,13 @@ function generateParticipants(params) {
47716
47723
  participantType: INDIVIDUAL,
47717
47724
  participantName,
47718
47725
  person: {
47719
- addresses: [address],
47720
47726
  personId: personId || (personIds?.length && personIds[participantIndex]) || UUID(),
47727
+ birthDate: isValidDateString(birthDate) ? birthDate : undefined,
47728
+ addresses: [address],
47721
47729
  standardFamilyName,
47722
47730
  standardGivenName,
47723
47731
  nationalityCode,
47724
47732
  extensions,
47725
- birthDate: isValidDateString(birthDate) ? birthDate : undefined,
47726
47733
  sex,
47727
47734
  },
47728
47735
  });