tods-competition-factory 2.1.0 → 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 +110 -101
- package/dist/tods-competition-factory.development.cjs.js +494 -385
- 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.1.
|
|
6
|
+
return '2.1.1';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -1095,7 +1095,12 @@ function setSubscriptions$1(params) {
|
|
|
1095
1095
|
if (typeof params.subscriptions !== 'object')
|
|
1096
1096
|
return { error: INVALID_VALUES };
|
|
1097
1097
|
Object.keys(params.subscriptions).forEach((subscription) => {
|
|
1098
|
-
|
|
1098
|
+
if (typeof params.subscriptions[subscription] === 'function') {
|
|
1099
|
+
syncGlobalState.subscriptions[subscription] = params.subscriptions[subscription];
|
|
1100
|
+
}
|
|
1101
|
+
else {
|
|
1102
|
+
delete syncGlobalState.subscriptions[subscription];
|
|
1103
|
+
}
|
|
1099
1104
|
});
|
|
1100
1105
|
return { ...SUCCESS };
|
|
1101
1106
|
}
|
|
@@ -1640,6 +1645,9 @@ function deleteNotices() {
|
|
|
1640
1645
|
function getTopics() {
|
|
1641
1646
|
return _globalStateProvider.getTopics();
|
|
1642
1647
|
}
|
|
1648
|
+
function hasTopic(topic) {
|
|
1649
|
+
return getTopics()?.topics?.includes(topic);
|
|
1650
|
+
}
|
|
1643
1651
|
async function callListener(payload) {
|
|
1644
1652
|
return _globalStateProvider.callListener(payload, globalState.globalSubscriptions);
|
|
1645
1653
|
}
|
|
@@ -1737,6 +1745,7 @@ var globalState$1 = {
|
|
|
1737
1745
|
getTournamentRecords: getTournamentRecords,
|
|
1738
1746
|
globalLog: globalLog$1,
|
|
1739
1747
|
handleCaughtError: handleCaughtError,
|
|
1748
|
+
hasTopic: hasTopic,
|
|
1740
1749
|
removeTournamentRecord: removeTournamentRecord,
|
|
1741
1750
|
setDeepCopy: setDeepCopy,
|
|
1742
1751
|
setDevContext: setDevContext,
|
|
@@ -1823,6 +1832,184 @@ const eventConstants = {
|
|
|
1823
1832
|
TEAM: TEAM$2,
|
|
1824
1833
|
};
|
|
1825
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
|
+
|
|
1826
2013
|
const TOURNAMENT_RECORDS = 'tournamentRecords';
|
|
1827
2014
|
const POLICY_DEFINITIONS = 'policyDefinitions';
|
|
1828
2015
|
const TOURNAMENT_RECORD = 'tournamentRecord';
|
|
@@ -1837,6 +2024,7 @@ const ROUND_NUMBER = 'roundNumber';
|
|
|
1837
2024
|
const STRUCTURE_ID = 'structureId';
|
|
1838
2025
|
const PARTICIPANT = 'participant';
|
|
1839
2026
|
const MATCHUP_IDS = 'matchUpIds';
|
|
2027
|
+
const ENTRY_STAGE = 'entryStage';
|
|
1840
2028
|
const POLICY_TYPE = 'policyType';
|
|
1841
2029
|
const STRUCTURES = 'structures';
|
|
1842
2030
|
const MATCHUP_ID = 'matchUpId';
|
|
@@ -1871,6 +2059,7 @@ const ONE_OF = '_oneOf';
|
|
|
1871
2059
|
const validators = {
|
|
1872
2060
|
[EVENT_TYPE]: (value) => [SINGLES$1, DOUBLES$1, TEAM$2].includes(value),
|
|
1873
2061
|
[ONLINE_RESOURCE]: (value) => intersection(Object.keys(value), [RESOURCE_SUB_TYPE, RESOURCE_TYPE, IDENTIFIER]).length === 3,
|
|
2062
|
+
[ENTRY_STAGE]: (value) => validStages.includes(value),
|
|
1874
2063
|
};
|
|
1875
2064
|
const errors = {
|
|
1876
2065
|
[TOURNAMENT_RECORDS]: MISSING_TOURNAMENT_RECORDS,
|
|
@@ -2481,6 +2670,7 @@ const POLICY_TYPE_PARTICIPANT = 'participant';
|
|
|
2481
2670
|
const POLICY_TYPE_PROGRESSION = 'progression';
|
|
2482
2671
|
const POLICY_TYPE_SCHEDULING = 'scheduling';
|
|
2483
2672
|
const POLICY_TYPE_AVOIDANCE = 'avoidance';
|
|
2673
|
+
const POLICY_TYPE_PRIVACY = 'participant';
|
|
2484
2674
|
const POLICY_TYPE_DISPLAY = 'display';
|
|
2485
2675
|
const POLICY_TYPE_SCORING = 'scoring';
|
|
2486
2676
|
const POLICY_TYPE_SEEDING = 'seeding';
|
|
@@ -2500,6 +2690,7 @@ const policyConstants = {
|
|
|
2500
2690
|
POLICY_TYPE_SCHEDULING,
|
|
2501
2691
|
POLICY_TYPE_AVOIDANCE,
|
|
2502
2692
|
POLICY_TYPE_DISPLAY,
|
|
2693
|
+
POLICY_TYPE_PRIVACY,
|
|
2503
2694
|
POLICY_TYPE_FEED_IN,
|
|
2504
2695
|
POLICY_TYPE_SCORING,
|
|
2505
2696
|
POLICY_TYPE_SEEDING,
|
|
@@ -3071,184 +3262,6 @@ const matchUpStatusConstants = {
|
|
|
3071
3262
|
WALKOVER: WALKOVER$2,
|
|
3072
3263
|
};
|
|
3073
3264
|
|
|
3074
|
-
const MAIN = 'MAIN';
|
|
3075
|
-
const QUALIFYING = 'QUALIFYING';
|
|
3076
|
-
const CONSOLATION = 'CONSOLATION';
|
|
3077
|
-
const VOLUNTARY_CONSOLATION = 'VOLUNTARY_CONSOLATION';
|
|
3078
|
-
const PLAY_OFF = 'PLAY_OFF';
|
|
3079
|
-
const validStages = [MAIN, QUALIFYING, CONSOLATION, PLAY_OFF, VOLUNTARY_CONSOLATION];
|
|
3080
|
-
const stageOrder$1 = {
|
|
3081
|
-
[QUALIFYING]: 1,
|
|
3082
|
-
[MAIN]: 2,
|
|
3083
|
-
[PLAY_OFF]: 3,
|
|
3084
|
-
[CONSOLATION]: 3,
|
|
3085
|
-
[VOLUNTARY_CONSOLATION]: 4,
|
|
3086
|
-
};
|
|
3087
|
-
const FINISHING_POSITIONS = 'finishingPositions';
|
|
3088
|
-
const AGGREGATE_EVENT_STRUCTURES = 'aggregateEventStructures';
|
|
3089
|
-
const finishOrder = {
|
|
3090
|
-
[MAIN]: 1,
|
|
3091
|
-
[PLAY_OFF]: 2,
|
|
3092
|
-
[CONSOLATION]: 3,
|
|
3093
|
-
[QUALIFYING]: 4,
|
|
3094
|
-
[VOLUNTARY_CONSOLATION]: 5,
|
|
3095
|
-
};
|
|
3096
|
-
const aggregateOrder = {
|
|
3097
|
-
[PLAY_OFF]: 1,
|
|
3098
|
-
[MAIN]: 2,
|
|
3099
|
-
[CONSOLATION]: 3,
|
|
3100
|
-
[QUALIFYING]: 4,
|
|
3101
|
-
[VOLUNTARY_CONSOLATION]: 5,
|
|
3102
|
-
};
|
|
3103
|
-
const CLUSTER = 'CLUSTER';
|
|
3104
|
-
const SEPARATE = 'SEPARATE';
|
|
3105
|
-
const WATERFALL = 'WATERFALL';
|
|
3106
|
-
const ITEM = 'ITEM';
|
|
3107
|
-
const CONTAINER = 'CONTAINER';
|
|
3108
|
-
const DRAW = 'DRAW';
|
|
3109
|
-
const RANDOM = 'RANDOM';
|
|
3110
|
-
const TOP_DOWN = 'TOP_DOWN';
|
|
3111
|
-
const BOTTOM_UP = 'BOTTOM_UP';
|
|
3112
|
-
const POSITION = 'POSITION';
|
|
3113
|
-
const WINNER = 'WINNER';
|
|
3114
|
-
const LOSER = 'LOSER';
|
|
3115
|
-
const FIRST_MATCHUP = 'FIRST_MATCHUP';
|
|
3116
|
-
const AD_HOC = 'AD_HOC';
|
|
3117
|
-
const FLEX_ROUNDS = 'AD_HOC';
|
|
3118
|
-
const FEED_IN$1 = 'FEED_IN';
|
|
3119
|
-
const COMPASS = 'COMPASS';
|
|
3120
|
-
const OLYMPIC = 'OLYMPIC';
|
|
3121
|
-
const KNOCKOUT = 'SINGLE_ELIMINATION';
|
|
3122
|
-
const SINGLE_ELIMINATION = 'SINGLE_ELIMINATION';
|
|
3123
|
-
const DOUBLE_ELIMINATION = 'DOUBLE_ELIMINATION';
|
|
3124
|
-
const FIRST_MATCH_LOSER_CONSOLATION = 'FIRST_MATCH_LOSER_CONSOLATION';
|
|
3125
|
-
const FIRST_ROUND_LOSER_CONSOLATION = 'FIRST_ROUND_LOSER_CONSOLATION';
|
|
3126
|
-
const LUCKY_DRAW = 'LUCKY_DRAW';
|
|
3127
|
-
const CURTIS = 'CURTIS_CONSOLATION';
|
|
3128
|
-
const CURTIS_CONSOLATION = 'CURTIS_CONSOLATION';
|
|
3129
|
-
const FICSF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
3130
|
-
const FEED_IN_CHAMPIONSHIP_TO_SF = 'FEED_IN_CHAMPIONSHIP_TO_SF';
|
|
3131
|
-
const FICQF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
3132
|
-
const FEED_IN_CHAMPIONSHIP_TO_QF = 'FEED_IN_CHAMPIONSHIP_TO_QF';
|
|
3133
|
-
const FICR16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
3134
|
-
const FEED_IN_CHAMPIONSHIP_TO_R16 = 'FEED_IN_CHAMPIONSHIP_TO_R16';
|
|
3135
|
-
const MFIC = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3136
|
-
const MODIFIED_FEED_IN_CHAMPIONSHIP = 'MODIFIED_FEED_IN_CHAMPIONSHIP';
|
|
3137
|
-
const FEED_IN_CHAMPIONSHIP = 'FEED_IN_CHAMPIONSHIP';
|
|
3138
|
-
const DOUBLE_ROUND_ROBIN = 'DOUBLE_ROUND_ROBIN';
|
|
3139
|
-
const ROUND_ROBIN = 'ROUND_ROBIN';
|
|
3140
|
-
const ROUND_ROBIN_WITH_PLAYOFF = 'ROUND_ROBIN_WITH_PLAYOFF';
|
|
3141
|
-
const DECIDER = 'DECIDER';
|
|
3142
|
-
const BACKDRAW = 'BACKDRAW';
|
|
3143
|
-
const COMPASS_ATTRIBUTES = {
|
|
3144
|
-
0: { name: 'East', abbreviation: 'E' },
|
|
3145
|
-
'0-1': { name: 'West', abbreviation: 'W' },
|
|
3146
|
-
'0-2': { name: 'North', abbreviation: 'N' },
|
|
3147
|
-
'0-3': { name: 'Northeast', abbreviation: 'NE' },
|
|
3148
|
-
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
3149
|
-
'0-1-2': { name: 'Southwest', abbreviation: 'SW' },
|
|
3150
|
-
'0-2-1': { name: 'Northwest', abbreviation: 'NW' },
|
|
3151
|
-
'0-1-1-1': { name: 'Southeast', abbreviation: 'SE' },
|
|
3152
|
-
};
|
|
3153
|
-
const OLYMPIC_ATTRIBUTES = {
|
|
3154
|
-
0: { name: 'East', abbreviation: 'E' },
|
|
3155
|
-
'0-1': { name: 'West', abbreviation: 'W' },
|
|
3156
|
-
'0-2': { name: 'North', abbreviation: 'N' },
|
|
3157
|
-
'0-1-1': { name: 'South', abbreviation: 'S' },
|
|
3158
|
-
};
|
|
3159
|
-
const WIN_RATIO$1 = 'WIN_RATIO';
|
|
3160
|
-
const ROUND_OUTCOME = 'ROUND_OUTCOME';
|
|
3161
|
-
const MULTI_STRUCTURE_DRAWS = [
|
|
3162
|
-
COMPASS,
|
|
3163
|
-
CURTIS,
|
|
3164
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3165
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3166
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3167
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3168
|
-
FICQF,
|
|
3169
|
-
FICR16,
|
|
3170
|
-
FICSF,
|
|
3171
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3172
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3173
|
-
LUCKY_DRAW,
|
|
3174
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3175
|
-
OLYMPIC,
|
|
3176
|
-
PLAY_OFF,
|
|
3177
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3178
|
-
];
|
|
3179
|
-
const generatedDrawTypes = [
|
|
3180
|
-
AD_HOC,
|
|
3181
|
-
COMPASS,
|
|
3182
|
-
CURTIS,
|
|
3183
|
-
DOUBLE_ELIMINATION,
|
|
3184
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3185
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3186
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3187
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3188
|
-
FEED_IN$1,
|
|
3189
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3190
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3191
|
-
LUCKY_DRAW,
|
|
3192
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3193
|
-
OLYMPIC,
|
|
3194
|
-
PLAY_OFF,
|
|
3195
|
-
ROUND_ROBIN,
|
|
3196
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3197
|
-
SINGLE_ELIMINATION,
|
|
3198
|
-
];
|
|
3199
|
-
const drawDefinitionConstants = {
|
|
3200
|
-
MAIN,
|
|
3201
|
-
QUALIFYING,
|
|
3202
|
-
CONSOLATION,
|
|
3203
|
-
ITEM,
|
|
3204
|
-
CONTAINER,
|
|
3205
|
-
FIRST_MATCHUP,
|
|
3206
|
-
WINNER,
|
|
3207
|
-
LOSER,
|
|
3208
|
-
AD_HOC,
|
|
3209
|
-
FEED_IN: FEED_IN$1,
|
|
3210
|
-
FLEX_ROUNDS,
|
|
3211
|
-
COMPASS,
|
|
3212
|
-
PLAY_OFF,
|
|
3213
|
-
OLYMPIC,
|
|
3214
|
-
KNOCKOUT,
|
|
3215
|
-
SINGLE_ELIMINATION,
|
|
3216
|
-
DOUBLE_ELIMINATION,
|
|
3217
|
-
CURTIS,
|
|
3218
|
-
FICSF,
|
|
3219
|
-
FICQF,
|
|
3220
|
-
FICR16,
|
|
3221
|
-
MFIC,
|
|
3222
|
-
VOLUNTARY_CONSOLATION,
|
|
3223
|
-
FIRST_MATCH_LOSER_CONSOLATION,
|
|
3224
|
-
FIRST_ROUND_LOSER_CONSOLATION,
|
|
3225
|
-
MODIFIED_FEED_IN_CHAMPIONSHIP,
|
|
3226
|
-
FEED_IN_CHAMPIONSHIP_TO_R16,
|
|
3227
|
-
FEED_IN_CHAMPIONSHIP_TO_QF,
|
|
3228
|
-
FEED_IN_CHAMPIONSHIP_TO_SF,
|
|
3229
|
-
FEED_IN_CHAMPIONSHIP,
|
|
3230
|
-
LUCKY_DRAW,
|
|
3231
|
-
ROUND_ROBIN_WITH_PLAYOFF,
|
|
3232
|
-
ROUND_ROBIN,
|
|
3233
|
-
DECIDER,
|
|
3234
|
-
BACKDRAW,
|
|
3235
|
-
COMPASS_ATTRIBUTES,
|
|
3236
|
-
OLYMPIC_ATTRIBUTES,
|
|
3237
|
-
DRAW,
|
|
3238
|
-
RANDOM,
|
|
3239
|
-
TOP_DOWN,
|
|
3240
|
-
BOTTOM_UP,
|
|
3241
|
-
WATERFALL,
|
|
3242
|
-
WIN_RATIO: WIN_RATIO$1,
|
|
3243
|
-
ROUND_OUTCOME,
|
|
3244
|
-
MULTI_STRUCTURE_DRAWS,
|
|
3245
|
-
generatedDrawTypes,
|
|
3246
|
-
stageOrder: stageOrder$1,
|
|
3247
|
-
finishOrder,
|
|
3248
|
-
AGGREGATE_EVENT_STRUCTURES,
|
|
3249
|
-
FINISHING_POSITIONS,
|
|
3250
|
-
};
|
|
3251
|
-
|
|
3252
3265
|
function structureSort(a, b, config) {
|
|
3253
3266
|
const getRoundTarget = (element) => findExtension({ element, name: ROUND_TARGET })?.extension?.value;
|
|
3254
3267
|
const completed = config?.deprioritizeCompleted;
|
|
@@ -12727,12 +12740,11 @@ function getStageSpace({ entryStatus = DIRECT_ACCEPTANCE, drawDefinition, stageS
|
|
|
12727
12740
|
}
|
|
12728
12741
|
|
|
12729
12742
|
function addDrawEntry(params) {
|
|
12743
|
+
const paramsCheck = checkRequiredParameters(params, [{ [DRAW_DEFINITION]: true, [ENTRY_STAGE]: true }]);
|
|
12744
|
+
if (paramsCheck.error)
|
|
12745
|
+
return paramsCheck;
|
|
12730
12746
|
const { suppressDuplicateEntries = true, entryStatus = DIRECT_ACCEPTANCE, entryStageSequence, entryStage = MAIN, ignoreStageSpace, drawDefinition, entryPosition, participant, roundTarget, extensions, extension, drawType, event, } = params;
|
|
12731
12747
|
const stack = 'addDrawEntry';
|
|
12732
|
-
if (!drawDefinition)
|
|
12733
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
12734
|
-
if (!entryStage)
|
|
12735
|
-
return { error: MISSING_STAGE };
|
|
12736
12748
|
if (drawType !== AD_HOC && !getValidStage({ stage: entryStage, drawDefinition })) {
|
|
12737
12749
|
return decorateResult({ result: { error: INVALID_STAGE }, stack });
|
|
12738
12750
|
}
|
|
@@ -12813,7 +12825,7 @@ function addDrawEntry(params) {
|
|
|
12813
12825
|
}
|
|
12814
12826
|
function addDrawEntries$1(params) {
|
|
12815
12827
|
const stack = 'addDrawEntries';
|
|
12816
|
-
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;
|
|
12817
12829
|
if (!stage)
|
|
12818
12830
|
return { error: MISSING_STAGE };
|
|
12819
12831
|
if (!drawDefinition)
|
|
@@ -17516,117 +17528,26 @@ function resequenceStructures({ drawDefinition }) {
|
|
|
17516
17528
|
return { ...SUCCESS };
|
|
17517
17529
|
}
|
|
17518
17530
|
|
|
17519
|
-
function
|
|
17520
|
-
const
|
|
17521
|
-
if (
|
|
17522
|
-
return
|
|
17523
|
-
const
|
|
17524
|
-
|
|
17525
|
-
return element;
|
|
17526
|
-
const validTimeItem = isObject(timeItem) && isString(timeItem.itemType) && Object.keys(timeItem).includes('itemValue');
|
|
17527
|
-
if (!validTimeItem)
|
|
17528
|
-
return { error: INVALID_TIME_ITEM };
|
|
17529
|
-
if (!element.timeItems) {
|
|
17530
|
-
element.timeItems = [];
|
|
17531
|
-
}
|
|
17532
|
-
else if (hasEquivalentTimeItem({ element, duplicateValues, timeItem })) {
|
|
17533
|
-
return { ...SUCCESS };
|
|
17534
|
-
}
|
|
17535
|
-
if (timeItem.itemSubTypes && !timeItem.itemSubTypes.length)
|
|
17536
|
-
delete timeItem.itemSubTypes;
|
|
17537
|
-
if (creationTime) {
|
|
17538
|
-
const createdAt = new Date().toISOString();
|
|
17539
|
-
Object.assign(timeItem, { createdAt });
|
|
17540
|
-
}
|
|
17541
|
-
if (removePriorValues)
|
|
17542
|
-
element.timeItems = element.timeItems.filter(({ itemType }) => timeItem.itemType !== itemType);
|
|
17543
|
-
const doNotAdd = removePriorValues && !timeItem.itemValue;
|
|
17544
|
-
if (!doNotAdd)
|
|
17545
|
-
element.timeItems.push(timeItem);
|
|
17546
|
-
return { ...SUCCESS };
|
|
17547
|
-
}
|
|
17548
|
-
function hasEquivalentTimeItem({ element, duplicateValues, timeItem }) {
|
|
17549
|
-
const { itemType, itemSubTypes, itemValue } = timeItem;
|
|
17550
|
-
const existingTimeItem = itemType &&
|
|
17551
|
-
getTimeItem({
|
|
17552
|
-
itemSubTypes,
|
|
17553
|
-
itemType,
|
|
17554
|
-
element,
|
|
17555
|
-
})?.timeItem;
|
|
17556
|
-
return (existingTimeItem && JSON.stringify(existingTimeItem?.itemValue) === JSON.stringify(itemValue) && !duplicateValues);
|
|
17557
|
-
}
|
|
17558
|
-
function addParticipantTimeItem({ creationTime = true, removePriorValues, tournamentRecord, duplicateValues, participantId, timeItem, }) {
|
|
17559
|
-
if (!tournamentRecord)
|
|
17560
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17561
|
-
if (!participantId)
|
|
17562
|
-
return { error: MISSING_PARTICIPANT_ID };
|
|
17563
|
-
const result = findTournamentParticipant({ tournamentRecord, participantId });
|
|
17564
|
-
if (result.error)
|
|
17565
|
-
return result;
|
|
17566
|
-
return addTimeItem({
|
|
17567
|
-
element: result.participant,
|
|
17568
|
-
removePriorValues,
|
|
17569
|
-
duplicateValues,
|
|
17570
|
-
creationTime,
|
|
17571
|
-
timeItem,
|
|
17572
|
-
});
|
|
17573
|
-
}
|
|
17574
|
-
function addTournamentTimeItem(params) {
|
|
17575
|
-
const { removePriorValues, tournamentRecord, duplicateValues, creationTime, timeItem } = params;
|
|
17576
|
-
if (!tournamentRecord)
|
|
17577
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17578
|
-
return addTimeItem({
|
|
17579
|
-
element: tournamentRecord,
|
|
17580
|
-
removePriorValues,
|
|
17581
|
-
duplicateValues,
|
|
17582
|
-
creationTime,
|
|
17583
|
-
timeItem,
|
|
17584
|
-
});
|
|
17585
|
-
}
|
|
17586
|
-
function addEventTimeItem(params) {
|
|
17587
|
-
const { removePriorValues, duplicateValues, creationTime, timeItem, event } = params;
|
|
17588
|
-
if (!event)
|
|
17589
|
-
return { error: EVENT_NOT_FOUND };
|
|
17590
|
-
return addTimeItem({
|
|
17591
|
-
removePriorValues,
|
|
17592
|
-
duplicateValues,
|
|
17593
|
-
element: event,
|
|
17594
|
-
creationTime,
|
|
17595
|
-
timeItem,
|
|
17596
|
-
});
|
|
17597
|
-
}
|
|
17598
|
-
|
|
17599
|
-
function attachQualifyingStructure({ tournamentRecord, drawDefinition, structure, link }) {
|
|
17600
|
-
if (!tournamentRecord)
|
|
17601
|
-
return { error: MISSING_TOURNAMENT_RECORD };
|
|
17602
|
-
if (!drawDefinition)
|
|
17603
|
-
return { error: MISSING_DRAW_DEFINITION };
|
|
17604
|
-
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({
|
|
17605
17537
|
tournamentId: tournamentRecord.tournamentId,
|
|
17606
17538
|
drawDefinition,
|
|
17607
17539
|
structure,
|
|
17608
17540
|
link,
|
|
17609
17541
|
});
|
|
17610
|
-
if (result.error)
|
|
17611
|
-
return result;
|
|
17612
|
-
const qualifyingDetails = {
|
|
17613
|
-
structureId: structure.structureId,
|
|
17614
|
-
drawId: drawDefinition.drawId,
|
|
17615
|
-
};
|
|
17616
|
-
const timeItem = {
|
|
17617
|
-
itemType: 'attachQualifyingStructures',
|
|
17618
|
-
itemValue: qualifyingDetails,
|
|
17619
|
-
};
|
|
17620
|
-
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
17621
|
-
return result;
|
|
17622
17542
|
}
|
|
17623
|
-
function attachQualifying(
|
|
17624
|
-
|
|
17625
|
-
|
|
17626
|
-
|
|
17627
|
-
|
|
17628
|
-
if (
|
|
17629
|
-
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;
|
|
17630
17551
|
const targetStructureId = link.target.structureId;
|
|
17631
17552
|
const result = findStructure({
|
|
17632
17553
|
drawDefinition,
|
|
@@ -18511,22 +18432,6 @@ function addQualifyingStructure(params) {
|
|
|
18511
18432
|
const result = addQualifying(params);
|
|
18512
18433
|
if (result.error)
|
|
18513
18434
|
return result;
|
|
18514
|
-
const { qualifyingRoundNumber, qualifyingPositions, targetStructureId, drawDefinition, structureName, matchUpType, drawSize, drawType, } = params;
|
|
18515
|
-
const qualifyingDetails = definedAttributes({
|
|
18516
|
-
drawId: drawDefinition.drawId,
|
|
18517
|
-
qualifyingRoundNumber,
|
|
18518
|
-
qualifyingPositions,
|
|
18519
|
-
targetStructureId,
|
|
18520
|
-
structureName,
|
|
18521
|
-
matchUpType,
|
|
18522
|
-
drawSize,
|
|
18523
|
-
drawType,
|
|
18524
|
-
});
|
|
18525
|
-
const timeItem = {
|
|
18526
|
-
itemType: 'addQualifyingStructures',
|
|
18527
|
-
itemValue: qualifyingDetails,
|
|
18528
|
-
};
|
|
18529
|
-
addTournamentTimeItem({ tournamentRecord, timeItem });
|
|
18530
18435
|
return result;
|
|
18531
18436
|
}
|
|
18532
18437
|
function addQualifying(params) {
|
|
@@ -22915,6 +22820,107 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
22915
22820
|
};
|
|
22916
22821
|
}
|
|
22917
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
|
+
|
|
22918
22924
|
function attachConsolationStructures(params) {
|
|
22919
22925
|
return attachStructures({
|
|
22920
22926
|
...params,
|
|
@@ -33644,7 +33650,7 @@ function getTournamentInfo(params) {
|
|
|
33644
33650
|
const { tournamentRecord } = params ?? {};
|
|
33645
33651
|
if (!tournamentRecord)
|
|
33646
33652
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
33647
|
-
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, }) => ({
|
|
33648
33654
|
tournamentId,
|
|
33649
33655
|
tournamentRank,
|
|
33650
33656
|
tournamentStatus,
|
|
@@ -33653,6 +33659,7 @@ function getTournamentInfo(params) {
|
|
|
33653
33659
|
promotionalName,
|
|
33654
33660
|
onlineResources,
|
|
33655
33661
|
localTimeZone,
|
|
33662
|
+
activeDates,
|
|
33656
33663
|
startDate,
|
|
33657
33664
|
endDate,
|
|
33658
33665
|
hostCountryCode,
|
|
@@ -33677,10 +33684,11 @@ function getTournamentInfo(params) {
|
|
|
33677
33684
|
eventInfo.push(info);
|
|
33678
33685
|
}
|
|
33679
33686
|
}
|
|
33687
|
+
tournamentInfo.timeItemValues = getTimeItemValues({ element: tournamentRecord });
|
|
33680
33688
|
tournamentInfo.publishState = publishState?.tournament;
|
|
33681
33689
|
tournamentInfo.eventInfo = eventInfo;
|
|
33682
33690
|
return {
|
|
33683
|
-
tournamentInfo: makeDeepCopy(tournamentInfo, false, true),
|
|
33691
|
+
tournamentInfo: makeDeepCopy(definedAttributes(tournamentInfo), false, true),
|
|
33684
33692
|
...SUCCESS,
|
|
33685
33693
|
};
|
|
33686
33694
|
}
|
|
@@ -35282,13 +35290,54 @@ function getProfileRounds({ tournamentRecords, schedulingProfile, tournamentReco
|
|
|
35282
35290
|
return { profileRounds, segmentedRounds };
|
|
35283
35291
|
}
|
|
35284
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
|
+
|
|
35285
35331
|
var query$4 = {
|
|
35286
35332
|
__proto__: null,
|
|
35333
|
+
courtGridRows: courtGridRows,
|
|
35334
|
+
findVenue: findVenue,
|
|
35287
35335
|
getPersonRequests: getPersonRequests,
|
|
35288
35336
|
getProfileRounds: getProfileRounds,
|
|
35289
35337
|
getScheduledRoundsDetails: getScheduledRoundsDetails,
|
|
35290
35338
|
getSchedulingProfile: getSchedulingProfile,
|
|
35291
|
-
getSchedulingProfileIssues: getSchedulingProfileIssues
|
|
35339
|
+
getSchedulingProfileIssues: getSchedulingProfileIssues,
|
|
35340
|
+
publicFindCourt: publicFindCourt
|
|
35292
35341
|
};
|
|
35293
35342
|
|
|
35294
35343
|
function getEntriesAndSeedsCount({ policyDefinitions, drawDefinition, drawSize, drawId, event, stage, }) {
|
|
@@ -35787,44 +35836,6 @@ function scheduledSortedMatchUps({ schedulingProfile, matchUps = [] }) {
|
|
|
35787
35836
|
return sortedMatchUps;
|
|
35788
35837
|
}
|
|
35789
35838
|
|
|
35790
|
-
function courtGridRows({ courtPrefix = 'C|', minRowsCount, courtsData }) {
|
|
35791
|
-
if (!Array.isArray(courtsData))
|
|
35792
|
-
return { error: INVALID_VALUES };
|
|
35793
|
-
const maxCourtOrder = courtsData?.reduce((order, court) => {
|
|
35794
|
-
const matchUps = court.matchUps || [];
|
|
35795
|
-
const courtOrder = Math.max(0, ...matchUps.map((m) => m.schedule.courtOrder || 0));
|
|
35796
|
-
return courtOrder > order ? courtOrder : order;
|
|
35797
|
-
}, 1);
|
|
35798
|
-
const rowsCount = minRowsCount ? Math.max(minRowsCount, maxCourtOrder) : maxCourtOrder;
|
|
35799
|
-
const rowBuilder = generateRange(0, rowsCount).map((rowIndex) => ({
|
|
35800
|
-
matchUps: generateRange(0, courtsData.length).map((courtIndex) => {
|
|
35801
|
-
const courtInfo = courtsData[courtIndex];
|
|
35802
|
-
const { courtId, venueId } = courtInfo;
|
|
35803
|
-
return {
|
|
35804
|
-
schedule: {
|
|
35805
|
-
courtOrder: rowIndex + 1,
|
|
35806
|
-
venueId,
|
|
35807
|
-
courtId,
|
|
35808
|
-
},
|
|
35809
|
-
};
|
|
35810
|
-
}),
|
|
35811
|
-
}));
|
|
35812
|
-
courtsData.forEach((courtInfo, i) => {
|
|
35813
|
-
for (const matchUp of courtInfo.matchUps) {
|
|
35814
|
-
const courtOrder = matchUp.schedule?.courtOrder;
|
|
35815
|
-
if (courtOrder) {
|
|
35816
|
-
rowBuilder[courtOrder - 1].matchUps[i] = matchUp;
|
|
35817
|
-
}
|
|
35818
|
-
}
|
|
35819
|
-
});
|
|
35820
|
-
return {
|
|
35821
|
-
courtPrefix,
|
|
35822
|
-
rows: rowBuilder.map((row, i) => Object.assign({ rowId: `rowId-${i + 1}` }, ...row.matchUps.map((matchUp, i) => ({
|
|
35823
|
-
[`${courtPrefix}${i}`]: matchUp,
|
|
35824
|
-
})))),
|
|
35825
|
-
};
|
|
35826
|
-
}
|
|
35827
|
-
|
|
35828
35839
|
function eventMatchUps(params) {
|
|
35829
35840
|
let { participants: tournamentParticipants, contextContent, participantMap } = params;
|
|
35830
35841
|
const { tournamentAppliedPolicies, scheduleVisibilityFilters, participantsProfile, afterRecoveryTimes, policyDefinitions, useParticipantMap, tournamentRecord, usePublishState, contextFilters, matchUpFilters, contextProfile, nextMatchUps, tournamentId, inContext, context, event, } = params;
|
|
@@ -37277,6 +37288,7 @@ var index$f = {
|
|
|
37277
37288
|
checkValidEntries: checkValidEntries,
|
|
37278
37289
|
compareTieFormats: compareTieFormats,
|
|
37279
37290
|
competitionScheduleMatchUps: competitionScheduleMatchUps,
|
|
37291
|
+
courtGridRows: courtGridRows,
|
|
37280
37292
|
credits: credits,
|
|
37281
37293
|
drawMatchUps: drawMatchUps,
|
|
37282
37294
|
eventMatchUps: eventMatchUps,
|
|
@@ -37284,6 +37296,7 @@ var index$f = {
|
|
|
37284
37296
|
filterParticipants: filterParticipants,
|
|
37285
37297
|
findDrawDefinition: publicFindDrawDefinition,
|
|
37286
37298
|
findExtension: findExtension,
|
|
37299
|
+
findVenue: findVenue,
|
|
37287
37300
|
getAllDrawMatchUps: getAllDrawMatchUps,
|
|
37288
37301
|
getAllEventData: getAllEventData,
|
|
37289
37302
|
getAllStructureMatchUps: getAllStructureMatchUps,
|
|
@@ -37382,6 +37395,7 @@ var index$f = {
|
|
|
37382
37395
|
participantScaleItem: participantScaleItem,
|
|
37383
37396
|
participantScheduledMatchUps: participantScheduledMatchUps,
|
|
37384
37397
|
positionActions: positionActions,
|
|
37398
|
+
publicFindCourt: publicFindCourt,
|
|
37385
37399
|
publicFindVenue: publicFindVenue,
|
|
37386
37400
|
tallyParticipantResults: tallyParticipantResults,
|
|
37387
37401
|
tieFormatGenderValidityCheck: tieFormatGenderValidityCheck,
|
|
@@ -38612,7 +38626,16 @@ function deleteDrawDefinitions(params) {
|
|
|
38612
38626
|
return { error: result.error };
|
|
38613
38627
|
}
|
|
38614
38628
|
if (auditTrail.length) {
|
|
38615
|
-
|
|
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
|
+
}
|
|
38616
38639
|
}
|
|
38617
38640
|
if (matchUpIds.length) {
|
|
38618
38641
|
deleteMatchUpsNotice({
|
|
@@ -38621,7 +38644,6 @@ function deleteDrawDefinitions(params) {
|
|
|
38621
38644
|
});
|
|
38622
38645
|
}
|
|
38623
38646
|
drawIds.forEach((drawId) => deleteDrawNotice({ drawId }));
|
|
38624
|
-
addDrawDeletionTelemetry({ appliedPolicies, event, deletedDrawsDetail, auditData });
|
|
38625
38647
|
if (autoPublish && publishedDrawsDeleted) {
|
|
38626
38648
|
const result = publishEvent({
|
|
38627
38649
|
...params.eventDataParams,
|
|
@@ -38865,6 +38887,23 @@ function removeTiming({ event }) {
|
|
|
38865
38887
|
return removeEventExtension({ event, name: SCHEDULE_TIMING });
|
|
38866
38888
|
}
|
|
38867
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
|
+
|
|
38868
38907
|
function setEventStartDate({ tournamentRecord, event, startDate }) {
|
|
38869
38908
|
if (!tournamentRecord)
|
|
38870
38909
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -38889,7 +38928,8 @@ function setEventStartDate({ tournamentRecord, event, startDate }) {
|
|
|
38889
38928
|
event.startDate = startDate;
|
|
38890
38929
|
return { ...SUCCESS };
|
|
38891
38930
|
}
|
|
38892
|
-
function setEventEndDate(
|
|
38931
|
+
function setEventEndDate(params) {
|
|
38932
|
+
const { tournamentRecord, event, endDate } = params;
|
|
38893
38933
|
if (!tournamentRecord)
|
|
38894
38934
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
38895
38935
|
if (!event)
|
|
@@ -38913,23 +38953,42 @@ function setEventEndDate({ tournamentRecord, event, endDate }) {
|
|
|
38913
38953
|
event.endDate = endDate;
|
|
38914
38954
|
return { ...SUCCESS };
|
|
38915
38955
|
}
|
|
38916
|
-
function setEventDates(
|
|
38917
|
-
|
|
38918
|
-
|
|
38919
|
-
|
|
38920
|
-
|
|
38921
|
-
|
|
38922
|
-
|
|
38923
|
-
|
|
38924
|
-
|
|
38925
|
-
|
|
38926
|
-
|
|
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;
|
|
38927
38978
|
if (startDate && endDate) {
|
|
38928
38979
|
const newStartDate = new Date(extractDate(startDate)).getTime();
|
|
38929
38980
|
const newEndDate = new Date(extractDate(endDate)).getTime();
|
|
38930
38981
|
if (newStartDate > newEndDate)
|
|
38931
38982
|
return { error: INVALID_VALUES };
|
|
38932
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
|
+
}
|
|
38933
38992
|
if (startDate) {
|
|
38934
38993
|
const result = setEventStartDate({ tournamentRecord, event, startDate });
|
|
38935
38994
|
if (result.error)
|
|
@@ -38940,6 +38999,10 @@ function setEventDates({ tournamentRecord, event, startDate, endDate }) {
|
|
|
38940
38999
|
if (result.error)
|
|
38941
39000
|
return result;
|
|
38942
39001
|
}
|
|
39002
|
+
if (activeDates)
|
|
39003
|
+
event.activeDates = activeDates;
|
|
39004
|
+
if (weekdays)
|
|
39005
|
+
event.weekdays = weekdays;
|
|
38943
39006
|
return { ...SUCCESS };
|
|
38944
39007
|
}
|
|
38945
39008
|
function getTournamentDates(tournamentRecord) {
|
|
@@ -39502,13 +39565,14 @@ function removeSeeding({ tournamentRecord, drawDefinition, entryStatuses, scaleN
|
|
|
39502
39565
|
});
|
|
39503
39566
|
}
|
|
39504
39567
|
|
|
39505
|
-
function deleteEvents(
|
|
39506
|
-
|
|
39507
|
-
|
|
39508
|
-
|
|
39509
|
-
|
|
39510
|
-
if (
|
|
39511
|
-
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;
|
|
39512
39576
|
const auditTrail = [];
|
|
39513
39577
|
const deletedEventDetails = [];
|
|
39514
39578
|
const activePairParticipantIds = [];
|
|
@@ -39549,12 +39613,17 @@ function deleteEvents({ removePairParticipants, tournamentRecord, eventIds }) {
|
|
|
39549
39613
|
}
|
|
39550
39614
|
checkAndUpdateSchedulingProfile({ tournamentRecord });
|
|
39551
39615
|
if (auditTrail.length) {
|
|
39552
|
-
|
|
39553
|
-
|
|
39554
|
-
|
|
39555
|
-
|
|
39556
|
-
|
|
39557
|
-
|
|
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
|
+
}
|
|
39558
39627
|
}
|
|
39559
39628
|
return { ...SUCCESS };
|
|
39560
39629
|
}
|
|
@@ -46098,7 +46167,16 @@ function auditAutoScheduling({ autoSchedulingAudit, tournamentRecords }) {
|
|
|
46098
46167
|
itemValue,
|
|
46099
46168
|
};
|
|
46100
46169
|
for (const tournamentRecord of Object.values(tournamentRecords)) {
|
|
46101
|
-
|
|
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
|
+
}
|
|
46102
46180
|
}
|
|
46103
46181
|
}
|
|
46104
46182
|
|
|
@@ -52640,16 +52718,18 @@ function getStructureReports({ firstFlightOnly = true, extensionProfiles, tourna
|
|
|
52640
52718
|
[flight.drawId]: flight.flightNumber,
|
|
52641
52719
|
}));
|
|
52642
52720
|
const flightMap = flightNumbers && Object.assign({}, ...flightNumbers);
|
|
52643
|
-
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;
|
|
52644
52724
|
const mapValues = Object.values(flightMap);
|
|
52645
52725
|
const minFlightNumber = flightMap && Math.min(...mapValues);
|
|
52646
52726
|
const eventSeedingBasis = getSeedingBasis(eventTimeItems);
|
|
52647
52727
|
eventStructureReports[eventId] = {
|
|
52728
|
+
seedingBasis: eventSeedingBasis ? JSON.stringify(eventSeedingBasis) : undefined,
|
|
52648
52729
|
totalPositionManipulations: 0,
|
|
52649
52730
|
maxPositionManipulations: 0,
|
|
52650
52731
|
generatedDrawsCount: 0,
|
|
52651
52732
|
drawDeletionsCount,
|
|
52652
|
-
seedingBasis: eventSeedingBasis ? JSON.stringify(eventSeedingBasis) : undefined,
|
|
52653
52733
|
tournamentId,
|
|
52654
52734
|
eventId,
|
|
52655
52735
|
};
|
|
@@ -53959,16 +54039,13 @@ var mutate$3 = {
|
|
|
53959
54039
|
calculateScheduleTimes: calculateScheduleTimes,
|
|
53960
54040
|
clearMatchUpSchedule: clearMatchUpSchedule,
|
|
53961
54041
|
clearScheduledMatchUps: clearScheduledMatchUps,
|
|
53962
|
-
courtGridRows: courtGridRows,
|
|
53963
54042
|
findMatchUpFormatTiming: findMatchUpFormatTiming,
|
|
53964
|
-
findVenue: findVenue,
|
|
53965
54043
|
generateBookings: generateBookings,
|
|
53966
54044
|
generateVirtualCourts: generateVirtualCourts,
|
|
53967
54045
|
matchUpScheduleChange: matchUpScheduleChange,
|
|
53968
54046
|
modifyMatchUpFormatTiming: modifyMatchUpFormatTiming,
|
|
53969
54047
|
proAutoSchedule: proAutoSchedule,
|
|
53970
54048
|
proConflicts: proConflicts,
|
|
53971
|
-
publicFindCourt: publicFindCourt,
|
|
53972
54049
|
removeEventMatchUpFormatTiming: removeEventMatchUpFormatTiming,
|
|
53973
54050
|
removeMatchUpCourtAssignment: removeMatchUpCourtAssignment,
|
|
53974
54051
|
reorderUpcomingMatchUps: reorderUpcomingMatchUps,
|
|
@@ -55949,19 +56026,39 @@ function updateCourtAvailability({ tournamentRecord }) {
|
|
|
55949
56026
|
}
|
|
55950
56027
|
|
|
55951
56028
|
function setTournamentDates(params) {
|
|
55952
|
-
const { tournamentRecord, startDate, endDate } = params;
|
|
56029
|
+
const { tournamentRecord, startDate, endDate, activeDates, weekdays } = params;
|
|
55953
56030
|
const paramsCheck = checkRequiredParameters(params, [
|
|
55954
56031
|
{ tournamentRecord: true },
|
|
55955
56032
|
{
|
|
55956
56033
|
[VALIDATE]: (value) => dateValidation.test(value),
|
|
55957
|
-
[ANY_OF]: { startDate: false, endDate: false },
|
|
55958
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,
|
|
55959
56046
|
},
|
|
55960
56047
|
]);
|
|
55961
56048
|
if (paramsCheck.error)
|
|
55962
56049
|
return paramsCheck;
|
|
55963
56050
|
if (endDate && startDate && new Date(endDate) < new Date(startDate))
|
|
55964
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
|
+
}
|
|
55965
56062
|
let checkScheduling;
|
|
55966
56063
|
if ((startDate && tournamentRecord.startDate && new Date(startDate) > new Date(tournamentRecord.startDate)) ||
|
|
55967
56064
|
(endDate && tournamentRecord.endDate && new Date(endDate) < new Date(tournamentRecord.endDate))) {
|
|
@@ -55991,23 +56088,33 @@ function setTournamentDates(params) {
|
|
|
55991
56088
|
if (endDate && tournamentRecord.startDate && new Date(endDate) < new Date(tournamentRecord.startDate)) {
|
|
55992
56089
|
tournamentRecord.startDate = endDate;
|
|
55993
56090
|
}
|
|
56091
|
+
if (activeDates)
|
|
56092
|
+
tournamentRecord.activeDates = activeDates;
|
|
56093
|
+
if (weekdays)
|
|
56094
|
+
tournamentRecord.weekdays = weekdays;
|
|
55994
56095
|
const unscheduledMatchUpIds = checkScheduling && removeInvalidScheduling({ tournamentRecord })?.unscheduledMatchUpIds;
|
|
55995
56096
|
updateCourtAvailability({ tournamentRecord });
|
|
55996
56097
|
addNotice({
|
|
55997
|
-
payload: {
|
|
56098
|
+
payload: definedAttributes({
|
|
55998
56099
|
parentOrganisation: tournamentRecord.parentOrganisation,
|
|
55999
56100
|
tournamentId: tournamentRecord.tournamentId,
|
|
56101
|
+
activeDates,
|
|
56000
56102
|
startDate,
|
|
56103
|
+
weekdays,
|
|
56001
56104
|
endDate,
|
|
56002
|
-
},
|
|
56105
|
+
}),
|
|
56003
56106
|
topic: MODIFY_TOURNAMENT_DETAIL,
|
|
56004
56107
|
});
|
|
56005
56108
|
return { ...SUCCESS, unscheduledMatchUpIds, datesAdded, datesRemoved };
|
|
56006
56109
|
}
|
|
56007
56110
|
function setTournamentStartDate({ tournamentRecord, startDate }) {
|
|
56111
|
+
if (!startDate)
|
|
56112
|
+
return { error: INVALID_DATE };
|
|
56008
56113
|
return setTournamentDates({ tournamentRecord, startDate });
|
|
56009
56114
|
}
|
|
56010
56115
|
function setTournamentEndDate({ tournamentRecord, endDate }) {
|
|
56116
|
+
if (!endDate)
|
|
56117
|
+
return { error: INVALID_DATE };
|
|
56011
56118
|
return setTournamentDates({ tournamentRecord, endDate });
|
|
56012
56119
|
}
|
|
56013
56120
|
function removeInvalidScheduling({ tournamentRecord }) {
|
|
@@ -58797,7 +58904,8 @@ var index = {
|
|
|
58797
58904
|
tournamentConstants: tournamentConstants,
|
|
58798
58905
|
upcomingMatchUpStatuses: upcomingMatchUpStatuses,
|
|
58799
58906
|
validMatchUpStatuses: validMatchUpStatuses,
|
|
58800
|
-
venueConstants: venueConstants
|
|
58907
|
+
venueConstants: venueConstants,
|
|
58908
|
+
weekdayConstants: weekdayConstants
|
|
58801
58909
|
};
|
|
58802
58910
|
|
|
58803
58911
|
exports.activeMatchUpStatuses = activeMatchUpStatuses;
|
|
@@ -58875,4 +58983,5 @@ exports.validMatchUpStatuses = validMatchUpStatuses;
|
|
|
58875
58983
|
exports.venueConstants = venueConstants;
|
|
58876
58984
|
exports.venueGovernor = index$2;
|
|
58877
58985
|
exports.version = factoryVersion;
|
|
58986
|
+
exports.weekdayConstants = weekdayConstants;
|
|
58878
58987
|
//# sourceMappingURL=tods-competition-factory.development.cjs.js.map
|