@@ -128,7 +128,9 @@ export default {
128128 }
129129
130130 this .currently = CURRENTLY .CALCULATING ;
131- const gpa = await this .calculate_cumulative_gpa (this .courses , this .currentTerm , this .secondSemester ).catch (() => null );
131+ const gpa = await this .calculate_cumulative_gpa (this .courses , this .currentTerm , this .secondSemester ).catch ((err ) => {
132+ console .log (" Error in cumulative GPA calculation " + err);
133+ });
132134 if (gpa) {
133135 this .gpa = gpa .toFixed (2 );
134136 this .currently = CURRENTLY .DONE ;
@@ -149,7 +151,13 @@ export default {
149151 .then (data => {
150152 const el = document .createElement (" html" );
151153 el .innerHTML = data;
152- const current_term_history = el .getElementsByClassName (" selected" )[0 ].textContent .split (" - " )[0 ];
154+ let current_term_history = el .getElementsByClassName (" selected" );
155+ if (current_term_history .length != 0 ) {
156+ current_term_history= current_term_history[0 ].textContent .split (" - " )[0 ];
157+ }
158+ else {
159+ current_term_history= undefined ;
160+ }
153161 const tabs = el .getElementsByClassName (" tabs" )[0 ].getElementsByTagName (" li" );
154162 // Iterate until the end of tabs or until no longer at a high school semester
155163 for (let i = 0 ; i < tabs .length && / HS$ / .test (tabs[i].innerText ); i++ ) {
@@ -190,7 +198,7 @@ export default {
190198 }));
191199 }
192200 // Calculates cumulative GPA based on credit hours per semester and gpa for each semester.
193-
201+ console . log ( " got this far in calculation " );
194202 const cumulative_gpa = Promise .all (fetches).then (function () {
195203 let include_current_semester = false ;
196204 if (current_courses .length !== 0 ) {
@@ -206,7 +214,7 @@ export default {
206214 } else if (current_term_history === current_term && include_current_semester && current_term_grades .length === 1 && current_semester === false ) {
207215 all_courses .splice (all_courses .indexOf (current_term_grades[0 ]), 1 );
208216 }
209-
217+
210218 if (include_current_semester) {
211219 all_courses .push (current_courses);
212220 }
0 commit comments