@@ -25,93 +25,6 @@ async function getCurrentKHLTeams(): Promise<TeamInfo> {
2525 return teams ;
2626}
2727
28- async function getFiveVFiveSeasons ( version : string ) : Promise < Array < { name : string ; id : number } > > {
29- const ans = (
30- ( await get ( `https://snokinghockeyleague.com/api/season/all/0?v=${ version } ` ) ) as {
31- seasons : [
32- {
33- name : string ;
34- id : number ;
35- }
36- ] ;
37- }
38- ) . seasons . map ( ( x : { name : string ; id : number } ) => ( {
39- name : x . name ,
40- id : x . id ,
41- } ) ) ;
42-
43- ans . forEach ( ( season ) => {
44- const SEASON_REMAP : { [ id : string ] : string | null } = {
45- // So apparently they named the playoffs incorrectly. I guess I'll just include a generalized rename
46- // to handle this if it happens in the future.
47- [ "2023-2023 SKAHL Fall-Winter Playoffs" ] : "2023-2024 SKAHL Fall-Winter Playoffs" ,
48- } ;
49- if ( SEASON_REMAP [ season . name ] ) {
50- season . name = SEASON_REMAP [ season . name ] as string ;
51- } else {
52- return season ;
53- }
54- } ) ;
55-
56- return ans ;
57- }
58-
59- async function getFiveVFiveCurrentTeams ( {
60- name,
61- id,
62- version,
63- } : {
64- name : string ;
65- id : number ;
66- version : string ;
67- } ) : Promise < TeamInfo > {
68- return (
69- ( await get ( `https://snokinghockeyleague.com/api/team/list/${ id } /0?v=${ version } ` ) ) as [
70- {
71- name : string ;
72- divisionName : string ;
73- teamId : string ;
74- seasonId : string ;
75- }
76- ]
77- ) . map ( ( x ) => ( {
78- name : `5v5: ${ x . name } (${ x . divisionName } - ${ name } )` ,
79- teamId : x . teamId ,
80- snokingUrl : `https://snokinghockeyleague.com/api/game/list/${ x . seasonId } /0/${ x . teamId } ` ,
81- isSnoking : true ,
82- } ) ) ;
83- }
84-
85- async function getPondSeasons ( version : string ) : Promise < Array < { name : string ; id : number } > > {
86- return (
87- ( await get ( `https://snokingpondhockey.com/api/season/all/0?v=${ version } ` ) ) as {
88- seasons : [ { name : string ; id : number } ] ;
89- }
90- ) . seasons . map ( ( x : { name : string ; id : number } ) => ( {
91- name : x . name ,
92- id : x . id ,
93- } ) ) ;
94- }
95-
96- async function getPondSeasonCurrentTeams (
97- version : string
98- ) : Promise < Array < { name : string ; snokingUrl : string ; teamId : string ; isSnoking : boolean } > > {
99- const { id, name : seasonName } = ( await getPondSeasons ( version ) ) [ 0 ] ;
100-
101- return (
102- ( await get ( `https://snokingpondhockey.com/api/team/list/${ id } /0?v=${ version } ` ) ) as [
103- { name : string ; divisionName : string ; teamId : string ; seasonId : string }
104- ]
105- ) . map ( ( x ) => {
106- return {
107- name : `Pond: ${ x . name } (${ x . divisionName } - ${ seasonName } )` ,
108- teamId : x . teamId ,
109- snokingUrl : `https://snokinghockeyleague.com/api/game/list/${ x . seasonId } /0/${ x . teamId } ` ,
110- isSnoking : true ,
111- } ;
112- } ) ;
113- }
114-
11528export async function getCurrentTeams ( ) : Promise < {
11629 teams : TeamInfo ;
11730 errors : ReactElement [ ] ;
0 commit comments