tods-competition-factory 0.26.0 → 0.26.1

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
- MIT License
1
+ # MIT License
2
2
 
3
- Copyright (c) 2021 Charles Allen
3
+ Copyright (c) 2019-2022 Charles Allen
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Competition Factory
2
2
 
3
- The **[Tennis Open Data Standards](https://itftennis.atlassian.net/wiki/spaces/TODS/overview)**, **(TODS)**, provide a document-based representation of all of the elements of a tournament including participants, events, draws, matchUps, contacts, and references to online resources. Although the data standard is emerging in the sport of Tennis, the data structures apply to tournaments in many sports.
3
+ The **[Tennis Open Data Standards](https://itftennis.atlassian.net/wiki/spaces/TODS/overview)**, **(TODS)**, provide a document-based representation of all of the elements of a tournament including participants, events, draws, matchUps, contacts, and references to online resources. Although the data standard is emerging in the sport of Tennis, **_the data structures apply to tournaments in many sports_**.
4
4
 
5
5
  The **Competition Factory** is a collection of "state engines" for transforming/mutating **TODS** documents and is intended to ensure the integrity of Tournaments by managing all state transformations. These engines embody the "business rules" required by Tournament Management Solutions, and enable an entirely new way of constructing software to manage tournaments. The rules governing the creation of draws, seeding, and participant movement can be present on a standalone client, on a server, or both. An entire tournament management solution can run in a browser, optionally utilizing IndexedDB or localStorage, or a client can communicate with a server which utilizes a SQL or NoSQL database, or simply the file system. Server deployments support asynchronous processing models in **Node.js**.
6
6
 
@@ -10,10 +10,10 @@ The **Competition Factory** is a collection of "state engines" for transforming/
10
10
 
11
11
  Engines manage different concerns within a document structure representing a tournament and may contain **accessors, generators, getters, governors and test suites**. Engines can be used either synchronously or asynchronously.
12
12
 
13
- 1. **competitionEngine** - managages resources which may be shared by multiple tournaments, such as venues (courts & other locations); includes scheduling.
14
- 2. **tournamentEngine** - manages tournament metadata, participants, events; many `drawEngine` methods are also exported directly.
15
- 3. **drawEngine** - generates drawDefinitions and matchUp results; manages participant movement within and between structures.
16
- 4. **mocksEngine** - generates tournaments, participants, events and drawDefinitions for testing purposes.
13
+ 1. **competitionEngine** - managages resources which may be shared across multiple linked tournaments, such as venues (courts & other locations); includes advanced scheduling and cross-tournament reporting.
14
+ 2. **tournamentEngine** - manages tournament metadata, participants, events (including the generation of complex draw types and "flights" within events), and reporting.
15
+ 3. **drawEngine** - generates drawDefinitions and matchUp results; manages participant seeding and movement within and between draw structures.
16
+ 4. **mocksEngine** - generates tournaments, participants, events, drawDefinitions and scheduling profiles for testing purposes.
17
17
 
18
18
  ## Installation
19
19
 
@@ -17907,7 +17907,9 @@ function addSchedulingProfileRound({
17907
17907
  } // ensure round is not already present
17908
17908
 
17909
17909
 
17910
- const hashRound = r => Object.keys(r).sort().map(k => r[k]).join('|');
17910
+ const excludeKeys = ['notBeforeTime'];
17911
+
17912
+ const hashRound = r => Object.keys(r).filter(key => !excludeKeys.includes(key)).sort().map(k => r[k]).join('|');
17911
17913
 
17912
17914
  const roundExists = venueOnDate.rounds.find(existingRound => hashRound(existingRound) === hashRound(round));
17913
17915
  if (roundExists) return {
@@ -25274,7 +25276,7 @@ const scheduleGovernor = {
25274
25276
  };
25275
25277
 
25276
25278
  function factoryVersion() {
25277
- return '0.26.0';
25279
+ return '0.26.1';
25278
25280
  }
25279
25281
 
25280
25282
  function attachPolicies({
@@ -41715,15 +41717,13 @@ function generateSchedulingProfile({
41715
41717
  venueId,
41716
41718
  round: roundToSchedule
41717
41719
  });
41718
-
41719
- if (result.success) {
41720
- scheduledRounds.push({
41721
- drawName,
41722
- structureName,
41723
- roundName,
41724
- ...roundToSchedule
41725
- });
41726
- }
41720
+ if (result.error) return result;
41721
+ scheduledRounds.push({
41722
+ drawName,
41723
+ structureName,
41724
+ roundName,
41725
+ ...roundToSchedule
41726
+ });
41727
41727
  }
41728
41728
  }
41729
41729
  }
@@ -46313,12 +46313,16 @@ function generateTournamentRecord({
46313
46313
  venueProfiles
46314
46314
  }) : [];
46315
46315
  let scheduledRounds;
46316
- if (schedulingProfile) ({
46317
- scheduledRounds
46318
- } = generateSchedulingProfile({
46319
- tournamentRecord,
46320
- schedulingProfile
46321
- }));
46316
+
46317
+ if (schedulingProfile) {
46318
+ const result = generateSchedulingProfile({
46319
+ tournamentRecord,
46320
+ schedulingProfile
46321
+ });
46322
+ if (result.error) return result;
46323
+ scheduledRounds = result.scheduledRounds;
46324
+ }
46325
+
46322
46326
  return definedAttributes({
46323
46327
  tournamentRecord,
46324
46328
  scheduledRounds,
@@ -46341,7 +46345,7 @@ const mocksGovernor = {
46341
46345
  const mocksEngine = /*#__PURE__*/function () {
46342
46346
  const engine = {
46343
46347
  version: () => {
46344
- return '0.26.0';
46348
+ return '0.26.1';
46345
46349
  },
46346
46350
  devContext: isDev => {
46347
46351
  setDevContext(isDev);