tods-competition-factory 2.0.60 → 2.1.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/dist/index.mjs +6 -6
- package/dist/tods-competition-factory.d.ts +152 -104
- package/dist/tods-competition-factory.development.cjs.js +728 -465
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +10 -10
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.
|
|
6
|
+
return '2.1.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -446,6 +446,10 @@ const MISSING_VALUE = {
|
|
|
446
446
|
message: 'Missing value',
|
|
447
447
|
code: 'ERR_MISSING_VALUE',
|
|
448
448
|
};
|
|
449
|
+
const MISSING_BIRTH_DATE = {
|
|
450
|
+
message: 'Missing birthdate',
|
|
451
|
+
code: 'ERR_MISSING_BIRTH_DATE',
|
|
452
|
+
};
|
|
449
453
|
const MISSING_DATE = {
|
|
450
454
|
message: 'Missing date',
|
|
451
455
|
code: 'ERR_MISSING_DATE',
|
|
@@ -506,6 +510,10 @@ const CANNOT_REMOVE_PARTICIPANTS = {
|
|
|
506
510
|
message: 'Cannot remove participants',
|
|
507
511
|
code: 'ERR_UNCHANGED_CANNOT_REMOVE_PARTICIPANTS',
|
|
508
512
|
};
|
|
513
|
+
const CATEGORY_MISMATCH = {
|
|
514
|
+
message: 'Participant category mismatch',
|
|
515
|
+
code: 'ERR_CATEGORY_MISMATCH',
|
|
516
|
+
};
|
|
509
517
|
const CANNOT_CHANGE_WINNING_SIDE = {
|
|
510
518
|
message: 'Cannot change winningSide',
|
|
511
519
|
code: 'ERR_UNCHANGED_CANNOT_CHANGE_WINNING_SIDE',
|
|
@@ -818,6 +826,7 @@ const errorConditionConstants = {
|
|
|
818
826
|
CANNOT_MODIFY_PARTICIPANT_TYPE,
|
|
819
827
|
CANNOT_REMOVE_MAIN_STRUCTURE,
|
|
820
828
|
CANNOT_REMOVE_PARTICIPANTS,
|
|
829
|
+
CATEGORY_MISMATCH,
|
|
821
830
|
COURT_EXISTS,
|
|
822
831
|
COURT_NOT_FOUND,
|
|
823
832
|
DRAW_DEFINITION_NOT_FOUND,
|
|
@@ -900,6 +909,7 @@ const errorConditionConstants = {
|
|
|
900
909
|
MISSING_ASSIGNMENTS,
|
|
901
910
|
MISSING_ASYNC_STATE_PROVIDER,
|
|
902
911
|
MISSING_AVOIDANCE_POLICY,
|
|
912
|
+
MISSING_BIRTH_DATE,
|
|
903
913
|
MISSING_COLLECTION_DEFINITION,
|
|
904
914
|
MISSING_COURT_ID,
|
|
905
915
|
MISSING_COURTS_INFO,
|
|
@@ -1085,7 +1095,12 @@ function setSubscriptions$1(params) {
|
|
|
1085
1095
|
if (typeof params.subscriptions !== 'object')
|
|
1086
1096
|
return { error: INVALID_VALUES };
|
|
1087
1097
|
Object.keys(params.subscriptions).forEach((subscription) => {
|
|
1088
|
-
|
|
1098
|
+
if (typeof params.subscriptions[subscription] === 'function') {
|
|
1099
|
+
syncGlobalState.subscriptions[subscription] = params.subscriptions[subscription];
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
delete syncGlobalState.subscriptions[subscription];
|
|
1103
|
+
}
|
|
1089
1104
|
});
|
|
1090
1105
|
return { ...SUCCESS };
|
|
1091
1106
|
}
|
|
@@ -1630,6 +1645,9 @@ function deleteNotices() {
|
|
|
1630
1645
|
function getTopics() {
|
|
1631
1646
|
return _globalStateProvider.getTopics();
|
|
1632
1647
|
}
|
|
1648
|
+
function hasTopic(topic) {
|
|
1649
|
+
return getTopics()?.topics?.includes(topic);
|
|
1650
|
+
}
|
|
1633
1651
|
async function callListener(payload) {
|
|
1634
1652
|
return _globalStateProvider.callListener(payload, globalState.globalSubscriptions);
|
|
1635
1653
|
}
|
|
@@ -1727,6 +1745,7 @@ var globalState$1 = {
|
|
|
1727
1745
|
getTournamentRecords: getTournamentRecords,
|
|
1728
1746
|
globalLog: globalLog$1,
|
|
1729
1747
|
handleCaughtError: handleCaughtError,
|
|
1748
|
+
hasTopic: hasTopic,
|
|
1730
1749
|
removeTournamentRecord: removeTournamentRecord,
|
|
1731
1750
|
setDeepCopy: setDeepCopy,
|
|
1732
1751
|
setDevContext: setDevContext,
|
|
@@ -1813,6 +1832,184 @@ const eventConstants = {
|
|
|
1813
1832
|
TEAM: TEAM$2,
|
|
1814
1833
|
};
|
|
1815
1834
|
|
|
1835
|
+
const MAIN = 'MAIN';
|
|
1836
|
+
const QUALIFYING = 'QUALIFYING';
|
|
1837
|
+
const CONSOLATION = 'CONSOLATION';
|
|
1838
|
+
const VOLUNTARY_CONSOLATION = 'VOLUNTARY_CONSOLATION';
|
|
1839
|
+
const PLAY_OFF = 'PLAY_OFF';
|
|
1840
|
+
const validStages = [MAIN, QUALIFYING, CONSOLATION, PLAY_OFF, VOLUNTARY_CONSOLATION];
|
|
1841
|
+
const stageOrder$1 = {
|
|
1842
|
+
[QUALIFYING]: 1,
|
|
1843
|
+
[MAIN]: 2,
|
|
1844
|
+
[PLAY_OFF]: 3,
|
|
1845
|
+
[CONSOLATION]: 3,
|
|
1846
|
+
[VOLUNTARY_CONSOLATION]: 4,
|
|
1847
|
+
};
|
|
1848
|
+
const FINISHING_POSITIONS = 'finishingPositions';
|
|
1849
|
+
const AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
1850
|
+
const finishOrder = {
|
|
1851
|
+
[MAIN]: 1,
|
|
1852
|
+
[PLAY_OFF]: 2,
|
|
1853
|
+
[CONSOLATION]: 3,
|
|
1854
|
+
[QUALIFYING]: 4,
|
|
1855
|
+
[VOLUNTARY_CONSOLATION]: 5,
|
|
1856
|
+
};
|
|
1857
|
+
const aggregateOrder = {
|
|
1858
|
+
[PLAY_OFF]: 1,
|
|
1859
|
+
[MAIN]: 2,
|
|
1860
|
+
[CONSOLATION]: 3,
|
|
1861
|
+
[QUALIFYING]: 4,
|
|
1862
|
+
[VOLUNTARY_CONSOLATION]: 5,
|
|
1863
|
+
};
|
|
1864
|
+
const CLUSTER = 'CLUSTER';
|
|
1865
|
+
const SEPARATE = 'SEPARATE';
|
|
1866
|
+
const WATERFALL = 'WATERFALL';
|
|
1867
|
+
const ITEM = 'ITEM';
|
|
1868
|
+
const CONTAINER = 'CONTAINER';
|
|
1869
|
+
const DRAW = 'DRAW';
|
|
1870
|
+
const RANDOM = 'RANDOM';
|
|
1871
|
+
const TOP_DOWN = 'TOP_DOWN';
|
|
1872
|
+
const BOTTOM_UP = 'BOTTOM_UP';
|
|
1873
|
+
const POSITION = 'POSITION';
|
|
1874
|
+
const WINNER = 'WINNER';
|
|
1875
|
+
const LOSER = 'LOSER';
|
|
1876
|
+
const FIRST_MATCHUP = 'FIRST_MATCHUP';
|
|
1877
|
+
const AD_HOC = 'AD_HOC';
|
|
1878
|
+
const FLEX_ROUNDS = 'AD_HOC';
|
|
1879
|
+
const FEED_IN$1 = 'FEED_IN';
|
|
1880
|
+
const COMPASS = 'COMPASS';
|
|
1881
|
+
const OLYMPIC = 'OLYMPIC';
|
|
1882
|
+
const KNOCKOUT = 'SINGLE_ELIMINATION';
|
|
1883
|
+
const SINGLE_ELIMINATION = 'SINGLE_ELIMINATION';
|
|
1884
|
+
const DOUBLE_ELIMINATION = 'DOUBLE_ELIMINATION';
|
|
1885
|
+
const FIRST_MATCH_LOSER_CONSOLATION = 'FIRST_MATCH_LOSER_CONSOLATION';
|
|
1886
|
+
const FIRST_ROUND_LOSER_CONSOLATION = 'FIRST_ROUND_LOSER_CONSOLATION';
|
|
1887
|
+
const LUCKY_DRAW = 'LUCKY_DRAW';
|
|
1888
|
+
const CURTIS = 'CURTIS_CONSOLATION';
|
|
1889
|
+
const CURTIS_CONSOLATION = 'CURTIS_CONSOLATION';
|
|
1890
|
+
const FICSF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
1891
|
+
const FEED_IN_CHAMPIONSHIP_TO_SF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
1892
|
+
const FICQF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
1893
|
+
const FEED_IN_CHAMPIONSHIP_TO_QF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
1894
|
+
const FICR16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
1895
|
+
const FEED_IN_CHAMPIONSHIP_TO_R16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
1896
|
+
const MFIC = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
1897
|
+
const MODIFIED_FEED_IN_CHAMPIONSHIP = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
1898
|
+
const FEED_IN_CHAMPIONSHIP = 'FEED_IN_CHAMPIONSHIP';
|
|
1899
|
+
const DOUBLE_ROUND_ROBIN = 'DOUBLE_ROUND_ROBIN';
|
|
1900
|
+
const ROUND_ROBIN = 'ROUND_ROBIN';
|
|
1901
|
+
const ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
1902
|
+
const DECIDER = 'DECIDER';
|
|
1903
|
+
const BACKDRAW = 'BACKDRAW';
|
|
1904
|
+
const COMPASS_ATTRIBUTES = {
|
|
1905
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
1906
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
1907
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
1908
|
+
'0-3': { name: 'Northeast', abbreviation: 'NE' },
|
|
1909
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
1910
|
+
'0-1-2': { name: 'Southwest', abbreviation: 'SW' },
|
|
1911
|
+
'0-2-1': { name: 'Northwest', abbreviation: 'NW' },
|
|
1912
|
+
'0-1-1-1': { name: 'Southeast', abbreviation: 'SE' },
|
|
1913
|
+
};
|
|
1914
|
+
const OLYMPIC_ATTRIBUTES = {
|
|
1915
|
+
0: { name: 'East', abbreviation: 'E' },
|
|
1916
|
+
'0-1': { name: 'West', abbreviation: 'W' },
|
|
1917
|
+
'0-2': { name: 'North', abbreviation: 'N' },
|
|
1918
|
+
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
1919
|
+
};
|
|
1920
|
+
const WIN_RATIO$1 = 'WIN_RATIO';
|
|
1921
|
+
const ROUND_OUTCOME = 'ROUND_OUTCOME';
|
|
1922
|
+
const MULTI_STRUCTURE_DRAWS = [
|
|
1923
|
+
COMPASS,
|
|
1924
|
+
CURTIS,
|
|
1925
|
+
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
1926
|
+
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
1927
|
+
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
1928
|
+
FEED_IN_CHAMPIONSHIP,
|
|
1929
|
+
FICQF,
|
|
1930
|
+
FICR16,
|
|
1931
|
+
FICSF,
|
|
1932
|
+
FIRST_MATCH_LOSER_CONSOLATION,
|
|
1933
|
+
FIRST_ROUND_LOSER_CONSOLATION,
|
|
1934
|
+
LUCKY_DRAW,
|
|
1935
|
+
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
1936
|
+
OLYMPIC,
|
|
1937
|
+
PLAY_OFF,
|
|
1938
|
+
ROUND_ROBIN_WITH_PLAYOFF,
|
|
1939
|
+
];
|
|
1940
|
+
const generatedDrawTypes = [
|
|
1941
|
+
AD_HOC,
|
|
1942
|
+
COMPASS,
|
|
1943
|
+
CURTIS,
|
|
1944
|
+
DOUBLE_ELIMINATION,
|
|
1945
|
+
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
1946
|
+
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
1947
|
+
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
1948
|
+
FEED_IN_CHAMPIONSHIP,
|
|
1949
|
+
FEED_IN$1,
|
|
1950
|
+
FIRST_MATCH_LOSER_CONSOLATION,
|
|
1951
|
+
FIRST_ROUND_LOSER_CONSOLATION,
|
|
1952
|
+
LUCKY_DRAW,
|
|
1953
|
+
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
1954
|
+
OLYMPIC,
|
|
1955
|
+
PLAY_OFF,
|
|
1956
|
+
ROUND_ROBIN,
|
|
1957
|
+
ROUND_ROBIN_WITH_PLAYOFF,
|
|
1958
|
+
SINGLE_ELIMINATION,
|
|
1959
|
+
];
|
|
1960
|
+
const drawDefinitionConstants = {
|
|
1961
|
+
MAIN,
|
|
1962
|
+
QUALIFYING,
|
|
1963
|
+
CONSOLATION,
|
|
1964
|
+
ITEM,
|
|
1965
|
+
CONTAINER,
|
|
1966
|
+
FIRST_MATCHUP,
|
|
1967
|
+
WINNER,
|
|
1968
|
+
LOSER,
|
|
1969
|
+
AD_HOC,
|
|
1970
|
+
FEED_IN: FEED_IN$1,
|
|
1971
|
+
FLEX_ROUNDS,
|
|
1972
|
+
COMPASS,
|
|
1973
|
+
PLAY_OFF,
|
|
1974
|
+
OLYMPIC,
|
|
1975
|
+
KNOCKOUT,
|
|
1976
|
+
SINGLE_ELIMINATION,
|
|
1977
|
+
DOUBLE_ELIMINATION,
|
|
1978
|
+
CURTIS,
|
|
1979
|
+
FICSF,
|
|
1980
|
+
FICQF,
|
|
1981
|
+
FICR16,
|
|
1982
|
+
MFIC,
|
|
1983
|
+
VOLUNTARY_CONSOLATION,
|
|
1984
|
+
FIRST_MATCH_LOSER_CONSOLATION,
|
|
1985
|
+
FIRST_ROUND_LOSER_CONSOLATION,
|
|
1986
|
+
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
1987
|
+
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
1988
|
+
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
1989
|
+
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
1990
|
+
FEED_IN_CHAMPIONSHIP,
|
|
1991
|
+
LUCKY_DRAW,
|
|
1992
|
+
ROUND_ROBIN_WITH_PLAYOFF,
|
|
1993
|
+
ROUND_ROBIN,
|
|
1994
|
+
DECIDER,
|
|
1995
|
+
BACKDRAW,
|
|
1996
|
+
COMPASS_ATTRIBUTES,
|
|
1997
|
+
OLYMPIC_ATTRIBUTES,
|
|
1998
|
+
DRAW,
|
|
1999
|
+
RANDOM,
|
|
2000
|
+
TOP_DOWN,
|
|
2001
|
+
BOTTOM_UP,
|
|
2002
|
+
WATERFALL,
|
|
2003
|
+
WIN_RATIO: WIN_RATIO$1,
|
|
2004
|
+
ROUND_OUTCOME,
|
|
2005
|
+
MULTI_STRUCTURE_DRAWS,
|
|
2006
|
+
generatedDrawTypes,
|
|
2007
|
+
stageOrder: stageOrder$1,
|
|
2008
|
+
finishOrder,
|
|
2009
|
+
AGGREGATE_EVENT_STRUCTURES,
|
|
2010
|
+
FINISHING_POSITIONS,
|
|
2011
|
+
};
|
|
2012
|
+
|
|
1816
2013
|
const TOURNAMENT_RECORDS = 'tournamentRecords';
|
|
1817
2014
|
const POLICY_DEFINITIONS = 'policyDefinitions';
|
|
1818
2015
|
const TOURNAMENT_RECORD = 'tournamentRecord';
|
|
@@ -1827,6 +2024,7 @@ const ROUND_NUMBER = 'roundNumber';
|
|
|
1827
2024
|
const STRUCTURE_ID = 'structureId';
|
|
1828
2025
|
const PARTICIPANT = 'participant';
|
|
1829
2026
|
const MATCHUP_IDS = 'matchUpIds';
|
|
2027
|
+
const ENTRY_STAGE = 'entryStage';
|
|
1830
2028
|
const POLICY_TYPE = 'policyType';
|
|
1831
2029
|
const STRUCTURES = 'structures';
|
|
1832
2030
|
const MATCHUP_ID = 'matchUpId';
|
|
@@ -1861,6 +2059,7 @@ const ONE_OF = '_oneOf';
|
|
|
1861
2059
|
const validators = {
|
|
1862
2060
|
[EVENT_TYPE]: (value) => [SINGLES$1, DOUBLES$1, TEAM$2].includes(value),
|
|
1863
2061
|
[ONLINE_RESOURCE]: (value) => intersection(Object.keys(value), [RESOURCE_SUB_TYPE, RESOURCE_TYPE, IDENTIFIER]).length === 3,
|
|
2062
|
+
[ENTRY_STAGE]: (value) => validStages.includes(value),
|
|
1864
2063
|
};
|
|
1865
2064
|
const errors = {
|
|
1866
2065
|
[TOURNAMENT_RECORDS]: MISSING_TOURNAMENT_RECORDS,
|
|
@@ -2471,6 +2670,7 @@ const POLICY_TYPE_PARTICIPANT = 'participant';
|
|
|
2471
2670
|
const POLICY_TYPE_PROGRESSION = 'progression';
|
|
2472
2671
|
const POLICY_TYPE_SCHEDULING = 'scheduling';
|
|
2473
2672
|
const POLICY_TYPE_AVOIDANCE = 'avoidance';
|
|
2673
|
+
const POLICY_TYPE_PRIVACY = 'participant';
|
|
2474
2674
|
const POLICY_TYPE_DISPLAY = 'display';
|
|
2475
2675
|
const POLICY_TYPE_SCORING = 'scoring';
|
|
2476
2676
|
const POLICY_TYPE_SEEDING = 'seeding';
|
|
@@ -2490,6 +2690,7 @@ const policyConstants = {
|
|
|
2490
2690
|
POLICY_TYPE_SCHEDULING,
|
|
2491
2691
|
POLICY_TYPE_AVOIDANCE,
|
|
2492
2692
|
POLICY_TYPE_DISPLAY,
|
|
2693
|
+
POLICY_TYPE_PRIVACY,
|
|
2493
2694
|
POLICY_TYPE_FEED_IN,
|
|
2494
2695
|
POLICY_TYPE_SCORING,
|
|
2495
2696
|
POLICY_TYPE_SEEDING,
|
|
@@ -3061,184 +3262,6 @@ const matchUpStatusConstants = {
|
|
|
3061
3262
|
WALKOVER: WALKOVER$2,
|
|
3062
3263
|
};
|
|
3063
3264
|
|
|
3064
|
-
const MAIN = 'MAIN';
|
|
3065
|
-
const QUALIFYING = 'QUALIFYING';
|
|
3066
|
-
const CONSOLATION = 'CONSOLATION';
|
|
3067
|
-
const VOLUNTARY_CONSOLATION = 'VOLUNTARY_CONSOLATION';
|
|
3068
|
-
const PLAY_OFF = 'PLAY_OFF';
|
|
3069
|
-
const validStages = [MAIN, QUALIFYING, CONSOLATION, PLAY_OFF, VOLUNTARY_CONSOLATION];
|
|
3070
|
-
const stageOrder$1 = {
|
|
3071
|
-
[QUALIFYING]: 1,
|
|
3072
|
-
[MAIN]: 2,
|
|
3073
|
-
[PLAY_OFF]: 3,
|
|
3074
|
-
[CONSOLATION]: 3,
|
|
3075
|
-
[VOLUNTARY_CONSOLATION]: 4,
|
|
3076
|
-
};
|
|
3077
|
-
const FINISHING_POSITIONS = 'finishingPositions';
|
|
3078
|
-
const AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
3079
|
-
const finishOrder = {
|
|
3080
|
-
[MAIN]: 1,
|
|
3081
|
-
[PLAY_OFF]: 2,
|
|
3082
|
-
[CONSOLATION]: 3,
|
|
3083
|
-
[QUALIFYING]: 4,
|
|
3084
|
-
[VOLUNTARY_CONSOLATION]: 5,
|
|
3085
|
-
};
|
|
3086
|
-
const aggregateOrder = {
|
|
3087
|
-
[PLAY_OFF]: 1,
|
|
3088
|
-
[MAIN]: 2,
|
|
3089
|
-
[CONSOLATION]: 3,
|
|
3090
|
-
[QUALIFYING]: 4,
|
|
3091
|
-
[VOLUNTARY_CONSOLATION]: 5,
|
|
3092
|
-
};
|
|
3093
|
-
const CLUSTER = 'CLUSTER';
|
|
3094
|
-
const SEPARATE = 'SEPARATE';
|
|
3095
|
-
const WATERFALL = 'WATERFALL';
|
|
3096
|
-
const ITEM = 'ITEM';
|
|
3097
|
-
const CONTAINER = 'CONTAINER';
|
|
3098
|
-
const DRAW = 'DRAW';
|
|
3099
|
-
const RANDOM = 'RANDOM';
|
|
3100
|
-
const TOP_DOWN = 'TOP_DOWN';
|
|
3101
|
-
const BOTTOM_UP = 'BOTTOM_UP';
|
|
3102
|
-
const POSITION = 'POSITION';
|
|
3103
|
-
const WINNER = 'WINNER';
|
|
3104
|
-
const LOSER = 'LOSER';
|
|
3105
|
-
const FIRST_MATCHUP = 'FIRST_MATCHUP';
|
|
3106
|
-
const AD_HOC = 'AD_HOC';
|
|
3107
|
-
const FLEX_ROUNDS = 'AD_HOC';
|
|
3108
|
-
const FEED_IN$1 = 'FEED_IN';
|
|
3109
|
-
const COMPASS = 'COMPASS';
|
|
3110
|
-
const OLYMPIC = 'OLYMPIC';
|
|
3111
|
-
const KNOCKOUT = 'SINGLE_ELIMINATION';
|
|
3112
|
-
const SINGLE_ELIMINATION = 'SINGLE_ELIMINATION';
|
|
3113
|
-
const DOUBLE_ELIMINATION = 'DOUBLE_ELIMINATION';
|
|
3114
|
-
const FIRST_MATCH_LOSER_CONSOLATION = 'FIRST_MATCH_LOSER_CONSOLATION';
|
|
3115
|
-
const FIRST_ROUND_LOSER_CONSOLATION = 'FIRST_ROUND_LOSER_CONSOLATION';
|
|
3116
|
-
const LUCKY_DRAW = 'LUCKY_DRAW';
|
|
3117
|
-
const CURTIS = 'CURTIS_CONSOLATION';
|
|
3118
|
-
const CURTIS_CONSOLATION = 'CURTIS_CONSOLATION';
|
|
3119
|
-
const FICSF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
3120
|
-
const FEED_IN_CHAMPIONSHIP_TO_SF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
3121
|
-
const FICQF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
3122
|
-
const FEED_IN_CHAMPIONSHIP_TO_QF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
3123
|
-
const FICR16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
3124
|
-
const FEED_IN_CHAMPIONSHIP_TO_R16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
3125
|
-
const MFIC = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3126
|
-
const MODIFIED_FEED_IN_CHAMPIONSHIP = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3127
|
-
const FEED_IN_CHAMPIONSHIP = 'FEED_IN_CHAMPIONSHIP';
|
|
3128
|
-
const DOUBLE_ROUND_ROBIN = 'DOUBLE_ROUND_ROBIN';
|
|
3129
|
-
const ROUND_ROBIN = 'ROUND_ROBIN';
|
|
3130
|
-
const ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
3131
|
-
const DECIDER = 'DECIDER';
|
|
3132
|
-
const BACKDRAW = 'BACKDRAW';
|
|
3133
|
-
const COMPASS_ATTRIBUTES = {
|
|
3134
|
-
0: { name: 'East', abbreviation: 'E' },
|
|
3135
|
-
'0-1': { name: 'West', abbreviation: 'W' },
|
|
3136
|
-
'0-2': { name: 'North', abbreviation: 'N' },
|
|
3137
|
-
'0-3': { name: 'Northeast', abbreviation: 'NE' },
|
|
3138
|
-
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
3139
|
-
'0-1-2': { name: 'Southwest', abbreviation: 'SW' },
|
|
3140
|
-
'0-2-1': { name: 'Northwest', abbreviation: 'NW' },
|
|
3141
|
-
'0-1-1-1': { name: 'Southeast', abbreviation: 'SE' },
|
|
3142
|
-
};
|
|
3143
|
-
const OLYMPIC_ATTRIBUTES = {
|
|
3144
|
-
0: { name: 'East', abbreviation: 'E' },
|
|
3145
|
-
'0-1': { name: 'West', abbreviation: 'W' },
|
|
3146
|
-
'0-2': { name: 'North', abbreviation: 'N' },
|
|
3147
|
-
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
3148
|
-
};
|
|
3149
|
-
const WIN_RATIO$1 = 'WIN_RATIO';
|
|
3150
|
-
const ROUND_OUTCOME = 'ROUND_OUTCOME';
|
|
3151
|
-
const MULTI_STRUCTURE_DRAWS = [
|
|
3152
|
-
COMPASS,
|
|
3153
|
-
CURTIS,
|
|
3154
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3155
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3156
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3157
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3158
|
-
FICQF,
|
|
3159
|
-
FICR16,
|
|
3160
|
-
FICSF,
|
|
3161
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3162
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3163
|
-
LUCKY_DRAW,
|
|
3164
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3165
|
-
OLYMPIC,
|
|
3166
|
-
PLAY_OFF,
|
|
3167
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3168
|
-
];
|
|
3169
|
-
const generatedDrawTypes = [
|
|
3170
|
-
AD_HOC,
|
|
3171
|
-
COMPASS,
|
|
3172
|
-
CURTIS,
|
|
3173
|
-
DOUBLE_ELIMINATION,
|
|
3174
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3175
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3176
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3177
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3178
|
-
FEED_IN$1,
|
|
3179
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3180
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3181
|
-
LUCKY_DRAW,
|
|
3182
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3183
|
-
OLYMPIC,
|
|
3184
|
-
PLAY_OFF,
|
|
3185
|
-
ROUND_ROBIN,
|
|
3186
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3187
|
-
SINGLE_ELIMINATION,
|
|
3188
|
-
];
|
|
3189
|
-
const drawDefinitionConstants = {
|
|
3190
|
-
MAIN,
|
|
3191
|
-
QUALIFYING,
|
|
3192
|
-
CONSOLATION,
|
|
3193
|
-
ITEM,
|
|
3194
|
-
CONTAINER,
|
|
3195
|
-
FIRST_MATCHUP,
|
|
3196
|
-
WINNER,
|
|
3197
|
-
LOSER,
|
|
3198
|
-
AD_HOC,
|
|
3199
|
-
FEED_IN: FEED_IN$1,
|
|
3200
|
-
FLEX_ROUNDS,
|
|
3201
|
-
COMPASS,
|
|
3202
|
-
PLAY_OFF,
|
|
3203
|
-
OLYMPIC,
|
|
3204
|
-
KNOCKOUT,
|
|
3205
|
-
SINGLE_ELIMINATION,
|
|
3206
|
-
DOUBLE_ELIMINATION,
|
|
3207
|
-
CURTIS,
|
|
3208
|
-
FICSF,
|
|
3209
|
-
FICQF,
|
|
3210
|
-
FICR16,
|
|
3211
|
-
MFIC,
|
|
3212
|
-
VOLUNTARY_CONSOLATION,
|
|
3213
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3214
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3215
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3216
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3217
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3218
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3219
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3220
|
-
LUCKY_DRAW,
|
|
3221
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3222
|
-
ROUND_ROBIN,
|
|
3223
|
-
DECIDER,
|
|
3224
|
-
BACKDRAW,
|
|
3225
|
-
COMPASS_ATTRIBUTES,
|
|
3226
|
-
OLYMPIC_ATTRIBUTES,
|
|
3227
|
-
DRAW,
|
|
3228
|
-
RANDOM,
|
|
3229
|
-
TOP_DOWN,
|
|
3230
|
-
BOTTOM_UP,
|
|
3231
|
-
WATERFALL,
|
|
3232
|
-
WIN_RATIO: WIN_RATIO$1,
|
|
3233
|
-
ROUND_OUTCOME,
|
|
3234
|
-
MULTI_STRUCTURE_DRAWS,
|
|
3235
|
-
generatedDrawTypes,
|
|
3236
|
-
stageOrder: stageOrder$1,
|
|
3237
|
-
finishOrder,
|
|
3238
|
-
AGGREGATE_EVENT_STRUCTURES,
|
|
3239
|
-
FINISHING_POSITIONS,
|
|
3240
|
-
};
|
|
3241
|
-
|
|
3242
3265
|
function structureSort(a, b, config) {
|
|
3243
3266
|
const getRoundTarget = (element) => findExtension({ element, name: ROUND_TARGET })?.extension?.value;
|
|
3244
3267
|
const completed = config?.deprioritizeCompleted;
|
|
@@ -3414,9 +3437,11 @@ const MUTATIONS = 'mutations';
|
|
|
3414
3437
|
const PUBLISH_EVENT = 'publishEvent';
|
|
3415
3438
|
const PUBLISH_EVENT_SEEDING = 'publishEventSeeding';
|
|
3416
3439
|
const PUBLISH_ORDER_OF_PLAY = 'publishOrderOfPlay';
|
|
3440
|
+
const PUBLISH_PARTICIPANTS = 'publishParticipants';
|
|
3417
3441
|
const UNPUBLISH_EVENT = 'unPublishEvent';
|
|
3418
3442
|
const UNPUBLISH_EVENT_SEEDING = 'unPublishEventSeeding';
|
|
3419
3443
|
const UNPUBLISH_ORDER_OF_PLAY = 'unPublishOrderOfPlay';
|
|
3444
|
+
const UNPUBLISH_PARTICIPANTS = 'unPublishParticipants';
|
|
3420
3445
|
const UPDATE_INCONTEXT_MATCHUP = 'updateInContextMatchUp';
|
|
3421
3446
|
const topicConstants = {
|
|
3422
3447
|
ADD_DRAW_DEFINITION,
|
|
@@ -3443,6 +3468,7 @@ const topicConstants = {
|
|
|
3443
3468
|
PUBLISH_EVENT_SEEDING,
|
|
3444
3469
|
PUBLISH_EVENT,
|
|
3445
3470
|
PUBLISH_ORDER_OF_PLAY,
|
|
3471
|
+
PUBLISH_PARTICIPANTS,
|
|
3446
3472
|
UNPUBLISH_EVENT_SEEDING,
|
|
3447
3473
|
UNPUBLISH_EVENT,
|
|
3448
3474
|
UNPUBLISH_ORDER_OF_PLAY,
|
|
@@ -11537,12 +11563,16 @@ function addScheduleItem(params) {
|
|
|
11537
11563
|
}
|
|
11538
11564
|
}
|
|
11539
11565
|
|
|
11540
|
-
function getTournamentPublishStatus(
|
|
11566
|
+
function getTournamentPublishStatus(params) {
|
|
11567
|
+
const paramsCheck = checkRequiredParameters(params, [{ [TOURNAMENT_RECORD]: true }]);
|
|
11568
|
+
if (paramsCheck.error)
|
|
11569
|
+
return paramsCheck;
|
|
11570
|
+
const { tournamentRecord, status = PUBLIC } = params;
|
|
11541
11571
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
11542
|
-
return getTournamentTimeItem({
|
|
11572
|
+
return makeDeepCopy(getTournamentTimeItem({
|
|
11543
11573
|
tournamentRecord,
|
|
11544
11574
|
itemType,
|
|
11545
|
-
})?.timeItem?.itemValue?.[status];
|
|
11575
|
+
})?.timeItem?.itemValue?.[status], false, true);
|
|
11546
11576
|
}
|
|
11547
11577
|
|
|
11548
11578
|
function isValidTournamentRecord(tournamentRecord) {
|
|
@@ -11637,6 +11667,8 @@ function getPublishState(params) {
|
|
|
11637
11667
|
if (tournamentRecord) {
|
|
11638
11668
|
const pubStatus = getTournamentPublishStatus({ tournamentRecord });
|
|
11639
11669
|
publishState.tournament = pubStatus ?? {};
|
|
11670
|
+
if (pubStatus?.orderOfPlay?.published || pubStatus?.participants?.published)
|
|
11671
|
+
tournamentPublished = true;
|
|
11640
11672
|
publishState.tournament.status = { published: tournamentPublished, publishedEventIds };
|
|
11641
11673
|
}
|
|
11642
11674
|
return { ...SUCCESS, publishState };
|
|
@@ -12708,12 +12740,11 @@ function getStageSpace({ entryStatus = DIRECT_ACCEPTANCE, drawDefinition, stageS
|
|
|
12708
12740
|
}
|
|
12709
12741
|
|
|
12710
12742
|
function addDrawEntry(params) {
|
|
12743
|
+
const paramsCheck = checkRequiredParameters(params, [{ [DRAW_DEFINITION]: true, [ENTRY_STAGE]: true }]);
|
|
12744
|
+
if (paramsCheck.error)
|
|
12745
|
+
return paramsCheck;
|
|
12711
12746
|
const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE, entryStageSequence, entryStage = MAIN, ignoreStageSpace, drawDefinition, entryPosition, participant, roundTarget, extensions, extension, drawType, event, } = params;
|
|
12712
12747
|
const stack = 'addDrawEntry';
|
|
12713
|
-
if (!drawDefinition)
|
|
12714
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
12715
|
-
if (!entryStage)
|
|
12716
|
-
return { error: MISSING_STAGE };
|
|
12717
12748
|
if (drawType !== AD_HOC && !getValidStage({ stage: entryStage, drawDefinition })) {
|
|
12718
12749
|
return decorateResult({ result: { error: INVALID_STAGE }, stack });
|
|
12719
12750
|
}
|
|
@@ -12794,7 +12825,7 @@ function addDrawEntry(params) {
|
|
|
12794
12825
|
}
|
|
12795
12826
|
function addDrawEntries$1(params) {
|
|
12796
12827
|
const stack = 'addDrawEntries';
|
|
12797
|
-
const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE,
|
|
12828
|
+
const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE, autoEntryPositions = true, ignoreStageSpace, participantIds, drawDefinition, stageSequence, stage = MAIN, roundTarget, extension, event, } = params;
|
|
12798
12829
|
if (!stage)
|
|
12799
12830
|
return { error: MISSING_STAGE };
|
|
12800
12831
|
if (!drawDefinition)
|
|
@@ -17497,117 +17528,26 @@ function resequenceStructures({ drawDefinition }) {
|
|
|
17497
17528
|
return { ...SUCCESS };
|
|
17498
17529
|
}
|
|
17499
17530
|
|
|
17500
|
-
function
|
|
17501
|
-
const
|
|
17502
|
-
if (
|
|
17503
|
-
return
|
|
17504
|
-
const
|
|
17505
|
-
|
|
17506
|
-
return element;
|
|
17507
|
-
const validTimeItem = isObject(timeItem) && isString(timeItem.itemType) && Object.keys(timeItem).includes('itemValue');
|
|
17508
|
-
if (!validTimeItem)
|
|
17509
|
-
return { error: INVALID_TIME_ITEM };
|
|
17510
|
-
if (!element.timeItems) {
|
|
17511
|
-
element.timeItems = [];
|
|
17512
|
-
}
|
|
17513
|
-
else if (hasEquivalentTimeItem({ element, duplicateValues, timeItem })) {
|
|
17514
|
-
return { ...SUCCESS };
|
|
17515
|
-
}
|
|
17516
|
-
if (timeItem.itemSubTypes && !timeItem.itemSubTypes.length)
|
|
17517
|
-
delete timeItem.itemSubTypes;
|
|
17518
|
-
if (creationTime) {
|
|
17519
|
-
const createdAt = new Date().toISOString();
|
|
17520
|
-
Object.assign(timeItem, { createdAt });
|
|
17521
|
-
}
|
|
17522
|
-
if (removePriorValues)
|
|
17523
|
-
element.timeItems = element.timeItems.filter(({ itemType }) => timeItem.itemType !== itemType);
|
|
17524
|
-
const doNotAdd = removePriorValues && !timeItem.itemValue;
|
|
17525
|
-
if (!doNotAdd)
|
|
17526
|
-
element.timeItems.push(timeItem);
|
|
17527
|
-
return { ...SUCCESS };
|
|
17528
|
-
}
|
|
17529
|
-
function hasEquivalentTimeItem({ element, duplicateValues, timeItem }) {
|
|
17530
|
-
const { itemType, itemSubTypes, itemValue } = timeItem;
|
|
17531
|
-
const existingTimeItem = itemType &&
|
|
17532
|
-
getTimeItem({
|
|
17533
|
-
itemSubTypes,
|
|
17534
|
-
itemType,
|
|
17535
|
-
element,
|
|
17536
|
-
})?.timeItem;
|
|
17537
|
-
return (existingTimeItem && JSON.stringify(existingTimeItem?.itemValue) === JSON.stringify(itemValue) && !duplicateValues);
|
|
17538
|
-
}
|
|
17539
|
-
function addParticipantTimeItem({ creationTime = true, removePriorValues, tournamentRecord, duplicateValues, participantId, timeItem, }) {
|
|
17540
|
-
if (!tournamentRecord)
|
|
17541
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17542
|
-
if (!participantId)
|
|
17543
|
-
return { error: MISSING_PARTICIPANT_ID };
|
|
17544
|
-
const result = findTournamentParticipant({ tournamentRecord, participantId });
|
|
17545
|
-
if (result.error)
|
|
17546
|
-
return result;
|
|
17547
|
-
return addTimeItem({
|
|
17548
|
-
element: result.participant,
|
|
17549
|
-
removePriorValues,
|
|
17550
|
-
duplicateValues,
|
|
17551
|
-
creationTime,
|
|
17552
|
-
timeItem,
|
|
17553
|
-
});
|
|
17554
|
-
}
|
|
17555
|
-
function addTournamentTimeItem(params) {
|
|
17556
|
-
const { removePriorValues, tournamentRecord, duplicateValues, creationTime, timeItem } = params;
|
|
17557
|
-
if (!tournamentRecord)
|
|
17558
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17559
|
-
return addTimeItem({
|
|
17560
|
-
element: tournamentRecord,
|
|
17561
|
-
removePriorValues,
|
|
17562
|
-
duplicateValues,
|
|
17563
|
-
creationTime,
|
|
17564
|
-
timeItem,
|
|
17565
|
-
});
|
|
17566
|
-
}
|
|
17567
|
-
function addEventTimeItem(params) {
|
|
17568
|
-
const { removePriorValues, duplicateValues, creationTime, timeItem, event } = params;
|
|
17569
|
-
if (!event)
|
|
17570
|
-
return { error: EVENT_NOT_FOUND };
|
|
17571
|
-
return addTimeItem({
|
|
17572
|
-
removePriorValues,
|
|
17573
|
-
duplicateValues,
|
|
17574
|
-
element: event,
|
|
17575
|
-
creationTime,
|
|
17576
|
-
timeItem,
|
|
17577
|
-
});
|
|
17578
|
-
}
|
|
17579
|
-
|
|
17580
|
-
function attachQualifyingStructure({ tournamentRecord, drawDefinition, structure, link }) {
|
|
17581
|
-
if (!tournamentRecord)
|
|
17582
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17583
|
-
if (!drawDefinition)
|
|
17584
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
17585
|
-
const result = attachQualifying({
|
|
17531
|
+
function attachQualifyingStructure(params) {
|
|
17532
|
+
const paramsCheck = checkRequiredParameters(params, [{ [TOURNAMENT_RECORD]: true, [DRAW_DEFINITION]: true }]);
|
|
17533
|
+
if (paramsCheck.error)
|
|
17534
|
+
return paramsCheck;
|
|
17535
|
+
const { tournamentRecord, drawDefinition, structure, link } = params;
|
|
17536
|
+
return attachQualifying({
|
|
17586
17537
|
tournamentId: tournamentRecord.tournamentId,
|
|
17587
17538
|
drawDefinition,
|
|
17588
17539
|
structure,
|
|
17589
17540
|
link,
|
|
17590
17541
|
});
|
|
17591
|
-
if (result.error)
|
|
17592
|
-
return result;
|
|
17593
|
-
const qualifyingDetails = {
|
|
17594
|
-
structureId: structure.structureId,
|
|
17595
|
-
drawId: drawDefinition.drawId,
|
|
17596
|
-
};
|
|
17597
|
-
const timeItem = {
|
|
17598
|
-
itemType: 'attachQualifyingStructures',
|
|
17599
|
-
itemValue: qualifyingDetails,
|
|
17600
|
-
};
|
|
17601
|
-
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
17602
|
-
return result;
|
|
17603
17542
|
}
|
|
17604
|
-
function attachQualifying(
|
|
17605
|
-
|
|
17606
|
-
|
|
17607
|
-
|
|
17608
|
-
|
|
17609
|
-
if (
|
|
17610
|
-
return
|
|
17543
|
+
function attachQualifying(params) {
|
|
17544
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
17545
|
+
{ [DRAW_DEFINITION]: true, [STRUCTURE]: true },
|
|
17546
|
+
{ link: true, [OF_TYPE]: OBJECT, [ERROR$1]: MISSING_TARGET_LINK },
|
|
17547
|
+
]);
|
|
17548
|
+
if (paramsCheck.error)
|
|
17549
|
+
return paramsCheck;
|
|
17550
|
+
const { drawDefinition, tournamentId, structure, eventId, link } = params;
|
|
17611
17551
|
const targetStructureId = link.target.structureId;
|
|
17612
17552
|
const result = findStructure({
|
|
17613
17553
|
drawDefinition,
|
|
@@ -18492,22 +18432,6 @@ function addQualifyingStructure(params) {
|
|
|
18492
18432
|
const result = addQualifying(params);
|
|
18493
18433
|
if (result.error)
|
|
18494
18434
|
return result;
|
|
18495
|
-
const { qualifyingRoundNumber, qualifyingPositions, targetStructureId, drawDefinition, structureName, matchUpType, drawSize, drawType, } = params;
|
|
18496
|
-
const qualifyingDetails = definedAttributes({
|
|
18497
|
-
drawId: drawDefinition.drawId,
|
|
18498
|
-
qualifyingRoundNumber,
|
|
18499
|
-
qualifyingPositions,
|
|
18500
|
-
targetStructureId,
|
|
18501
|
-
structureName,
|
|
18502
|
-
matchUpType,
|
|
18503
|
-
drawSize,
|
|
18504
|
-
drawType,
|
|
18505
|
-
});
|
|
18506
|
-
const timeItem = {
|
|
18507
|
-
itemType: 'addQualifyingStructures',
|
|
18508
|
-
itemValue: qualifyingDetails,
|
|
18509
|
-
};
|
|
18510
|
-
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
18511
18435
|
return result;
|
|
18512
18436
|
}
|
|
18513
18437
|
function addQualifying(params) {
|
|
@@ -21875,30 +21799,9 @@ function validateTieFormat(params) {
|
|
|
21875
21799
|
const event = params?.event;
|
|
21876
21800
|
const stack = 'validateTieFormat';
|
|
21877
21801
|
const errors = [];
|
|
21878
|
-
|
|
21879
|
-
|
|
21880
|
-
return
|
|
21881
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21882
|
-
context: { tieFormat, errors },
|
|
21883
|
-
stack,
|
|
21884
|
-
});
|
|
21885
|
-
}
|
|
21886
|
-
if (typeof tieFormat.winCriteria !== 'object') {
|
|
21887
|
-
errors.push('tieFormat.winCriteria must be an object');
|
|
21888
|
-
return decorateResult({
|
|
21889
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21890
|
-
context: { tieFormat, errors },
|
|
21891
|
-
stack,
|
|
21892
|
-
});
|
|
21893
|
-
}
|
|
21894
|
-
if (!Array.isArray(tieFormat.collectionDefinitions)) {
|
|
21895
|
-
errors.push(mustBeAnArray('tieFormat.collectionDefinitions'));
|
|
21896
|
-
return decorateResult({
|
|
21897
|
-
result: { error: INVALID_TIE_FORMAT },
|
|
21898
|
-
context: { tieFormat, errors },
|
|
21899
|
-
stack,
|
|
21900
|
-
});
|
|
21901
|
-
}
|
|
21802
|
+
const paramsCheck = checkParams$1({ ...params, stack });
|
|
21803
|
+
if (paramsCheck?.error)
|
|
21804
|
+
return paramsCheck;
|
|
21902
21805
|
let aggregateValueImperative;
|
|
21903
21806
|
const validCollections = tieFormat.collectionDefinitions.every((collectionDefinition) => {
|
|
21904
21807
|
const { setValue, scoreValue, collectionValue } = collectionDefinition;
|
|
@@ -21951,6 +21854,31 @@ function validateTieFormat(params) {
|
|
|
21951
21854
|
}
|
|
21952
21855
|
return result;
|
|
21953
21856
|
}
|
|
21857
|
+
function checkParams$1(params) {
|
|
21858
|
+
const { tieFormat, stack } = params;
|
|
21859
|
+
if (!params || !tieFormat || !isObject(tieFormat)) {
|
|
21860
|
+
return decorateResult({
|
|
21861
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21862
|
+
context: { tieFormat, message: 'tieformat must be an object' },
|
|
21863
|
+
stack,
|
|
21864
|
+
});
|
|
21865
|
+
}
|
|
21866
|
+
if (!isObject(tieFormat.winCriteria)) {
|
|
21867
|
+
return decorateResult({
|
|
21868
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21869
|
+
context: { tieFormat, message: 'tieformat.winCritiera must be an object' },
|
|
21870
|
+
stack,
|
|
21871
|
+
});
|
|
21872
|
+
}
|
|
21873
|
+
if (!Array.isArray(tieFormat.collectionDefinitions)) {
|
|
21874
|
+
return decorateResult({
|
|
21875
|
+
result: { error: INVALID_TIE_FORMAT },
|
|
21876
|
+
context: { tieFormat, message: 'collectionDefinitions must be an array' },
|
|
21877
|
+
stack,
|
|
21878
|
+
});
|
|
21879
|
+
}
|
|
21880
|
+
return { ...SUCCESS };
|
|
21881
|
+
}
|
|
21954
21882
|
|
|
21955
21883
|
function generateTieMatchUpScore(params) {
|
|
21956
21884
|
const { sideAdjustments = [0, 0], separator = '-', drawDefinition, matchUpsMap, structure, matchUp, event, } = params;
|
|
@@ -22892,6 +22820,107 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
22892
22820
|
};
|
|
22893
22821
|
}
|
|
22894
22822
|
|
|
22823
|
+
function getTimeItemValues({ element }) {
|
|
22824
|
+
if (!element)
|
|
22825
|
+
return { error: INVALID_VALUES };
|
|
22826
|
+
if (!element.timeItems)
|
|
22827
|
+
return {};
|
|
22828
|
+
if (!Array.isArray(element.timeItems))
|
|
22829
|
+
return { error: INVALID_VALUES };
|
|
22830
|
+
const mapItem = (key, value) => (a, i) => {
|
|
22831
|
+
if (!i[key])
|
|
22832
|
+
return a;
|
|
22833
|
+
a[i[key]] = i[value];
|
|
22834
|
+
return a;
|
|
22835
|
+
};
|
|
22836
|
+
return element.timeItems.reduce(mapItem('itemType', 'itemValue'), {});
|
|
22837
|
+
}
|
|
22838
|
+
|
|
22839
|
+
function addTimeItem(params) {
|
|
22840
|
+
const { duplicateValues = true, creationTime = true, removePriorValues, timeItem } = params;
|
|
22841
|
+
if (!timeItem)
|
|
22842
|
+
return { error: MISSING_TIME_ITEM };
|
|
22843
|
+
const element = deriveElement(params);
|
|
22844
|
+
if (element.error)
|
|
22845
|
+
return element;
|
|
22846
|
+
const validTimeItem = isObject(timeItem) && isString(timeItem.itemType) && Object.keys(timeItem).includes('itemValue');
|
|
22847
|
+
if (!validTimeItem)
|
|
22848
|
+
return { error: INVALID_TIME_ITEM };
|
|
22849
|
+
if (!element.timeItems) {
|
|
22850
|
+
element.timeItems = [];
|
|
22851
|
+
}
|
|
22852
|
+
else if (hasEquivalentTimeItem({ element, duplicateValues, timeItem })) {
|
|
22853
|
+
return { ...SUCCESS };
|
|
22854
|
+
}
|
|
22855
|
+
if (timeItem.itemSubTypes && !timeItem.itemSubTypes.length)
|
|
22856
|
+
delete timeItem.itemSubTypes;
|
|
22857
|
+
if (creationTime) {
|
|
22858
|
+
const createdAt = new Date().toISOString();
|
|
22859
|
+
Object.assign(timeItem, { createdAt });
|
|
22860
|
+
}
|
|
22861
|
+
if (removePriorValues)
|
|
22862
|
+
element.timeItems = element.timeItems.filter(({ itemType }) => timeItem.itemType !== itemType);
|
|
22863
|
+
const doNotAdd = removePriorValues && !timeItem.itemValue;
|
|
22864
|
+
if (!doNotAdd)
|
|
22865
|
+
element.timeItems.push(timeItem);
|
|
22866
|
+
return { ...SUCCESS };
|
|
22867
|
+
}
|
|
22868
|
+
function hasEquivalentTimeItem({ element, duplicateValues, timeItem }) {
|
|
22869
|
+
const { itemType, itemSubTypes, itemValue } = timeItem;
|
|
22870
|
+
const existingTimeItem = itemType &&
|
|
22871
|
+
getTimeItem({
|
|
22872
|
+
itemSubTypes,
|
|
22873
|
+
itemType,
|
|
22874
|
+
element,
|
|
22875
|
+
})?.timeItem;
|
|
22876
|
+
return (existingTimeItem && JSON.stringify(existingTimeItem?.itemValue) === JSON.stringify(itemValue) && !duplicateValues);
|
|
22877
|
+
}
|
|
22878
|
+
function addParticipantTimeItem({ creationTime = true, removePriorValues, tournamentRecord, duplicateValues, participantId, timeItem, }) {
|
|
22879
|
+
if (!tournamentRecord)
|
|
22880
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22881
|
+
if (!participantId)
|
|
22882
|
+
return { error: MISSING_PARTICIPANT_ID };
|
|
22883
|
+
const result = findTournamentParticipant({ tournamentRecord, participantId });
|
|
22884
|
+
if (result.error)
|
|
22885
|
+
return result;
|
|
22886
|
+
return addTimeItem({
|
|
22887
|
+
element: result.participant,
|
|
22888
|
+
removePriorValues,
|
|
22889
|
+
duplicateValues,
|
|
22890
|
+
creationTime,
|
|
22891
|
+
timeItem,
|
|
22892
|
+
});
|
|
22893
|
+
}
|
|
22894
|
+
function addTournamentTimeItem(params) {
|
|
22895
|
+
const { removePriorValues, tournamentRecord, duplicateValues, creationTime, timeItem } = params;
|
|
22896
|
+
if (!tournamentRecord)
|
|
22897
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
22898
|
+
const result = addTimeItem({
|
|
22899
|
+
element: tournamentRecord,
|
|
22900
|
+
removePriorValues,
|
|
22901
|
+
duplicateValues,
|
|
22902
|
+
creationTime,
|
|
22903
|
+
timeItem,
|
|
22904
|
+
});
|
|
22905
|
+
if (result.error)
|
|
22906
|
+
return result;
|
|
22907
|
+
const timeItemValues = getTimeItemValues({ element: tournamentRecord });
|
|
22908
|
+
addNotice({ topic: MODIFY_TOURNAMENT_DETAIL, payload: { timeItemValues } });
|
|
22909
|
+
return result;
|
|
22910
|
+
}
|
|
22911
|
+
function addEventTimeItem(params) {
|
|
22912
|
+
const { removePriorValues, duplicateValues, creationTime, timeItem, event } = params;
|
|
22913
|
+
if (!event)
|
|
22914
|
+
return { error: EVENT_NOT_FOUND };
|
|
22915
|
+
return addTimeItem({
|
|
22916
|
+
removePriorValues,
|
|
22917
|
+
duplicateValues,
|
|
22918
|
+
element: event,
|
|
22919
|
+
creationTime,
|
|
22920
|
+
timeItem,
|
|
22921
|
+
});
|
|
22922
|
+
}
|
|
22923
|
+
|
|
22895
22924
|
function attachConsolationStructures(params) {
|
|
22896
22925
|
return attachStructures({
|
|
22897
22926
|
...params,
|
|
@@ -33621,7 +33650,7 @@ function getTournamentInfo(params) {
|
|
|
33621
33650
|
const { tournamentRecord } = params ?? {};
|
|
33622
33651
|
if (!tournamentRecord)
|
|
33623
33652
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
33624
|
-
const tournamentInfo = (({ tournamentId, tournamentRank, tournamentStatus, formalName, tournamentName, promotionalName, onlineResources, localTimeZone, startDate, endDate, hostCountryCode, venues, notes, updatedAt, }) => ({
|
|
33653
|
+
const tournamentInfo = (({ tournamentId, tournamentRank, tournamentStatus, formalName, tournamentName, promotionalName, onlineResources, localTimeZone, activeDates, startDate, endDate, hostCountryCode, venues, notes, updatedAt, }) => ({
|
|
33625
33654
|
tournamentId,
|
|
33626
33655
|
tournamentRank,
|
|
33627
33656
|
tournamentStatus,
|
|
@@ -33630,6 +33659,7 @@ function getTournamentInfo(params) {
|
|
|
33630
33659
|
promotionalName,
|
|
33631
33660
|
onlineResources,
|
|
33632
33661
|
localTimeZone,
|
|
33662
|
+
activeDates,
|
|
33633
33663
|
startDate,
|
|
33634
33664
|
endDate,
|
|
33635
33665
|
hostCountryCode,
|
|
@@ -33654,9 +33684,11 @@ function getTournamentInfo(params) {
|
|
|
33654
33684
|
eventInfo.push(info);
|
|
33655
33685
|
}
|
|
33656
33686
|
}
|
|
33687
|
+
tournamentInfo.timeItemValues = getTimeItemValues({ element: tournamentRecord });
|
|
33688
|
+
tournamentInfo.publishState = publishState?.tournament;
|
|
33657
33689
|
tournamentInfo.eventInfo = eventInfo;
|
|
33658
33690
|
return {
|
|
33659
|
-
tournamentInfo: makeDeepCopy(tournamentInfo, false, true),
|
|
33691
|
+
tournamentInfo: makeDeepCopy(definedAttributes(tournamentInfo), false, true),
|
|
33660
33692
|
...SUCCESS,
|
|
33661
33693
|
};
|
|
33662
33694
|
}
|
|
@@ -34608,6 +34640,7 @@ var query$5 = {
|
|
|
34608
34640
|
getEventData: getEventData,
|
|
34609
34641
|
getEventPublishStatus: getEventPublishStatus,
|
|
34610
34642
|
getPublishState: getPublishState,
|
|
34643
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
34611
34644
|
getVenueData: getVenueData
|
|
34612
34645
|
};
|
|
34613
34646
|
|
|
@@ -35257,13 +35290,54 @@ function getProfileRounds({ tournamentRecords, schedulingProfile, tournamentReco
|
|
|
35257
35290
|
return { profileRounds, segmentedRounds };
|
|
35258
35291
|
}
|
|
35259
35292
|
|
|
35293
|
+
function courtGridRows({ courtPrefix = 'C|', minRowsCount, courtsData }) {
|
|
35294
|
+
if (!Array.isArray(courtsData))
|
|
35295
|
+
return { error: INVALID_VALUES };
|
|
35296
|
+
const maxCourtOrder = courtsData?.reduce((order, court) => {
|
|
35297
|
+
const matchUps = court.matchUps || [];
|
|
35298
|
+
const courtOrder = Math.max(0, ...matchUps.map((m) => m.schedule.courtOrder || 0));
|
|
35299
|
+
return courtOrder > order ? courtOrder : order;
|
|
35300
|
+
}, 1);
|
|
35301
|
+
const rowsCount = minRowsCount ? Math.max(minRowsCount, maxCourtOrder) : maxCourtOrder;
|
|
35302
|
+
const rowBuilder = generateRange(0, rowsCount).map((rowIndex) => ({
|
|
35303
|
+
matchUps: generateRange(0, courtsData.length).map((courtIndex) => {
|
|
35304
|
+
const courtInfo = courtsData[courtIndex];
|
|
35305
|
+
const { courtId, venueId } = courtInfo;
|
|
35306
|
+
return {
|
|
35307
|
+
schedule: {
|
|
35308
|
+
courtOrder: rowIndex + 1,
|
|
35309
|
+
venueId,
|
|
35310
|
+
courtId,
|
|
35311
|
+
},
|
|
35312
|
+
};
|
|
35313
|
+
}),
|
|
35314
|
+
}));
|
|
35315
|
+
courtsData.forEach((courtInfo, i) => {
|
|
35316
|
+
for (const matchUp of courtInfo.matchUps) {
|
|
35317
|
+
const courtOrder = matchUp.schedule?.courtOrder;
|
|
35318
|
+
if (courtOrder) {
|
|
35319
|
+
rowBuilder[courtOrder - 1].matchUps[i] = matchUp;
|
|
35320
|
+
}
|
|
35321
|
+
}
|
|
35322
|
+
});
|
|
35323
|
+
return {
|
|
35324
|
+
courtPrefix,
|
|
35325
|
+
rows: rowBuilder.map((row, i) => Object.assign({ rowId: `rowId-${i + 1}` }, ...row.matchUps.map((matchUp, i) => ({
|
|
35326
|
+
[`${courtPrefix}${i}`]: matchUp,
|
|
35327
|
+
})))),
|
|
35328
|
+
};
|
|
35329
|
+
}
|
|
35330
|
+
|
|
35260
35331
|
var query$4 = {
|
|
35261
35332
|
__proto__: null,
|
|
35333
|
+
courtGridRows: courtGridRows,
|
|
35334
|
+
findVenue: findVenue,
|
|
35262
35335
|
getPersonRequests: getPersonRequests,
|
|
35263
35336
|
getProfileRounds: getProfileRounds,
|
|
35264
35337
|
getScheduledRoundsDetails: getScheduledRoundsDetails,
|
|
35265
35338
|
getSchedulingProfile: getSchedulingProfile,
|
|
35266
|
-
getSchedulingProfileIssues: getSchedulingProfileIssues
|
|
35339
|
+
getSchedulingProfileIssues: getSchedulingProfileIssues,
|
|
35340
|
+
publicFindCourt: publicFindCourt
|
|
35267
35341
|
};
|
|
35268
35342
|
|
|
35269
35343
|
function getEntriesAndSeedsCount({ policyDefinitions, drawDefinition, drawSize, drawId, event, stage, }) {
|
|
@@ -35762,44 +35836,6 @@ function scheduledSortedMatchUps({ schedulingProfile, matchUps = [] }) {
|
|
|
35762
35836
|
return sortedMatchUps;
|
|
35763
35837
|
}
|
|
35764
35838
|
|
|
35765
|
-
function courtGridRows({ courtPrefix = 'C|', minRowsCount, courtsData }) {
|
|
35766
|
-
if (!Array.isArray(courtsData))
|
|
35767
|
-
return { error: INVALID_VALUES };
|
|
35768
|
-
const maxCourtOrder = courtsData?.reduce((order, court) => {
|
|
35769
|
-
const matchUps = court.matchUps || [];
|
|
35770
|
-
const courtOrder = Math.max(0, ...matchUps.map((m) => m.schedule.courtOrder || 0));
|
|
35771
|
-
return courtOrder > order ? courtOrder : order;
|
|
35772
|
-
}, 1);
|
|
35773
|
-
const rowsCount = minRowsCount ? Math.max(minRowsCount, maxCourtOrder) : maxCourtOrder;
|
|
35774
|
-
const rowBuilder = generateRange(0, rowsCount).map((rowIndex) => ({
|
|
35775
|
-
matchUps: generateRange(0, courtsData.length).map((courtIndex) => {
|
|
35776
|
-
const courtInfo = courtsData[courtIndex];
|
|
35777
|
-
const { courtId, venueId } = courtInfo;
|
|
35778
|
-
return {
|
|
35779
|
-
schedule: {
|
|
35780
|
-
courtOrder: rowIndex + 1,
|
|
35781
|
-
venueId,
|
|
35782
|
-
courtId,
|
|
35783
|
-
},
|
|
35784
|
-
};
|
|
35785
|
-
}),
|
|
35786
|
-
}));
|
|
35787
|
-
courtsData.forEach((courtInfo, i) => {
|
|
35788
|
-
for (const matchUp of courtInfo.matchUps) {
|
|
35789
|
-
const courtOrder = matchUp.schedule?.courtOrder;
|
|
35790
|
-
if (courtOrder) {
|
|
35791
|
-
rowBuilder[courtOrder - 1].matchUps[i] = matchUp;
|
|
35792
|
-
}
|
|
35793
|
-
}
|
|
35794
|
-
});
|
|
35795
|
-
return {
|
|
35796
|
-
courtPrefix,
|
|
35797
|
-
rows: rowBuilder.map((row, i) => Object.assign({ rowId: `rowId-${i + 1}` }, ...row.matchUps.map((matchUp, i) => ({
|
|
35798
|
-
[`${courtPrefix}${i}`]: matchUp,
|
|
35799
|
-
})))),
|
|
35800
|
-
};
|
|
35801
|
-
}
|
|
35802
|
-
|
|
35803
35839
|
function eventMatchUps(params) {
|
|
35804
35840
|
let { participants: tournamentParticipants, contextContent, participantMap } = params;
|
|
35805
35841
|
const { tournamentAppliedPolicies, scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, usePublishState, contextFilters, matchUpFilters, contextProfile, nextMatchUps, tournamentId, inContext, context, event, } = params;
|
|
@@ -35991,11 +36027,9 @@ function competitionScheduleMatchUps(params) {
|
|
|
35991
36027
|
const getResult = getSchedulingProfile(params);
|
|
35992
36028
|
const schedulingProfile = getResult.schedulingProfile;
|
|
35993
36029
|
const { sortDateMatchUps = true, courtCompletedMatchUps, alwaysReturnCompleted, activeTournamentId, tournamentRecords, withCourtGridRows, minCourtGridRows, usePublishState, status = PUBLIC, sortCourtsData, } = params;
|
|
36030
|
+
const tournamentId = activeTournamentId ?? getTournamentId() ?? Object.keys(tournamentRecords)[0];
|
|
35994
36031
|
const tournamentPublishStatus = usePublishState
|
|
35995
|
-
?
|
|
35996
|
-
tournamentRecord: tournamentRecords[activeTournamentId ?? getTournamentId() ?? Object.keys(tournamentRecords)[0]],
|
|
35997
|
-
itemType: `${PUBLISH}.${STATUS$1}`,
|
|
35998
|
-
}).timeItem?.itemValue?.[status]
|
|
36032
|
+
? getTournamentPublishStatus({ tournamentRecord: tournamentRecords[tournamentId], status })
|
|
35999
36033
|
: undefined;
|
|
36000
36034
|
const allCompletedMatchUps = alwaysReturnCompleted
|
|
36001
36035
|
? getCompetitionMatchUps({
|
|
@@ -36007,7 +36041,7 @@ function competitionScheduleMatchUps(params) {
|
|
|
36007
36041
|
contextFilters: params.contextFilters,
|
|
36008
36042
|
}).completedMatchUps
|
|
36009
36043
|
: [];
|
|
36010
|
-
if (usePublishState &&
|
|
36044
|
+
if (usePublishState && !tournamentPublishStatus?.orderOfPlay?.published) {
|
|
36011
36045
|
return {
|
|
36012
36046
|
completedMatchUps: allCompletedMatchUps,
|
|
36013
36047
|
dateMatchUps: [],
|
|
@@ -37254,6 +37288,7 @@ var index$f = {
|
|
|
37254
37288
|
checkValidEntries: checkValidEntries,
|
|
37255
37289
|
compareTieFormats: compareTieFormats,
|
|
37256
37290
|
competitionScheduleMatchUps: competitionScheduleMatchUps,
|
|
37291
|
+
courtGridRows: courtGridRows,
|
|
37257
37292
|
credits: credits,
|
|
37258
37293
|
drawMatchUps: drawMatchUps,
|
|
37259
37294
|
eventMatchUps: eventMatchUps,
|
|
@@ -37261,6 +37296,7 @@ var index$f = {
|
|
|
37261
37296
|
filterParticipants: filterParticipants,
|
|
37262
37297
|
findDrawDefinition: publicFindDrawDefinition,
|
|
37263
37298
|
findExtension: findExtension,
|
|
37299
|
+
findVenue: findVenue,
|
|
37264
37300
|
getAllDrawMatchUps: getAllDrawMatchUps,
|
|
37265
37301
|
getAllEventData: getAllEventData,
|
|
37266
37302
|
getAllStructureMatchUps: getAllStructureMatchUps,
|
|
@@ -37345,6 +37381,7 @@ var index$f = {
|
|
|
37345
37381
|
getTournamentInfo: getTournamentInfo,
|
|
37346
37382
|
getTournamentPenalties: getTournamentPenalties,
|
|
37347
37383
|
getTournamentPersons: getTournamentPersons,
|
|
37384
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
37348
37385
|
getTournamentStructures: getTournamentStructures,
|
|
37349
37386
|
getTournamentTimeItem: getTournamentTimeItem,
|
|
37350
37387
|
getValidGroupSizes: getValidGroupSizes,
|
|
@@ -37358,6 +37395,7 @@ var index$f = {
|
|
|
37358
37395
|
participantScaleItem: participantScaleItem,
|
|
37359
37396
|
participantScheduledMatchUps: participantScheduledMatchUps,
|
|
37360
37397
|
positionActions: positionActions,
|
|
37398
|
+
publicFindCourt: publicFindCourt,
|
|
37361
37399
|
publicFindVenue: publicFindVenue,
|
|
37362
37400
|
tallyParticipantResults: tallyParticipantResults,
|
|
37363
37401
|
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
@@ -38588,7 +38626,16 @@ function deleteDrawDefinitions(params) {
|
|
|
38588
38626
|
return { error: result.error };
|
|
38589
38627
|
}
|
|
38590
38628
|
if (auditTrail.length) {
|
|
38591
|
-
|
|
38629
|
+
if (hasTopic(AUDIT)) {
|
|
38630
|
+
const tournamentId = tournamentRecord.tournamentId;
|
|
38631
|
+
addNotice({ topic: AUDIT, payload: { tournamentId, detail: auditTrail } });
|
|
38632
|
+
const result = getTimeItem({ element: event, itemType: DRAW_DELETIONS });
|
|
38633
|
+
const itemValue = (result?.timeItem?.itemValue || 0) + 1;
|
|
38634
|
+
addTimeItem({ element: event, timeItem: { itemType: DRAW_DELETIONS, itemValue }, removePriorValues: true });
|
|
38635
|
+
}
|
|
38636
|
+
else {
|
|
38637
|
+
addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData });
|
|
38638
|
+
}
|
|
38592
38639
|
}
|
|
38593
38640
|
if (matchUpIds.length) {
|
|
38594
38641
|
deleteMatchUpsNotice({
|
|
@@ -38597,7 +38644,6 @@ function deleteDrawDefinitions(params) {
|
|
|
38597
38644
|
});
|
|
38598
38645
|
}
|
|
38599
38646
|
drawIds.forEach((drawId) => deleteDrawNotice({ drawId }));
|
|
38600
|
-
addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData });
|
|
38601
38647
|
if (autoPublish && publishedDrawsDeleted) {
|
|
38602
38648
|
const result = publishEvent({
|
|
38603
38649
|
...params.eventDataParams,
|
|
@@ -38841,6 +38887,23 @@ function removeTiming({ event }) {
|
|
|
38841
38887
|
return removeEventExtension({ event, name: SCHEDULE_TIMING });
|
|
38842
38888
|
}
|
|
38843
38889
|
|
|
38890
|
+
const MON = 'MON';
|
|
38891
|
+
const TUE = 'TUE';
|
|
38892
|
+
const WED = 'WED';
|
|
38893
|
+
const THU = 'THU';
|
|
38894
|
+
const FRI = 'FRI';
|
|
38895
|
+
const SAT = 'SAT';
|
|
38896
|
+
const SUN = 'SUN';
|
|
38897
|
+
const weekdayConstants = { MON, TUE, WED, THU, FRI, SAT, SUN };
|
|
38898
|
+
|
|
38899
|
+
function isValidWeekdaysValue(value) {
|
|
38900
|
+
if (!Array.isArray(value))
|
|
38901
|
+
return false;
|
|
38902
|
+
if (unique(value).length !== value.length)
|
|
38903
|
+
return false;
|
|
38904
|
+
return value.every((v) => Object.keys(weekdayConstants).includes(v));
|
|
38905
|
+
}
|
|
38906
|
+
|
|
38844
38907
|
function setEventStartDate({ tournamentRecord, event, startDate }) {
|
|
38845
38908
|
if (!tournamentRecord)
|
|
38846
38909
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -38865,7 +38928,8 @@ function setEventStartDate({ tournamentRecord, event, startDate }) {
|
|
|
38865
38928
|
event.startDate = startDate;
|
|
38866
38929
|
return { ...SUCCESS };
|
|
38867
38930
|
}
|
|
38868
|
-
function setEventEndDate(
|
|
38931
|
+
function setEventEndDate(params) {
|
|
38932
|
+
const { tournamentRecord, event, endDate } = params;
|
|
38869
38933
|
if (!tournamentRecord)
|
|
38870
38934
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
38871
38935
|
if (!event)
|
|
@@ -38889,23 +38953,42 @@ function setEventEndDate({ tournamentRecord, event, endDate }) {
|
|
|
38889
38953
|
event.endDate = endDate;
|
|
38890
38954
|
return { ...SUCCESS };
|
|
38891
38955
|
}
|
|
38892
|
-
function setEventDates(
|
|
38893
|
-
|
|
38894
|
-
|
|
38895
|
-
|
|
38896
|
-
|
|
38897
|
-
|
|
38898
|
-
|
|
38899
|
-
|
|
38900
|
-
|
|
38901
|
-
|
|
38902
|
-
|
|
38956
|
+
function setEventDates(params) {
|
|
38957
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
38958
|
+
{ tournamentRecord: true, event: true },
|
|
38959
|
+
{
|
|
38960
|
+
[VALIDATE]: (value) => dateValidation.test(value),
|
|
38961
|
+
[INVALID]: INVALID_DATE,
|
|
38962
|
+
startDate: false,
|
|
38963
|
+
endDate: false,
|
|
38964
|
+
},
|
|
38965
|
+
{
|
|
38966
|
+
[VALIDATE]: (value) => value.every((d) => dateValidation.test(d)),
|
|
38967
|
+
[INVALID]: INVALID_DATE,
|
|
38968
|
+
activeDates: false,
|
|
38969
|
+
},
|
|
38970
|
+
{
|
|
38971
|
+
[VALIDATE]: isValidWeekdaysValue,
|
|
38972
|
+
weekdays: false,
|
|
38973
|
+
},
|
|
38974
|
+
]);
|
|
38975
|
+
if (paramsCheck.error)
|
|
38976
|
+
return paramsCheck;
|
|
38977
|
+
const { tournamentRecord, activeDates, weekdays, event, startDate, endDate } = params;
|
|
38903
38978
|
if (startDate && endDate) {
|
|
38904
38979
|
const newStartDate = new Date(extractDate(startDate)).getTime();
|
|
38905
38980
|
const newEndDate = new Date(extractDate(endDate)).getTime();
|
|
38906
38981
|
if (newStartDate > newEndDate)
|
|
38907
38982
|
return { error: INVALID_VALUES };
|
|
38908
38983
|
}
|
|
38984
|
+
if (activeDates) {
|
|
38985
|
+
const start = startDate || tournamentRecord.startDate;
|
|
38986
|
+
const end = endDate || tournamentRecord.endDate;
|
|
38987
|
+
const validStart = !start || activeDates.every((d) => new Date(d) >= new Date(start));
|
|
38988
|
+
const validEnd = !end || activeDates.every((d) => new Date(d) <= new Date(end));
|
|
38989
|
+
if (!validStart || !validEnd)
|
|
38990
|
+
return { error: INVALID_DATE };
|
|
38991
|
+
}
|
|
38909
38992
|
if (startDate) {
|
|
38910
38993
|
const result = setEventStartDate({ tournamentRecord, event, startDate });
|
|
38911
38994
|
if (result.error)
|
|
@@ -38916,6 +38999,10 @@ function setEventDates({ tournamentRecord, event, startDate, endDate }) {
|
|
|
38916
38999
|
if (result.error)
|
|
38917
39000
|
return result;
|
|
38918
39001
|
}
|
|
39002
|
+
if (activeDates)
|
|
39003
|
+
event.activeDates = activeDates;
|
|
39004
|
+
if (weekdays)
|
|
39005
|
+
event.weekdays = weekdays;
|
|
38919
39006
|
return { ...SUCCESS };
|
|
38920
39007
|
}
|
|
38921
39008
|
function getTournamentDates(tournamentRecord) {
|
|
@@ -39478,13 +39565,14 @@ function removeSeeding({ tournamentRecord, drawDefinition, entryStatuses, scaleN
|
|
|
39478
39565
|
});
|
|
39479
39566
|
}
|
|
39480
39567
|
|
|
39481
|
-
function deleteEvents(
|
|
39482
|
-
|
|
39483
|
-
|
|
39484
|
-
|
|
39485
|
-
|
|
39486
|
-
if (
|
|
39487
|
-
return
|
|
39568
|
+
function deleteEvents(params) {
|
|
39569
|
+
const paramCheck = checkRequiredParameters(params, [
|
|
39570
|
+
{ [TOURNAMENT_RECORD]: true },
|
|
39571
|
+
{ eventIds: true, [OF_TYPE]: ARRAY },
|
|
39572
|
+
]);
|
|
39573
|
+
if (paramCheck.error)
|
|
39574
|
+
return paramCheck;
|
|
39575
|
+
const { removePairParticipants, tournamentRecord, eventIds } = params;
|
|
39488
39576
|
const auditTrail = [];
|
|
39489
39577
|
const deletedEventDetails = [];
|
|
39490
39578
|
const activePairParticipantIds = [];
|
|
@@ -39525,12 +39613,17 @@ function deleteEvents({ removePairParticipants, tournamentRecord, eventIds }) {
|
|
|
39525
39613
|
}
|
|
39526
39614
|
checkAndUpdateSchedulingProfile({ tournamentRecord });
|
|
39527
39615
|
if (auditTrail.length) {
|
|
39528
|
-
|
|
39529
|
-
|
|
39530
|
-
|
|
39531
|
-
|
|
39532
|
-
|
|
39533
|
-
|
|
39616
|
+
if (hasTopic(AUDIT)) {
|
|
39617
|
+
const tournamentId = tournamentRecord.tournamentId;
|
|
39618
|
+
addNotice({ topic: AUDIT, payload: { type: DELETE_EVENTS, tournamentId, detail: auditTrail } });
|
|
39619
|
+
}
|
|
39620
|
+
else {
|
|
39621
|
+
const timeItem = {
|
|
39622
|
+
itemValue: deletedEventDetails,
|
|
39623
|
+
itemType: DELETE_EVENTS,
|
|
39624
|
+
};
|
|
39625
|
+
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
39626
|
+
}
|
|
39534
39627
|
}
|
|
39535
39628
|
return { ...SUCCESS };
|
|
39536
39629
|
}
|
|
@@ -39542,8 +39635,86 @@ function modifyEvent(params) {
|
|
|
39542
39635
|
]);
|
|
39543
39636
|
if (paramsCheck.error)
|
|
39544
39637
|
return paramsCheck;
|
|
39545
|
-
const {
|
|
39638
|
+
const { eventUpdates, event } = params;
|
|
39546
39639
|
const stack = 'modifyEvent';
|
|
39640
|
+
const enteredParticipants = getEnteredParticipants(params);
|
|
39641
|
+
const participantsProfile = getParticipantsProfile({ enteredParticipants });
|
|
39642
|
+
const { enteredParticipantGenders, enteredParticipantTypes } = participantsProfile;
|
|
39643
|
+
const genderResult = checkGenderUpdates({ enteredParticipantGenders, eventUpdates, stack });
|
|
39644
|
+
if (genderResult.error)
|
|
39645
|
+
return genderResult;
|
|
39646
|
+
const eventTypeResult = checkEventType({ enteredParticipantTypes, eventUpdates, stack });
|
|
39647
|
+
if (eventTypeResult.error)
|
|
39648
|
+
return eventTypeResult;
|
|
39649
|
+
const categoryResult = checkCategoryUpdates({ ...params, ...participantsProfile, enteredParticipants, stack });
|
|
39650
|
+
if (categoryResult.error)
|
|
39651
|
+
return categoryResult;
|
|
39652
|
+
const dateResult = dateUpdates({ ...params, stack });
|
|
39653
|
+
if (dateResult.error)
|
|
39654
|
+
return dateResult;
|
|
39655
|
+
if (eventUpdates.eventType)
|
|
39656
|
+
event.eventType = eventUpdates.eventType;
|
|
39657
|
+
if (eventUpdates.eventName)
|
|
39658
|
+
event.eventName = eventUpdates.eventName;
|
|
39659
|
+
if (eventUpdates.gender)
|
|
39660
|
+
event.gender = eventUpdates.gender;
|
|
39661
|
+
return { ...SUCCESS };
|
|
39662
|
+
}
|
|
39663
|
+
function checkCategoryUpdates(params) {
|
|
39664
|
+
const category = params.eventUpdates?.category;
|
|
39665
|
+
if (!category)
|
|
39666
|
+
return { ...SUCCESS };
|
|
39667
|
+
const categoryCheck = validateCategory({ category });
|
|
39668
|
+
if (categoryCheck.error)
|
|
39669
|
+
return categoryCheck;
|
|
39670
|
+
if (params.event.eventType === TEAM$2) {
|
|
39671
|
+
const drawTieFormats = params.event?.drawDefinitions?.map((draw) => getObjectTieFormat(draw)) ?? [];
|
|
39672
|
+
const eventTieFormat = getObjectTieFormat(params.event);
|
|
39673
|
+
const eventMatchUps = allEventMatchUps(params)?.matchUps ?? [];
|
|
39674
|
+
const matchUpTieFormats = eventMatchUps.map((matchUp) => getObjectTieFormat(matchUp)) ?? [];
|
|
39675
|
+
const tieFormats = [eventTieFormat, ...drawTieFormats, ...matchUpTieFormats].filter(Boolean);
|
|
39676
|
+
const validCategory = tieFormats.every((tieFormat) => tieFormat.collectionDefinitions.every((cd) => !cd.category || categoryCanContain({ category: params.eventUpdates.category, childCategory: cd.category })));
|
|
39677
|
+
if (!validCategory)
|
|
39678
|
+
return decorateResult({ result: { error: INVALID_CATEGORY }, stack: params.stack });
|
|
39679
|
+
}
|
|
39680
|
+
if (params.enteredParticipants?.length) {
|
|
39681
|
+
const startDate = params.eventUpdates.startDate || params.event.startDate || params.tournamentRecord.startDate;
|
|
39682
|
+
const endDate = params.eventUpdates.endDate || params.event.endDate || params.tournamentRecord.endDate;
|
|
39683
|
+
const individualParticpants = params.enteredParticipants
|
|
39684
|
+
.map((p) => (p.participantType === INDIVIDUAL ? p : p.individualParticpants ?? []))
|
|
39685
|
+
.flat();
|
|
39686
|
+
const startAgeDetails = getCategoryAgeDetails({ category, consideredDate: startDate });
|
|
39687
|
+
const endAgeDetails = getCategoryAgeDetails({ category, consideredDate: endDate });
|
|
39688
|
+
if (startAgeDetails?.ageMinDate ||
|
|
39689
|
+
startAgeDetails?.ageMaxDate ||
|
|
39690
|
+
endAgeDetails?.ageMinDate ||
|
|
39691
|
+
endAgeDetails?.ageMaxDate) {
|
|
39692
|
+
for (const individualParticipant of individualParticpants) {
|
|
39693
|
+
const birthDate = individualParticipant.person?.birthDate;
|
|
39694
|
+
if (!birthDate)
|
|
39695
|
+
return decorateResult({ result: { error: MISSING_BIRTH_DATE }, stack: params.stack });
|
|
39696
|
+
const birthTime = new Date(birthDate).getTime();
|
|
39697
|
+
if (startAgeDetails.ageMinDate || startAgeDetails.ageMaxDate) {
|
|
39698
|
+
const minTime = new Date(startAgeDetails.ageMinDate).getTime();
|
|
39699
|
+
const maxTime = new Date(startAgeDetails.ageMaxDate).getTime();
|
|
39700
|
+
if (birthTime < minTime || birthTime > maxTime) {
|
|
39701
|
+
return decorateResult({ result: { error: CATEGORY_MISMATCH }, stack: params.stack });
|
|
39702
|
+
}
|
|
39703
|
+
}
|
|
39704
|
+
if (endAgeDetails.ageMin || endAgeDetails.ageMax) {
|
|
39705
|
+
const minTime = new Date(endAgeDetails.ageMinDate).getTime();
|
|
39706
|
+
const maxTime = new Date(endAgeDetails.ageMaxDate).getTime();
|
|
39707
|
+
if (birthTime < minTime || birthTime > maxTime) {
|
|
39708
|
+
return decorateResult({ result: { error: CATEGORY_MISMATCH }, stack: params.stack });
|
|
39709
|
+
}
|
|
39710
|
+
}
|
|
39711
|
+
}
|
|
39712
|
+
}
|
|
39713
|
+
}
|
|
39714
|
+
return { ...SUCCESS };
|
|
39715
|
+
}
|
|
39716
|
+
function dateUpdates(params) {
|
|
39717
|
+
const { tournamentRecord, eventUpdates, event, stack } = params;
|
|
39547
39718
|
if (eventUpdates.startDate || eventUpdates.endDate) {
|
|
39548
39719
|
const result = setEventDates({
|
|
39549
39720
|
startDate: eventUpdates.startDate,
|
|
@@ -39554,19 +39725,25 @@ function modifyEvent(params) {
|
|
|
39554
39725
|
if (result.error)
|
|
39555
39726
|
return decorateResult({ result, stack });
|
|
39556
39727
|
}
|
|
39728
|
+
return { ...SUCCESS };
|
|
39729
|
+
}
|
|
39730
|
+
function getEnteredParticipants(params) {
|
|
39731
|
+
const { tournamentRecord, event } = params;
|
|
39557
39732
|
const enteredParticipantIds = event?.entries
|
|
39558
39733
|
?.filter(({ entryStatus }) => {
|
|
39559
39734
|
const status = entryStatus;
|
|
39560
39735
|
return [...STRUCTURE_SELECTED_STATUSES, ALTERNATE].includes(status);
|
|
39561
39736
|
})
|
|
39562
39737
|
.map(({ participantId }) => participantId) ?? [];
|
|
39563
|
-
|
|
39738
|
+
return enteredParticipantIds
|
|
39564
39739
|
? getParticipants({
|
|
39565
39740
|
participantFilters: { participantIds: enteredParticipantIds },
|
|
39566
39741
|
withIndividualParticipants: true,
|
|
39567
39742
|
tournamentRecord,
|
|
39568
39743
|
}).participants ?? []
|
|
39569
39744
|
: [];
|
|
39745
|
+
}
|
|
39746
|
+
function getParticipantsProfile({ enteredParticipants }) {
|
|
39570
39747
|
const genderAccumulator = [];
|
|
39571
39748
|
const enteredParticipantTypes = enteredParticipants.reduce((types, participant) => {
|
|
39572
39749
|
const genders = participant.person?.sex
|
|
@@ -39576,32 +39753,32 @@ function modifyEvent(params) {
|
|
|
39576
39753
|
return !types.includes(participant.participantType) ? types.concat(participant.participantType) : types;
|
|
39577
39754
|
}, []);
|
|
39578
39755
|
const enteredParticipantGenders = unique(genderAccumulator);
|
|
39756
|
+
return { enteredParticipantTypes, enteredParticipantGenders };
|
|
39757
|
+
}
|
|
39758
|
+
function checkGenderUpdates({ enteredParticipantGenders, eventUpdates, stack }) {
|
|
39579
39759
|
const validGender = !enteredParticipantGenders.length ||
|
|
39580
39760
|
[MIXED, ANY].includes(eventUpdates.gender ?? '') ||
|
|
39581
39761
|
(enteredParticipantGenders.length === 1 && enteredParticipantGenders[0] === eventUpdates.gender);
|
|
39582
|
-
|
|
39583
|
-
|
|
39762
|
+
return eventUpdates.gender && !validGender
|
|
39763
|
+
? decorateResult({
|
|
39584
39764
|
context: { gender: eventUpdates.gender, validGender },
|
|
39585
|
-
result: { error:
|
|
39765
|
+
result: { error: INVALID_GENDER },
|
|
39586
39766
|
stack,
|
|
39587
|
-
})
|
|
39767
|
+
})
|
|
39768
|
+
: { ...SUCCESS };
|
|
39769
|
+
}
|
|
39770
|
+
function checkEventType({ enteredParticipantTypes, eventUpdates, stack }) {
|
|
39588
39771
|
const validEventTypes = (enteredParticipantTypes.includes(TEAM$2) && [TEAM$2]) ||
|
|
39589
39772
|
(enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES$1]) ||
|
|
39590
39773
|
(enteredParticipantTypes.includes(PAIR) && [DOUBLES$1]) || [DOUBLES$1, SINGLES$1, TEAM$2];
|
|
39591
39774
|
const validEventType = validEventTypes.includes(eventUpdates.eventType ?? '');
|
|
39592
|
-
|
|
39593
|
-
|
|
39775
|
+
return eventUpdates.eventType && !validEventType
|
|
39776
|
+
? decorateResult({
|
|
39594
39777
|
context: { participantType: eventUpdates.eventType, validEventType },
|
|
39595
|
-
result: { error:
|
|
39778
|
+
result: { error: INVALID_EVENT_TYPE },
|
|
39596
39779
|
stack,
|
|
39597
|
-
})
|
|
39598
|
-
|
|
39599
|
-
event.eventType = eventUpdates.eventType;
|
|
39600
|
-
if (eventUpdates.eventName)
|
|
39601
|
-
event.eventName = eventUpdates.eventName;
|
|
39602
|
-
if (eventUpdates.gender)
|
|
39603
|
-
event.gender = eventUpdates.gender;
|
|
39604
|
-
return { ...SUCCESS };
|
|
39780
|
+
})
|
|
39781
|
+
: { ...SUCCESS };
|
|
39605
39782
|
}
|
|
39606
39783
|
|
|
39607
39784
|
function addFlight({ qualifyingPositions, drawEntries = [], drawName, drawId, event, stage, }) {
|
|
@@ -45990,7 +46167,16 @@ function auditAutoScheduling({ autoSchedulingAudit, tournamentRecords }) {
|
|
|
45990
46167
|
itemValue,
|
|
45991
46168
|
};
|
|
45992
46169
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
45993
|
-
|
|
46170
|
+
const tournamentId = tournamentRecord.tournamentId;
|
|
46171
|
+
if (hasTopic(AUDIT)) {
|
|
46172
|
+
addNotice({
|
|
46173
|
+
payload: { type: AUTO_SCHEDULING_AUDIT, tournamentId, detail: itemValue },
|
|
46174
|
+
topic: AUDIT,
|
|
46175
|
+
});
|
|
46176
|
+
}
|
|
46177
|
+
else {
|
|
46178
|
+
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
46179
|
+
}
|
|
45994
46180
|
}
|
|
45995
46181
|
}
|
|
45996
46182
|
|
|
@@ -51796,39 +51982,58 @@ function unPublishEventSeeding({ removePriorValues = true, seedingScaleNames, to
|
|
|
51796
51982
|
return { ...SUCCESS };
|
|
51797
51983
|
}
|
|
51798
51984
|
|
|
51799
|
-
function
|
|
51800
|
-
const tournamentRecords = params
|
|
51801
|
-
(params?.tournamentRecord && {
|
|
51802
|
-
[params.tournamentRecord.tournamentId]: params.tournamentRecord,
|
|
51803
|
-
}) ??
|
|
51804
|
-
{};
|
|
51985
|
+
function unPublishParticipants(params) {
|
|
51986
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
51805
51987
|
if (!Object.keys(tournamentRecords).length)
|
|
51806
51988
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
51807
51989
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
51808
|
-
const result =
|
|
51809
|
-
tournamentRecord,
|
|
51810
|
-
...params,
|
|
51811
|
-
});
|
|
51990
|
+
const result = unpublish({ tournamentRecord, ...params });
|
|
51812
51991
|
if (result.error)
|
|
51813
51992
|
return result;
|
|
51814
51993
|
}
|
|
51815
51994
|
return { ...SUCCESS };
|
|
51816
51995
|
}
|
|
51817
|
-
function
|
|
51996
|
+
function unpublish({ removePriorValues = true, tournamentRecord, status = PUBLIC }) {
|
|
51818
51997
|
if (!tournamentRecord)
|
|
51819
51998
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
51820
51999
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
51821
|
-
const { timeItem } = getTimeItem({
|
|
52000
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
52001
|
+
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
52002
|
+
if (itemValue[status])
|
|
52003
|
+
delete itemValue[status].participants;
|
|
52004
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
52005
|
+
addTimeItem({
|
|
52006
|
+
timeItem: updatedTimeItem,
|
|
51822
52007
|
element: tournamentRecord,
|
|
51823
|
-
|
|
52008
|
+
removePriorValues,
|
|
52009
|
+
});
|
|
52010
|
+
addNotice({
|
|
52011
|
+
payload: { tournamentId: tournamentRecord.tournamentId },
|
|
52012
|
+
topic: UNPUBLISH_PARTICIPANTS,
|
|
51824
52013
|
});
|
|
52014
|
+
return { ...SUCCESS };
|
|
52015
|
+
}
|
|
52016
|
+
|
|
52017
|
+
function unPublishOrderOfPlay(params) {
|
|
52018
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
52019
|
+
if (!Object.keys(tournamentRecords).length)
|
|
52020
|
+
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
52021
|
+
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
52022
|
+
const result = unPublishOOP({ tournamentRecord, ...params });
|
|
52023
|
+
if (result.error)
|
|
52024
|
+
return result;
|
|
52025
|
+
}
|
|
52026
|
+
return { ...SUCCESS };
|
|
52027
|
+
}
|
|
52028
|
+
function unPublishOOP({ removePriorValues = true, tournamentRecord, status = PUBLIC }) {
|
|
52029
|
+
if (!tournamentRecord)
|
|
52030
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
52031
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
52032
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51825
52033
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51826
52034
|
if (itemValue[status])
|
|
51827
52035
|
delete itemValue[status].orderOfPlay;
|
|
51828
|
-
const updatedTimeItem = {
|
|
51829
|
-
itemValue,
|
|
51830
|
-
itemType,
|
|
51831
|
-
};
|
|
52036
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51832
52037
|
addTimeItem({
|
|
51833
52038
|
timeItem: updatedTimeItem,
|
|
51834
52039
|
element: tournamentRecord,
|
|
@@ -51843,34 +52048,56 @@ function unPublishOOP({ removePriorValues = true, tournamentRecord, status = PUB
|
|
|
51843
52048
|
return { ...SUCCESS };
|
|
51844
52049
|
}
|
|
51845
52050
|
|
|
51846
|
-
function
|
|
52051
|
+
function publishParticipants(params) {
|
|
51847
52052
|
const tournamentRecords = resolveTournamentRecords(params);
|
|
51848
52053
|
if (!Object.keys(tournamentRecords).length)
|
|
51849
52054
|
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
51850
52055
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
51851
|
-
const result =
|
|
51852
|
-
tournamentRecord,
|
|
51853
|
-
...params,
|
|
51854
|
-
});
|
|
52056
|
+
const result = publish({ tournamentRecord, ...params });
|
|
51855
52057
|
if (result.error)
|
|
51856
52058
|
return result;
|
|
51857
52059
|
}
|
|
51858
52060
|
return { ...SUCCESS };
|
|
51859
52061
|
}
|
|
51860
|
-
function
|
|
52062
|
+
function publish({ removePriorValues, tournamentRecord, status = PUBLIC }) {
|
|
51861
52063
|
if (!tournamentRecord)
|
|
51862
52064
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
51863
52065
|
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
51864
|
-
const { timeItem } = getTimeItem({
|
|
52066
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
52067
|
+
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
52068
|
+
itemValue[status].participants = { published: true };
|
|
52069
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
52070
|
+
addTimeItem({
|
|
52071
|
+
timeItem: updatedTimeItem,
|
|
51865
52072
|
element: tournamentRecord,
|
|
51866
|
-
|
|
52073
|
+
removePriorValues,
|
|
51867
52074
|
});
|
|
52075
|
+
addNotice({
|
|
52076
|
+
payload: { tournamentId: tournamentRecord.tournamentId },
|
|
52077
|
+
topic: PUBLISH_PARTICIPANTS,
|
|
52078
|
+
});
|
|
52079
|
+
return { ...SUCCESS };
|
|
52080
|
+
}
|
|
52081
|
+
|
|
52082
|
+
function publishOrderOfPlay(params) {
|
|
52083
|
+
const tournamentRecords = resolveTournamentRecords(params);
|
|
52084
|
+
if (!Object.keys(tournamentRecords).length)
|
|
52085
|
+
return { error: MISSING_TOURNAMENT_RECORDS };
|
|
52086
|
+
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
52087
|
+
const result = publishOOP({ tournamentRecord, ...params });
|
|
52088
|
+
if (result.error)
|
|
52089
|
+
return result;
|
|
52090
|
+
}
|
|
52091
|
+
return { ...SUCCESS };
|
|
52092
|
+
}
|
|
52093
|
+
function publishOOP({ scheduledDates = [], removePriorValues, tournamentRecord, status = PUBLIC, eventIds = [] }) {
|
|
52094
|
+
if (!tournamentRecord)
|
|
52095
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
52096
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
52097
|
+
const { timeItem } = getTimeItem({ element: tournamentRecord, itemType });
|
|
51868
52098
|
const itemValue = timeItem?.itemValue || { [status]: {} };
|
|
51869
52099
|
itemValue[status].orderOfPlay = { published: true, scheduledDates, eventIds };
|
|
51870
|
-
const updatedTimeItem = {
|
|
51871
|
-
itemValue,
|
|
51872
|
-
itemType,
|
|
51873
|
-
};
|
|
52100
|
+
const updatedTimeItem = { itemValue, itemType };
|
|
51874
52101
|
addTimeItem({
|
|
51875
52102
|
timeItem: updatedTimeItem,
|
|
51876
52103
|
element: tournamentRecord,
|
|
@@ -51928,10 +52155,12 @@ var mutate$4 = {
|
|
|
51928
52155
|
publishEvent: publishEvent,
|
|
51929
52156
|
publishEventSeeding: publishEventSeeding,
|
|
51930
52157
|
publishOrderOfPlay: publishOrderOfPlay,
|
|
52158
|
+
publishParticipants: publishParticipants,
|
|
51931
52159
|
setEventDisplay: setEventDisplay,
|
|
51932
52160
|
unPublishEvent: unPublishEvent,
|
|
51933
52161
|
unPublishEventSeeding: unPublishEventSeeding,
|
|
51934
|
-
unPublishOrderOfPlay: unPublishOrderOfPlay
|
|
52162
|
+
unPublishOrderOfPlay: unPublishOrderOfPlay,
|
|
52163
|
+
unPublishParticipants: unPublishParticipants
|
|
51935
52164
|
};
|
|
51936
52165
|
|
|
51937
52166
|
var index$7 = {
|
|
@@ -51943,16 +52172,19 @@ var index$7 = {
|
|
|
51943
52172
|
getEventData: getEventData,
|
|
51944
52173
|
getEventPublishStatus: getEventPublishStatus,
|
|
51945
52174
|
getPublishState: getPublishState,
|
|
52175
|
+
getTournamentPublishStatus: getTournamentPublishStatus,
|
|
51946
52176
|
getVenueData: getVenueData,
|
|
51947
52177
|
mutate: mutate$4,
|
|
51948
52178
|
publishEvent: publishEvent,
|
|
51949
52179
|
publishEventSeeding: publishEventSeeding,
|
|
51950
52180
|
publishOrderOfPlay: publishOrderOfPlay,
|
|
52181
|
+
publishParticipants: publishParticipants,
|
|
51951
52182
|
query: query$5,
|
|
51952
52183
|
setEventDisplay: setEventDisplay,
|
|
51953
52184
|
unPublishEvent: unPublishEvent,
|
|
51954
52185
|
unPublishEventSeeding: unPublishEventSeeding,
|
|
51955
|
-
unPublishOrderOfPlay: unPublishOrderOfPlay
|
|
52186
|
+
unPublishOrderOfPlay: unPublishOrderOfPlay,
|
|
52187
|
+
unPublishParticipants: unPublishParticipants
|
|
51956
52188
|
};
|
|
51957
52189
|
|
|
51958
52190
|
function getParticipantStats({ withCompetitiveProfiles, opponentParticipantId, withIndividualStats, teamParticipantId, tournamentRecord, withScaleValues, tallyPolicy, matchUps, }) {
|
|
@@ -52486,16 +52718,18 @@ function getStructureReports({ firstFlightOnly = true, extensionProfiles, tourna
|
|
|
52486
52718
|
[flight.drawId]: flight.flightNumber,
|
|
52487
52719
|
}));
|
|
52488
52720
|
const flightMap = flightNumbers && Object.assign({}, ...flightNumbers);
|
|
52489
|
-
const
|
|
52721
|
+
const drawDeletionsExtension = extensions?.find((x) => x.name === DRAW_DELETIONS);
|
|
52722
|
+
const drawDeletionsTimeItem = eventTimeItems?.find((x) => x.itemType === DRAW_DELETIONS);
|
|
52723
|
+
const drawDeletionsCount = drawDeletionsExtension?.value?.length || drawDeletionsTimeItem?.itemValue || 0;
|
|
52490
52724
|
const mapValues = Object.values(flightMap);
|
|
52491
52725
|
const minFlightNumber = flightMap && Math.min(...mapValues);
|
|
52492
52726
|
const eventSeedingBasis = getSeedingBasis(eventTimeItems);
|
|
52493
52727
|
eventStructureReports[eventId] = {
|
|
52728
|
+
seedingBasis: eventSeedingBasis ? JSON.stringify(eventSeedingBasis) : undefined,
|
|
52494
52729
|
totalPositionManipulations: 0,
|
|
52495
52730
|
maxPositionManipulations: 0,
|
|
52496
52731
|
generatedDrawsCount: 0,
|
|
52497
52732
|
drawDeletionsCount,
|
|
52498
|
-
seedingBasis: eventSeedingBasis ? JSON.stringify(eventSeedingBasis) : undefined,
|
|
52499
52733
|
tournamentId,
|
|
52500
52734
|
eventId,
|
|
52501
52735
|
};
|
|
@@ -53805,16 +54039,13 @@ var mutate$3 = {
|
|
|
53805
54039
|
calculateScheduleTimes: calculateScheduleTimes,
|
|
53806
54040
|
clearMatchUpSchedule: clearMatchUpSchedule,
|
|
53807
54041
|
clearScheduledMatchUps: clearScheduledMatchUps,
|
|
53808
|
-
courtGridRows: courtGridRows,
|
|
53809
54042
|
findMatchUpFormatTiming: findMatchUpFormatTiming,
|
|
53810
|
-
findVenue: findVenue,
|
|
53811
54043
|
generateBookings: generateBookings,
|
|
53812
54044
|
generateVirtualCourts: generateVirtualCourts,
|
|
53813
54045
|
matchUpScheduleChange: matchUpScheduleChange,
|
|
53814
54046
|
modifyMatchUpFormatTiming: modifyMatchUpFormatTiming,
|
|
53815
54047
|
proAutoSchedule: proAutoSchedule,
|
|
53816
54048
|
proConflicts: proConflicts,
|
|
53817
|
-
publicFindCourt: publicFindCourt,
|
|
53818
54049
|
removeEventMatchUpFormatTiming: removeEventMatchUpFormatTiming,
|
|
53819
54050
|
removeMatchUpCourtAssignment: removeMatchUpCourtAssignment,
|
|
53820
54051
|
reorderUpcomingMatchUps: reorderUpcomingMatchUps,
|
|
@@ -55795,19 +56026,39 @@ function updateCourtAvailability({ tournamentRecord }) {
|
|
|
55795
56026
|
}
|
|
55796
56027
|
|
|
55797
56028
|
function setTournamentDates(params) {
|
|
55798
|
-
const { tournamentRecord, startDate, endDate } = params;
|
|
56029
|
+
const { tournamentRecord, startDate, endDate, activeDates, weekdays } = params;
|
|
55799
56030
|
const paramsCheck = checkRequiredParameters(params, [
|
|
55800
56031
|
{ tournamentRecord: true },
|
|
55801
56032
|
{
|
|
55802
56033
|
[VALIDATE]: (value) => dateValidation.test(value),
|
|
55803
|
-
[ANY_OF]: { startDate: false, endDate: false },
|
|
55804
56034
|
[INVALID]: INVALID_DATE,
|
|
56035
|
+
startDate: false,
|
|
56036
|
+
endDate: false,
|
|
56037
|
+
},
|
|
56038
|
+
{
|
|
56039
|
+
[VALIDATE]: (value) => value.every((d) => dateValidation.test(d)),
|
|
56040
|
+
[INVALID]: INVALID_DATE,
|
|
56041
|
+
activeDates: false,
|
|
56042
|
+
},
|
|
56043
|
+
{
|
|
56044
|
+
[VALIDATE]: isValidWeekdaysValue,
|
|
56045
|
+
weekdays: false,
|
|
55805
56046
|
},
|
|
55806
56047
|
]);
|
|
55807
56048
|
if (paramsCheck.error)
|
|
55808
56049
|
return paramsCheck;
|
|
55809
56050
|
if (endDate && startDate && new Date(endDate) < new Date(startDate))
|
|
55810
56051
|
return { error: INVALID_VALUES };
|
|
56052
|
+
if (endDate && startDate && new Date(startDate) > new Date(endDate))
|
|
56053
|
+
return { error: INVALID_VALUES };
|
|
56054
|
+
if (activeDates) {
|
|
56055
|
+
const start = startDate || tournamentRecord.startDate;
|
|
56056
|
+
const end = endDate || tournamentRecord.endDate;
|
|
56057
|
+
const validStart = !start || activeDates.every((d) => new Date(d) >= new Date(start));
|
|
56058
|
+
const validEnd = !end || activeDates.every((d) => new Date(d) <= new Date(end));
|
|
56059
|
+
if (!validStart || !validEnd)
|
|
56060
|
+
return { error: INVALID_DATE };
|
|
56061
|
+
}
|
|
55811
56062
|
let checkScheduling;
|
|
55812
56063
|
if ((startDate && tournamentRecord.startDate && new Date(startDate) > new Date(tournamentRecord.startDate)) ||
|
|
55813
56064
|
(endDate && tournamentRecord.endDate && new Date(endDate) < new Date(tournamentRecord.endDate))) {
|
|
@@ -55837,23 +56088,33 @@ function setTournamentDates(params) {
|
|
|
55837
56088
|
if (endDate && tournamentRecord.startDate && new Date(endDate) < new Date(tournamentRecord.startDate)) {
|
|
55838
56089
|
tournamentRecord.startDate = endDate;
|
|
55839
56090
|
}
|
|
56091
|
+
if (activeDates)
|
|
56092
|
+
tournamentRecord.activeDates = activeDates;
|
|
56093
|
+
if (weekdays)
|
|
56094
|
+
tournamentRecord.weekdays = weekdays;
|
|
55840
56095
|
const unscheduledMatchUpIds = checkScheduling && removeInvalidScheduling({ tournamentRecord })?.unscheduledMatchUpIds;
|
|
55841
56096
|
updateCourtAvailability({ tournamentRecord });
|
|
55842
56097
|
addNotice({
|
|
55843
|
-
payload: {
|
|
56098
|
+
payload: definedAttributes({
|
|
55844
56099
|
parentOrganisation: tournamentRecord.parentOrganisation,
|
|
55845
56100
|
tournamentId: tournamentRecord.tournamentId,
|
|
56101
|
+
activeDates,
|
|
55846
56102
|
startDate,
|
|
56103
|
+
weekdays,
|
|
55847
56104
|
endDate,
|
|
55848
|
-
},
|
|
56105
|
+
}),
|
|
55849
56106
|
topic: MODIFY_TOURNAMENT_DETAIL,
|
|
55850
56107
|
});
|
|
55851
56108
|
return { ...SUCCESS, unscheduledMatchUpIds, datesAdded, datesRemoved };
|
|
55852
56109
|
}
|
|
55853
56110
|
function setTournamentStartDate({ tournamentRecord, startDate }) {
|
|
56111
|
+
if (!startDate)
|
|
56112
|
+
return { error: INVALID_DATE };
|
|
55854
56113
|
return setTournamentDates({ tournamentRecord, startDate });
|
|
55855
56114
|
}
|
|
55856
56115
|
function setTournamentEndDate({ tournamentRecord, endDate }) {
|
|
56116
|
+
if (!endDate)
|
|
56117
|
+
return { error: INVALID_DATE };
|
|
55857
56118
|
return setTournamentDates({ tournamentRecord, endDate });
|
|
55858
56119
|
}
|
|
55859
56120
|
function removeInvalidScheduling({ tournamentRecord }) {
|
|
@@ -58643,7 +58904,8 @@ var index = {
|
|
|
58643
58904
|
tournamentConstants: tournamentConstants,
|
|
58644
58905
|
upcomingMatchUpStatuses: upcomingMatchUpStatuses,
|
|
58645
58906
|
validMatchUpStatuses: validMatchUpStatuses,
|
|
58646
|
-
venueConstants: venueConstants
|
|
58907
|
+
venueConstants: venueConstants,
|
|
58908
|
+
weekdayConstants: weekdayConstants
|
|
58647
58909
|
};
|
|
58648
58910
|
|
|
58649
58911
|
exports.activeMatchUpStatuses = activeMatchUpStatuses;
|
|
@@ -58721,4 +58983,5 @@ exports.validMatchUpStatuses = validMatchUpStatuses;
|
|
|
58721
58983
|
exports.venueConstants = venueConstants;
|
|
58722
58984
|
exports.venueGovernor = index$2;
|
|
58723
58985
|
exports.version = factoryVersion;
|
|
58986
|
+
exports.weekdayConstants = weekdayConstants;
|
|
58724
58987
|
//# sourceMappingURL=tods-competition-factory.development.cjs.js.map
|