@@ -352,22 +352,8 @@ try {
352352 if ( document . getElementById ( "export-report-course" ) ) document . getElementById ( "export-report-course" ) . value = ( storage . get ( 'period' ) && courses . find ( c => String ( c . id ) === String ( storage . get ( 'period' ) ) ) ) ? storage . get ( 'period' ) : ( ( ( ui . defaultCourse !== null ) && courses . find ( c => String ( c . id ) === String ( ui . defaultCourse ) ) ) ? ui . defaultCourse : courses . find ( c => responses . some ( r => JSON . parse ( c . periods ) . includes ( Number ( String ( r . seatCode ) [ 0 ] ) ) ) ) ? courses . find ( c => responses . some ( r => JSON . parse ( c . periods ) . includes ( Number ( String ( r . seatCode ) [ 0 ] ) ) ) ) . id : courses . sort ( ( a , b ) => a . id - b . id ) [ 0 ] ?. id ) ;
353353 }
354354 if ( ( document . getElementById ( "course-period-input" ) && ! loadedSegmentEditor && ! loadedSegmentCreator && ! noReloadCourse ) || noReloadCourse ) await updateResponses ( ) ;
355- if ( document . querySelector ( '.segment-reports' ) ) updateSegments ( )
356- . catch ( error => {
357- if ( storage . get ( "developer" ) ) {
358- alert ( `Error @ admin.js: ${ error . message } ` ) ;
359- } else {
360- ui . reportBugModal ( null , String ( error . stack ) ) ;
361- }
362- } ) ;
363- if ( document . querySelector ( '.question-reports' ) ) updateQuestionReports ( )
364- . catch ( error => {
365- if ( storage . get ( "developer" ) ) {
366- alert ( `Error @ admin.js: ${ error . message } ` ) ;
367- } else {
368- ui . reportBugModal ( null , String ( error . stack ) ) ;
369- }
370- } ) ;
355+ if ( document . querySelector ( '.segment-reports' ) ) updateSegments ( ) ;
356+ if ( document . querySelector ( '.question-reports' ) ) updateQuestionReports ( ) ;
371357 active = true ;
372358 ui . stopLoader ( ) ;
373359 if ( ! polling ) ui . toast ( "Data restored." , 1000 , "info" , "bi bi-cloud-arrow-down" ) ;
@@ -385,14 +371,7 @@ try {
385371 document . querySelectorAll ( '[data-remove-segment-input]' ) . forEach ( a => a . removeEventListener ( 'click' , removeSegment ) ) ;
386372 document . querySelectorAll ( '[data-remove-segment-input]' ) . forEach ( a => a . addEventListener ( 'click' , removeSegment ) ) ;
387373 if ( document . getElementById ( "course-input" ) ) document . getElementById ( "course-input" ) . value = courses . find ( c => String ( c . id ) === document . getElementById ( "course-period-input" ) . value ) . name ;
388- updateSegments ( )
389- . catch ( error => {
390- if ( storage . get ( "developer" ) ) {
391- alert ( `Error @ admin.js: ${ error . message } ` ) ;
392- } else {
393- ui . reportBugModal ( null , String ( error . stack ) ) ;
394- }
395- } ) ;
374+ updateSegments ( ) ;
396375 }
397376 if ( document . getElementById ( "sort-segments-types" ) ) document . getElementById ( "sort-segments-types" ) . value = await getSettings ( 'sort-segments' )
398377 . catch ( error => {
0 commit comments