tods-competition-factory 1.8.9 → 1.8.10

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.
@@ -1660,6 +1660,7 @@ type GetPolicyDefinitionsArgs = {
1660
1660
  declare function getPolicyDefinitions({ policyTypes, tournamentRecord, drawDefinition, structure, event, }: GetPolicyDefinitionsArgs): {
1661
1661
  policyDefinitions?: PolicyDefinitions;
1662
1662
  error?: ErrorType;
1663
+ info?: string;
1663
1664
  };
1664
1665
 
1665
1666
  type ResultType = {
@@ -2133,9 +2134,8 @@ interface ParticipantScaleItemArgs {
2133
2134
  requireTimeStamp?: boolean;
2134
2135
  participant: Participant;
2135
2136
  }
2136
- declare function participantScaleItem({ requireTimeStamp, scaleAttributes, participant, }: ParticipantScaleItemArgs): {
2137
+ declare function participantScaleItem({ requireTimeStamp, scaleAttributes, participant, }: ParticipantScaleItemArgs): ResultType & {
2137
2138
  scaleItem?: ScaleItem;
2138
- error?: ErrorType;
2139
2139
  };
2140
2140
 
2141
2141
  type GetValidGroupSizesArgs = {
@@ -289,10 +289,6 @@ const INVALID_SCALE_ITEM = {
289
289
  message: "Invalid scaleItem",
290
290
  code: "ERR_INVALID_SCALE_ITEM"
291
291
  };
292
- const SCALE_ITEM_NOT_FOUND = {
293
- message: "No scaleItem found",
294
- code: "ERR_NOT_FOUND_SCALE_ITEM"
295
- };
296
292
  const INVALID_OBJECT = {
297
293
  message: "Invalid object",
298
294
  code: "ERR_INVALID_OBJECT"
@@ -976,7 +972,7 @@ function getPolicyDefinitions({
976
972
  if (policy)
977
973
  policyDefinitions[policyType] = policy;
978
974
  }
979
- return Object.keys(policyDefinitions).length ? { policyDefinitions } : { error: POLICY_NOT_FOUND };
975
+ return Object.keys(policyDefinitions).length ? { policyDefinitions } : { info: POLICY_NOT_FOUND.message };
980
976
  }
981
977
 
982
978
  const RANKING = "RANKING";
@@ -1723,7 +1719,7 @@ function findPolicy({
1723
1719
  structure,
1724
1720
  event
1725
1721
  });
1726
- return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { error: POLICY_NOT_FOUND };
1722
+ return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { info: POLICY_NOT_FOUND?.message };
1727
1723
  }
1728
1724
 
1729
1725
  function getScheduleTiming({
@@ -11248,7 +11244,7 @@ function participantScaleItem({
11248
11244
  return { error: INVALID_VALUES };
11249
11245
  if (!participant.timeItems)
11250
11246
  participant.timeItems = [];
11251
- if (participant && Array.isArray(participant.timeItems)) {
11247
+ if (Array.isArray(participant.timeItems)) {
11252
11248
  const { accessor, scaleType, eventType, scaleName } = scaleAttributes;
11253
11249
  const filterType = [SCALE, scaleType, eventType, scaleName].join(".");
11254
11250
  const filteredTimeItems = participant.timeItems.filter((timeItem2) => timeItem2?.itemType === filterType).filter((timeItem2) => !requireTimeStamp || timeItem2?.itemDate).sort(
@@ -11268,12 +11264,10 @@ function participantScaleItem({
11268
11264
  scaleName: scaleName2,
11269
11265
  scaleType: scaleType2
11270
11266
  };
11271
- return { scaleItem };
11272
- } else {
11273
- return { error: SCALE_ITEM_NOT_FOUND };
11267
+ return { ...SUCCESS, scaleItem };
11274
11268
  }
11275
11269
  }
11276
- return { error: MISSING_PARTICIPANT };
11270
+ return { ...SUCCESS, scaleItem: void 0 };
11277
11271
  }
11278
11272
 
11279
11273
  function addFinishingRounds({
@@ -12094,8 +12088,6 @@ function getParticipantEntries(params) {
12094
12088
  participantMap,
12095
12089
  withPotentialMatchUps,
12096
12090
  withRankingProfile,
12097
- withScheduleTimes,
12098
- withScheduleItems,
12099
12091
  scheduleAnalysis,
12100
12092
  withTeamMatchUps,
12101
12093
  withStatistics,
@@ -12105,8 +12097,7 @@ function getParticipantEntries(params) {
12105
12097
  withEvents,
12106
12098
  withDraws
12107
12099
  } = params;
12108
- if (withScheduleItems)
12109
- console.log({ withScheduleItems });
12100
+ const withScheduleTimes = params.withScheduleTimes ?? params.withScheduleItems;
12110
12101
  const targetParticipantIds = participantFilters?.participantIds;
12111
12102
  const getRelevantParticipantIds = (participantId) => {
12112
12103
  const relevantParticipantIds = [participantId];