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.
@@ -15505,6 +15505,7 @@ function assignMatchUpCourt({
15505
15505
  }
15506
15506
 
15507
15507
  function addMatchUpScheduledTime$1(params) {
15508
+ const stack = "addMatchUpScheduledTime";
15508
15509
  let matchUp = params.matchUp;
15509
15510
  const {
15510
15511
  removePriorValues,
@@ -15515,27 +15516,18 @@ function addMatchUpScheduledTime$1(params) {
15515
15516
  matchUpId
15516
15517
  } = params;
15517
15518
  if (!matchUpId)
15518
- return { error: MISSING_MATCHUP_ID };
15519
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack });
15519
15520
  if (!validTimeValue(scheduledTime))
15520
- return { error: INVALID_TIME };
15521
+ return decorateResult({ result: { error: INVALID_TIME }, stack });
15521
15522
  if (!matchUp) {
15522
15523
  const result = findMatchUp({ drawDefinition, matchUpId });
15523
15524
  if (result.error)
15524
- return result;
15525
+ return decorateResult({ result, stack });
15525
15526
  matchUp = result.matchUp;
15526
15527
  }
15527
15528
  const timeDate = extractDate(scheduledTime);
15528
- const stack = "addMatchUpScheduledTime";
15529
- if (timeDate) {
15530
- const scheduledDate = scheduledMatchUpDate({ matchUp }).scheduledDate;
15531
- if (scheduledDate && scheduledDate !== timeDate) {
15532
- return decorateResult({
15533
- info: `date in time: ${timeDate} does not corresponde to scheduledDate: ${scheduledDate}`,
15534
- result: { error: INVALID_TIME },
15535
- stack
15536
- });
15537
- }
15538
- }
15529
+ const scheduledDate = scheduledMatchUpDate({ matchUp }).scheduledDate;
15530
+ const keepDate = timeDate && !scheduledDate;
15539
15531
  const existingTimeModifiers = matchUpTimeModifiers({ matchUp }).timeModifiers || [];
15540
15532
  if (existingTimeModifiers?.length) {
15541
15533
  const result = addMatchUpTimeModifiers({
@@ -15548,9 +15540,9 @@ function addMatchUpScheduledTime$1(params) {
15548
15540
  matchUp
15549
15541
  });
15550
15542
  if (result?.error)
15551
- return result;
15543
+ return decorateResult({ result, stack });
15552
15544
  }
15553
- const militaryTime = convertTime(scheduledTime, true, true);
15545
+ const militaryTime = convertTime(scheduledTime, true, keepDate);
15554
15546
  const itemValue = militaryTime;
15555
15547
  const timeItem = {
15556
15548
  itemType: SCHEDULED_TIME,
@@ -15575,14 +15567,19 @@ function addMatchUpTimeModifiers({
15575
15567
  matchUpId,
15576
15568
  matchUp
15577
15569
  }) {
15570
+ const stack = "addMatchUpTimeModifiers";
15578
15571
  if (!matchUpId)
15579
- return { error: MISSING_MATCHUP_ID };
15572
+ return decorateResult({ result: { error: MISSING_MATCHUP_ID }, stack });
15580
15573
  if (timeModifiers !== void 0 && !Array.isArray(timeModifiers))
15581
- return { error: INVALID_VALUES, info: mustBeAnArray("timeModifiers") };
15574
+ return decorateResult({
15575
+ info: mustBeAnArray("timeModifiers"),
15576
+ result: { error: INVALID_VALUES },
15577
+ stack
15578
+ });
15582
15579
  if (!matchUp) {
15583
15580
  const result = findMatchUp({ drawDefinition, matchUpId });
15584
15581
  if (result.error)
15585
- return result;
15582
+ return decorateResult({ result, stack });
15586
15583
  matchUp = result.matchUp;
15587
15584
  }
15588
15585
  let existingTimeModifiers = matchUpTimeModifiers({ matchUp }).timeModifiers || [];
@@ -15607,7 +15604,7 @@ function addMatchUpTimeModifiers({
15607
15604
  matchUpId
15608
15605
  });
15609
15606
  if (result.error)
15610
- return result;
15607
+ return decorateResult({ result, stack });
15611
15608
  }
15612
15609
  const itemValue = !timeModifiers?.length ? void 0 : [...toBeAdded, ...existingTimeModifiers];
15613
15610
  const timeItem = {