tods-competition-factory 1.8.5 → 1.8.6

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.
package/dist/index.mjs CHANGED
@@ -2375,7 +2375,7 @@ const matchUpFormatCode = {
2375
2375
  };
2376
2376
 
2377
2377
  function factoryVersion() {
2378
- return "1.8.5";
2378
+ return "1.8.6";
2379
2379
  }
2380
2380
 
2381
2381
  function getObjectTieFormat(obj) {
@@ -19795,6 +19795,7 @@ function getMatchUpContextIds({ matchUps, matchUpId }) {
19795
19795
  }
19796
19796
 
19797
19797
  function addMatchUpScheduledTime$2(params) {
19798
+ const stack = "addMatchUpScheduledTime";
19798
19799
  let matchUp = params.matchUp;
19799
19800
  const {
19800
19801
  removePriorValues,
@@ -19805,27 +19806,18 @@ function addMatchUpScheduledTime$2(params) {
19805
19806
  matchUpId
19806
19807
  } = params;
19807
19808
  if (!matchUpId)
19808
- return { error: MISSING_MATCHUP_ID };
19809
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack });
19809
19810
  if (!validTimeValue(scheduledTime))
19810
- return { error: INVALID_TIME };
19811
+ return decorateResult({ result: { error: INVALID_TIME }, stack });
19811
19812
  if (!matchUp) {
19812
19813
  const result = findMatchUp$1({ drawDefinition, matchUpId });
19813
19814
  if (result.error)
19814
- return result;
19815
+ return decorateResult({ result, stack });
19815
19816
  matchUp = result.matchUp;
19816
19817
  }
19817
19818
  const timeDate = extractDate(scheduledTime);
19818
- const stack = "addMatchUpScheduledTime";
19819
- if (timeDate) {
19820
- const scheduledDate = scheduledMatchUpDate({ matchUp }).scheduledDate;
19821
- if (scheduledDate && scheduledDate !== timeDate) {
19822
- return decorateResult({
19823
- info: `date in time: ${timeDate} does not corresponde to scheduledDate: ${scheduledDate}`,
19824
- result: { error: INVALID_TIME },
19825
- stack
19826
- });
19827
- }
19828
- }
19819
+ const scheduledDate = scheduledMatchUpDate({ matchUp }).scheduledDate;
19820
+ const keepDate = timeDate && !scheduledDate;
19829
19821
  const existingTimeModifiers = matchUpTimeModifiers({ matchUp }).timeModifiers || [];
19830
19822
  if (existingTimeModifiers?.length) {
19831
19823
  const result = addMatchUpTimeModifiers({
@@ -19838,9 +19830,9 @@ function addMatchUpScheduledTime$2(params) {
19838
19830
  matchUp
19839
19831
  });
19840
19832
  if (result?.error)
19841
- return result;
19833
+ return decorateResult({ result, stack });
19842
19834
  }
19843
- const militaryTime = convertTime(scheduledTime, true, true);
19835
+ const militaryTime = convertTime(scheduledTime, true, keepDate);
19844
19836
  const itemValue = militaryTime;
19845
19837
  const timeItem = {
19846
19838
  itemType: SCHEDULED_TIME,
@@ -19865,14 +19857,19 @@ function addMatchUpTimeModifiers({
19865
19857
  matchUpId,
19866
19858
  matchUp
19867
19859
  }) {
19860
+ const stack = "addMatchUpTimeModifiers";
19868
19861
  if (!matchUpId)
19869
- return { error: MISSING_MATCHUP_ID };
19862
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack });
19870
19863
  if (timeModifiers !== void 0 && !Array.isArray(timeModifiers))
19871
- return { error: INVALID_VALUES, info: mustBeAnArray("timeModifiers") };
19864
+ return decorateResult({
19865
+ info: mustBeAnArray("timeModifiers"),
19866
+ result: { error: INVALID_VALUES },
19867
+ stack
19868
+ });
19872
19869
  if (!matchUp) {
19873
19870
  const result = findMatchUp$1({ drawDefinition, matchUpId });
19874
19871
  if (result.error)
19875
- return result;
19872
+ return decorateResult({ result, stack });
19876
19873
  matchUp = result.matchUp;
19877
19874
  }
19878
19875
  let existingTimeModifiers = matchUpTimeModifiers({ matchUp }).timeModifiers || [];
@@ -19897,7 +19894,7 @@ function addMatchUpTimeModifiers({
19897
19894
  matchUpId
19898
19895
  });
19899
19896
  if (result.error)
19900
- return result;
19897
+ return decorateResult({ result, stack });
19901
19898
  }
19902
19899
  const itemValue = !timeModifiers?.length ? void 0 : [...toBeAdded, ...existingTimeModifiers];
19903
19900
  const timeItem = {