@@ -52,20 +52,31 @@ export default defineEventHandler(async (event) => {
5252
5353 const sectionID = sectionInfo [ 0 ] [ 0 ]
5454
55- const processedData = sectionInfo [ 2 ] [ 1 ]
55+ const processedData = findElement ( sectionInfo , 'Processed' )
5656
57- const processedInfo = {
57+ const processedInfo = processedData ? {
5858 received : processedData . split ( 'Received: ' ) [ 1 ] . split ( ' ' ) [ 0 ] ,
5959 entered : processedData . split ( 'Entered: ' ) [ 1 ] . split ( ' ' ) [ 0 ] ,
6060 rated : processedData . split ( 'Rated: ' ) [ 1 ] . split ( ' ' ) [ 0 ] ,
6161 reRated : undefined as string | undefined
62- }
62+ } : undefined
6363
64- if ( processedData . includes ( 'Re-Rated' ) ) {
64+ if ( processedData ? .includes ( 'Re-Rated' ) && processedInfo ) {
6565 processedInfo . reRated = processedData . split ( 'Re-Rated: ' ) [ 1 ] . split ( ' ' ) [ 0 ]
6666 }
6767
68- const statsData = sectionInfo [ 3 ] [ 1 ]
68+ const statsData = findElement ( sectionInfo , 'Stats' )
69+ if ( statsData == null ) {
70+ sections . push ( {
71+ id : parseInt ( sectionID . split ( ' - ' ) [ 0 ] . split ( 'Section ' ) [ 1 ] ) ,
72+ name : sectionID . split ( ' - ' ) [ 1 ] ,
73+ processed : processedInfo ,
74+ stats : undefined ,
75+ players : [ ]
76+ } )
77+ continue
78+ }
79+
6980 const statsInfo = {
7081 rounds : parseInt ( statsData . split ( ' ' ) [ 0 ] ) ,
7182 players : parseInt ( statsData . split ( ' Rounds, ' ) [ 1 ] . split ( ' Players' ) [ 0 ] ) ,
@@ -76,7 +87,17 @@ export default defineEventHandler(async (event) => {
7687 }
7788
7889 const players : USCFTournamentSectionPlayer [ ] = [ ]
79- const playerInfo = section [ 5 ] [ 0 ] . split ( '\n' )
90+ const playerInfo = findElement ( section , '---------------' , false , 0 ) ?. split ( '\n' )
91+ if ( ! playerInfo ) {
92+ sections . push ( {
93+ id : parseInt ( sectionID . split ( ' - ' ) [ 0 ] . split ( 'Section ' ) [ 1 ] ) ,
94+ name : sectionID . split ( ' - ' ) [ 1 ] ,
95+ processed : processedInfo ,
96+ stats : statsInfo ,
97+ players : [ ]
98+ } )
99+ continue
100+ }
80101 const base = 13
81102 let rowsOfData = 0
82103 while ( ! playerInfo [ base + ( rowsOfData ) ] . includes ( '---------' ) ) {
0 commit comments