tods-competition-factory 2.0.44 → 2.0.45

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.44';
6
+ return '2.0.45';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -11590,8 +11590,6 @@ function getPublishState(params) {
11590
11590
  const publishedEventIds = [];
11591
11591
  let tournamentPublished = false;
11592
11592
  const publishState = {};
11593
- const pubStatus = getTournamentPublishStatus({ tournamentRecord });
11594
- publishState.tournament = pubStatus ?? {};
11595
11593
  for (const event of tournamentRecord?.events ?? []) {
11596
11594
  const pubStatus = getPubStatus({ event });
11597
11595
  publishState[event.eventId] = pubStatus;
@@ -11606,6 +11604,8 @@ function getPublishState(params) {
11606
11604
  }
11607
11605
  }
11608
11606
  if (tournamentRecord) {
11607
+ const pubStatus = getTournamentPublishStatus({ tournamentRecord });
11608
+ publishState.tournament = pubStatus ?? {};
11609
11609
  publishState.tournament.status = { published: tournamentPublished, publishedEventIds };
11610
11610
  }
11611
11611
  return { ...SUCCESS, publishState };
@@ -35808,7 +35808,7 @@ function competitionScheduleMatchUps(params) {
35808
35808
  const { sortDateMatchUps = true, courtCompletedMatchUps, alwaysReturnCompleted, activeTournamentId, tournamentRecords, withCourtGridRows, minCourtGridRows, usePublishState, status = PUBLIC, sortCourtsData, } = params;
35809
35809
  const tournamentPublishStatus = usePublishState
35810
35810
  ? getTournamentTimeItem({
35811
- tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId()],
35811
+ tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId() ?? Object.keys(tournamentRecords)[0]],
35812
35812
  itemType: `${PUBLISH}.${STATUS$1}`,
35813
35813
  }).timeItem?.itemValue?.[status]
35814
35814
  : undefined;
@@ -55355,17 +55355,30 @@ function addOnlineResource({ tournamentRecord, onlineResource, organisationId, p
55355
55355
  function setTournamentName({ tournamentRecord, promotionalName, tournamentName, formalName }) {
55356
55356
  if (!tournamentRecord)
55357
55357
  return { error: MISSING_TOURNAMENT_RECORD };
55358
- if (tournamentName)
55358
+ const tournamentId = tournamentRecord.tournamentId;
55359
+ const detailUpdates = { tournamentId };
55360
+ if (tournamentName) {
55359
55361
  tournamentRecord.tournamentName = tournamentName;
55360
- if (promotionalName)
55362
+ detailUpdates.tournamentName = tournamentName;
55363
+ }
55364
+ if (promotionalName) {
55361
55365
  tournamentRecord.promotionalName = promotionalName;
55362
- if (formalName)
55366
+ detailUpdates.promotionalName = promotionalName;
55367
+ }
55368
+ if (formalName) {
55363
55369
  tournamentRecord.formalName = formalName;
55370
+ detailUpdates.formalName = formalName;
55371
+ }
55364
55372
  if (tournamentRecord.promotionalName === tournamentRecord.tournamentName) {
55365
55373
  delete tournamentRecord.promotionalName;
55374
+ detailUpdates.promotionalName = '';
55366
55375
  }
55367
55376
  if (tournamentRecord.formalName === tournamentRecord.tournamentName) {
55368
55377
  delete tournamentRecord.formalName;
55378
+ detailUpdates.formalName = '';
55379
+ }
55380
+ if (Object.keys(detailUpdates).length > 1) {
55381
+ addNotice({ topic: MODIFY_TOURNAMENT_DETAIL, payload: { tournamentId, ...detailUpdates } });
55369
55382
  }
55370
55383
  return { ...SUCCESS };
55371
55384
  }
@@ -55462,8 +55475,8 @@ function setTournamentDates(params) {
55462
55475
  const unscheduledMatchUpIds = checkScheduling && removeInvalidScheduling({ tournamentRecord })?.unscheduledMatchUpIds;
55463
55476
  updateCourtAvailability({ tournamentRecord });
55464
55477
  addNotice({
55478
+ payload: { tournamentId: tournamentRecord.tournamentId, startDate, endDate },
55465
55479
  topic: MODIFY_TOURNAMENT_DETAIL,
55466
- payload: { startDate, endDate },
55467
55480
  });
55468
55481
  return { ...SUCCESS, unscheduledMatchUpIds, datesAdded, datesRemoved };
55469
55482
  }