@@ -116,16 +116,6 @@ export async function getCurrentTeams(): Promise<{
116116 teams : TeamInfo ;
117117 errors : ReactElement [ ] ;
118118} > {
119- const main = ( await get ( "https://snokinghockeyleague.com/" ) ) as string ;
120- const match = main . match ( / m e t a n a m e = \" v e r s i o n \" \s + c o n t e n t = \" ( \d + ) \" / ) ;
121- if ( ! match || match . length < 2 ) {
122- return {
123- teams : [ ] ,
124- errors : [ < > Data is not currently available. Please try again later if you require data for that league.</ > ] ,
125- } ;
126- }
127-
128- const version = match [ 1 ] ;
129119 const safelyGetTeams = async ( getter : ( ) => Promise < TeamInfo > , errorMessage : ReactElement ) => {
130120 try {
131121 const data = await getter ( ) ;
@@ -141,22 +131,7 @@ export async function getCurrentTeams(): Promise<{
141131 }
142132 } ;
143133
144- // In the past, this code was clever to try and guess what seasons to show in the dropdown (assuming the last N were relevant)
145- // As the number of seasons fluctuates (we don't know when playoffs get scheduled, new season type, etc), instead
146- // we now just show every team that is in a season for this calendar year. This means that we'll at some point have 3 seasons showing
147- // for the main SKAHL league, but that's less interruptive then new seasons breaking our heuristic.
148- const currentYear = new Date ( ) . getFullYear ( ) . toString ( ) ;
149- const allSKAHLTeamsSeasons = await getFiveVFiveSeasons ( version ) ;
150- const allCurrentSKAHLSeasons = allSKAHLTeamsSeasons . filter ( ( season ) => season . name . indexOf ( currentYear ) >= 0 ) ;
151-
152134 const dataForNonSKAHLSite = [
153- safelyGetTeams (
154- ( ) => getPondSeasonCurrentTeams ( version ) ,
155- < >
156- < b > SKAHL Pond</ b > data is not currently available. Please try again later if you require data for that
157- league.
158- </ >
159- ) ,
160135 safelyGetTeams (
161136 ( ) => getCurrentKHLTeams ( ) ,
162137 < >
@@ -167,17 +142,7 @@ export async function getCurrentTeams(): Promise<{
167142 ) ,
168143 ] ;
169144
170- const dataForSKAHLSite = allCurrentSKAHLSeasons . map ( ( season ) =>
171- safelyGetTeams (
172- ( ) => getFiveVFiveCurrentTeams ( { ...season , version } ) ,
173- < >
174- < b > { season . name } </ b > data is not currently available. Please try again later if you require data for
175- that league.
176- </ >
177- )
178- ) ;
179-
180- const seasonData = await Promise . all ( dataForNonSKAHLSite . concat ( dataForSKAHLSite ) ) ;
145+ const seasonData = await Promise . all ( dataForNonSKAHLSite ) ;
181146 return {
182147 teams : seasonData . map ( ( x ) => x . data ) . reduce ( ( a , b ) => a . concat ( b ) ) ,
183148 errors : seasonData . map ( ( x ) => x . error ) . filter ( ( a ) => a != null ) as ReactElement [ ] ,
0 commit comments