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.
@@ -2898,7 +2898,7 @@ var matchUpFormatCode = {
2898
2898
  };
2899
2899
 
2900
2900
  function factoryVersion() {
2901
- return '1.8.5';
2901
+ return '1.8.6';
2902
2902
  }
2903
2903
 
2904
2904
  function getObjectTieFormat(obj) {
@@ -21910,31 +21910,23 @@ function getMatchUpContextIds(_a) {
21910
21910
  }
21911
21911
 
21912
21912
  function addMatchUpScheduledTime$2(params) {
21913
+ var stack = 'addMatchUpScheduledTime';
21913
21914
  var matchUp = params.matchUp;
21914
21915
  var removePriorValues = params.removePriorValues, tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, disableNotice = params.disableNotice, scheduledTime = params.scheduledTime, matchUpId = params.matchUpId;
21915
21916
  if (!matchUpId)
21916
- return { error: MISSING_MATCHUP_ID };
21917
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack: stack });
21917
21918
  // must support undefined as a value so that scheduledTime can be cleared
21918
21919
  if (!validTimeValue(scheduledTime))
21919
- return { error: INVALID_TIME };
21920
+ return decorateResult({ result: { error: INVALID_TIME }, stack: stack });
21920
21921
  if (!matchUp) {
21921
21922
  var result = findMatchUp$1({ drawDefinition: drawDefinition, matchUpId: matchUpId });
21922
21923
  if (result.error)
21923
- return result;
21924
+ return decorateResult({ result: result, stack: stack });
21924
21925
  matchUp = result.matchUp;
21925
21926
  }
21926
21927
  var timeDate = extractDate(scheduledTime);
21927
- var stack = 'addMatchUpScheduledTime';
21928
- if (timeDate) {
21929
- var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
21930
- if (scheduledDate && scheduledDate !== timeDate) {
21931
- return decorateResult({
21932
- info: "date in time: ".concat(timeDate, " does not corresponde to scheduledDate: ").concat(scheduledDate),
21933
- result: { error: INVALID_TIME },
21934
- stack: stack,
21935
- });
21936
- }
21937
- }
21928
+ var scheduledDate = scheduledMatchUpDate({ matchUp: matchUp }).scheduledDate;
21929
+ var keepDate = timeDate && !scheduledDate;
21938
21930
  var existingTimeModifiers = matchUpTimeModifiers({ matchUp: matchUp }).timeModifiers || [];
21939
21931
  if (existingTimeModifiers === null || existingTimeModifiers === void 0 ? void 0 : existingTimeModifiers.length) {
21940
21932
  var result = addMatchUpTimeModifiers({
@@ -21947,10 +21939,10 @@ function addMatchUpScheduledTime$2(params) {
21947
21939
  matchUp: matchUp,
21948
21940
  });
21949
21941
  if (result === null || result === void 0 ? void 0 : result.error)
21950
- return result;
21942
+ return decorateResult({ result: result, stack: stack });
21951
21943
  }
21952
21944
  // All times stored as military time
21953
- var militaryTime = convertTime(scheduledTime, true, true);
21945
+ var militaryTime = convertTime(scheduledTime, true, keepDate);
21954
21946
  var itemValue = militaryTime;
21955
21947
  var timeItem = {
21956
21948
  itemType: SCHEDULED_TIME,
@@ -21968,14 +21960,19 @@ function addMatchUpScheduledTime$2(params) {
21968
21960
  }
21969
21961
  function addMatchUpTimeModifiers(_a) {
21970
21962
  var removePriorValues = _a.removePriorValues, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, disableNotice = _a.disableNotice, timeModifiers = _a.timeModifiers, matchUpId = _a.matchUpId, matchUp = _a.matchUp;
21963
+ var stack = 'addMatchUpTimeModifiers';
21971
21964
  if (!matchUpId)
21972
- return { error: MISSING_MATCHUP_ID };
21965
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack: stack });
21973
21966
  if (timeModifiers !== undefined && !Array.isArray(timeModifiers))
21974
- return { error: INVALID_VALUES, info: mustBeAnArray('timeModifiers') };
21967
+ return decorateResult({
21968
+ info: mustBeAnArray('timeModifiers'),
21969
+ result: { error: INVALID_VALUES },
21970
+ stack: stack,
21971
+ });
21975
21972
  if (!matchUp) {
21976
21973
  var result = findMatchUp$1({ drawDefinition: drawDefinition, matchUpId: matchUpId });
21977
21974
  if (result.error)
21978
- return result;
21975
+ return decorateResult({ result: result, stack: stack });
21979
21976
  matchUp = result.matchUp;
21980
21977
  }
21981
21978
  var existingTimeModifiers = matchUpTimeModifiers({ matchUp: matchUp }).timeModifiers || [];
@@ -21998,7 +21995,7 @@ function addMatchUpTimeModifiers(_a) {
21998
21995
  matchUpId: matchUpId,
21999
21996
  });
22000
21997
  if (result.error)
22001
- return result;
21998
+ return decorateResult({ result: result, stack: stack });
22002
21999
  }
22003
22000
  // undefined value when array is empty;
22004
22001
  var itemValue = !(timeModifiers === null || timeModifiers === void 0 ? void 0 : timeModifiers.length)