From d8eb1601233a7a7daa3c7aaf2ab1cc89b85a4bc3 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Fri, 27 Sep 2019 16:33:50 -0400 Subject: [PATCH] [F] Fix max gpa calculation --- src/utils/gpa-utils.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/gpa-utils.ts b/src/utils/gpa-utils.ts index 39ee5d3..9499212 100644 --- a/src/utils/gpa-utils.ts +++ b/src/utils/gpa-utils.ts @@ -60,15 +60,16 @@ export class GPAUtils // Count total GPA let totalGPA = 0; - let maxGPA = 0; + let maxTotal = 0; courses.forEach(course => { totalGPA += this.getGP(course, course.letterGrade); - maxGPA += this.getGP(course, "A+"); + maxTotal += this.getGP(course, "A+"); }); // Get average GPA, round to two decimal places let gpa = Math.round(totalGPA / courses.length * 100) / 100; + let maxGPA = Math.round(maxTotal / courses.length * 100) / 100; // Return results return {gpa: gpa, accurate: accurate, max: maxGPA};