Skip to content

Commit e1489b7

Browse files
author
Suhas Hariharan
authored
Merge pull request #234 from sas-fossdev/last-seen-grades-ui
fixed gpa calculation
2 parents 6d65c64 + 52643ae commit e1489b7

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/js/saspowerschoolff.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function main_page () {
8686
const current_term = getCurrentTerm();
8787
const { courses, promises_grade_calc_list } = getCourses(second_semester, sem1_col, sem2_col);
8888

89-
showCurrentGPA(second_semester, courses);
89+
showCurrentGPA(second_semester, courses, promises_grade_calc_list);
9090

9191
if (second_semester) {
9292
showFirstSemGPA();
@@ -101,11 +101,6 @@ function main_page () {
101101
secondSemester: second_semester,
102102
},
103103
}).$mount("#cumulative-gpa");
104-
105-
Promise.all(promises_grade_calc_list).then(_ => {
106-
$("table[border='0'][cellpadding='3'][cellspacing='1'][width='100%']").prepend(`<tr><td align="center">Current Semester GPA (${second_semester ? 'S2' : 'S1'}): ${calculate_gpa(courses)}</td></tr>`);
107-
saveGradesLocally(student_name, courses);
108-
});
109104
addHypoGradeCalc(courses);
110105
}
111106

@@ -218,8 +213,11 @@ function isSecondSemester (sem2_col) {
218213
* @param second_semester If the current semester is the second semester
219214
* @param courses an array of Courses that the student is taking
220215
*/
221-
function showCurrentGPA (second_semester, courses) {
222-
$("table[border='0'][cellpadding='3'][cellspacing='1'][width='100%']").prepend(`<tr><td align="center">Current Semester GPA (${second_semester ? 'S2' : 'S1'}): ${calculate_gpa(courses)}</td></tr>`);
216+
function showCurrentGPA (second_semester, courses, promises_grade_calc_list) {
217+
Promise.all(promises_grade_calc_list).then(_ => {
218+
$("table[border='0'][cellpadding='3'][cellspacing='1'][width='100%']").prepend(`<tr><td align="center">Current Semester GPA (${second_semester ? 'S2' : 'S1'}): ${calculate_gpa(courses)}</td></tr>`);
219+
saveGradesLocally(getStudentName(), courses);
220+
});
223221
}
224222

225223
/**

0 commit comments

Comments
 (0)