@@ -78,7 +78,7 @@ function main () {
7878function main_page ( ) {
7979 const student_name = getStudentName ( ) ;
8080 const { sem1_col, sem2_col } = getSemesterCols ( ) ;
81- const second_semester = isSecondSemester ( ) ;
81+ const second_semester = isSecondSemester ( sem2_col ) ;
8282 const current_term = getCurrentTerm ( ) ;
8383 const { courses, promises_grade_calc_list } = getCourses ( second_semester , sem1_col , sem2_col ) ;
8484
@@ -213,7 +213,7 @@ function isSecondSemester (sem2_col) {
213213 const $grade_rows = $ ( '#quickLookup table.grid' ) . find ( 'tr' ) ;
214214 if ( $grade_rows . eq ( 1 ) . html ( ) . match ( "S2" ) != null ) {
215215 for ( let t = 0 ; t < $grade_rows . length ; t ++ ) {
216- if ( gradeToGPA ( $grade_rows . eq ( t ) . find ( 'td' ) . get ( sem2_col ) ) !== - 1 ) {
216+ if ( gradeToGPA ( $grade_rows . eq ( t ) . find ( 'td' ) . get ( sem2_col ) ?. innerText ) !== - 1 ) {
217217 return true ;
218218 }
219219 }
@@ -273,11 +273,14 @@ function getCourses (second_semester, sem1_col, sem2_col) {
273273 const page = document . implementation . createHTMLDocument ( ) ;
274274 page . documentElement . innerHTML = response ;
275275 const finalPercent = extractFinalPercent ( page . querySelector ( 'table.linkDescList' ) . innerHTML ) || "" ;
276- new ( Vue . extend ( ClassGrade ) ) ( {
277- propsData : {
278- course : new Course ( "" , `https://powerschool.sas.edu.sg/guardian/${ $first_grade . attr ( 'href' ) } ` , $first_grade . text ( ) , finalPercent ) , showMissing : false ,
279- } ,
280- } ) . $mount ( $first_grade . get ( 0 ) ) ;
276+ if ( gradeToGPA ( $first_grade . text ( ) ) !== - 1 ) {
277+ new ( Vue . extend ( ClassGrade ) ) ( {
278+ propsData : {
279+ course : new Course ( "" , `https://powerschool.sas.edu.sg/guardian/${ $first_grade . attr ( 'href' ) } ` , $first_grade . text ( ) , finalPercent ) ,
280+ } ,
281+ } ) . $mount ( $first_grade . get ( 0 ) ) ;
282+ }
283+ resolve ( "Success" ) ;
281284 } ) ;
282285 } ) ) ;
283286 }
@@ -287,23 +290,25 @@ function getCourses (second_semester, sem1_col, sem2_col) {
287290 }
288291 if ( $course . length === 1 ) {
289292 const temp = $course . parents ( ) . eq ( 1 ) . children ( "td[align=left]" ) . text ( ) . match ( ".*(?=Details)" ) [ 0 ] ;
290- promises_grade_calc_list . push ( new Promise ( ( resolve , reject ) => {
291- fetch ( `https://powerschool.sas.edu.sg/guardian/${ $course . attr ( 'href' ) } ` , { credentials : "same-origin" } ) . then ( response => response . text ( ) ) . then ( response => {
292- const page = document . implementation . createHTMLDocument ( ) ;
293- page . documentElement . innerHTML = response ;
294- const finalPercent = extractFinalPercent ( page . querySelector ( 'table.linkDescList' ) . innerHTML ) || "" ;
295- const assignment_list = assignments ( page . querySelector ( 'body' ) ) ;
296- courses . push ( new Course ( temp . trim ( ) , `https://powerschool.sas.edu.sg/guardian/${ $course . attr ( 'href' ) } ` , $course . text ( ) , finalPercent , assignment_list ) ) ;
297- if ( gradeToGPA ( $course . text ( ) ) !== - 1 ) {
298- new ( Vue . extend ( ClassGrade ) ) ( {
299- propsData : {
300- course : courses [ courses . length - 1 ] ,
301- } ,
302- } ) . $mount ( $course . get ( 0 ) ) ;
303- }
304- resolve ( "Success" ) ;
305- } ) ;
306- } ) ) ;
293+ if ( gradeToGPA ( $course . text ( ) ) !== - 1 ) {
294+ promises_grade_calc_list . push ( new Promise ( ( resolve , reject ) => {
295+ fetch ( `https://powerschool.sas.edu.sg/guardian/${ $course . attr ( 'href' ) } ` , { credentials : "same-origin" } ) . then ( response => response . text ( ) ) . then ( response => {
296+ const page = document . implementation . createHTMLDocument ( ) ;
297+ page . documentElement . innerHTML = response ;
298+ const finalPercent = extractFinalPercent ( page . querySelector ( 'table.linkDescList' ) . innerHTML ) || "" ;
299+ const assignment_list = assignments ( page . querySelector ( 'body' ) ) ;
300+ courses . push ( new Course ( temp . trim ( ) , `https://powerschool.sas.edu.sg/guardian/${ $course . attr ( 'href' ) } ` , $course . text ( ) , finalPercent , assignment_list ) ) ;
301+ if ( gradeToGPA ( $course . text ( ) ) !== - 1 ) {
302+ new ( Vue . extend ( ClassGrade ) ) ( {
303+ propsData : {
304+ course : courses [ courses . length - 1 ] ,
305+ } ,
306+ } ) . $mount ( $course . get ( 0 ) ) ;
307+ }
308+ resolve ( "Success" ) ;
309+ } ) ;
310+ } ) ) ;
311+ }
307312 }
308313 }
309314
0 commit comments