[O] Reduce redundant code
This commit is contained in:
+1
-17
@@ -62,23 +62,7 @@ export class GPAUtils
|
|||||||
let totalGPA = 0;
|
let totalGPA = 0;
|
||||||
courses.forEach(course =>
|
courses.forEach(course =>
|
||||||
{
|
{
|
||||||
// Find the GPA for this course.
|
totalGPA += this.getGP(course);
|
||||||
this.SCALE.forEach(scale =>
|
|
||||||
{
|
|
||||||
// Letter grades are the same
|
|
||||||
if (scale[this.LETTER] == course.letterGrade)
|
|
||||||
{
|
|
||||||
// Get grade and add it
|
|
||||||
let grade = <number> scale[this.GPA];
|
|
||||||
totalGPA += grade;
|
|
||||||
|
|
||||||
// Add scaleUp if not failed.
|
|
||||||
if (grade != 0) totalGPA += course.scaleUp;
|
|
||||||
|
|
||||||
// That's it
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get average GPA
|
// Get average GPA
|
||||||
|
|||||||
Reference in New Issue
Block a user