Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
fix: 🐛 make sure average GPA field is not NaN (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecxyzzy authored Aug 26, 2023
1 parent cf74286 commit d6b883e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/api/v1/rest/grades/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function aggregateGrades(grades: GradesRaw): GradesAggregate {
).map((key) => [key, grades.reduce((a, { [key]: b }) => a + b, 0)]),
) as Omit<GradeDistribution, "averageGPA">),
averageGPA:
grades.reduce((a, { averageGPA: b }) => a + b, 0) / grades.filter(isNotPNPOnly).length,
grades.reduce((a, { averageGPA: b }) => a + b, 0) / grades.filter(isNotPNPOnly).length || 0,
},
};
}

0 comments on commit d6b883e

Please sign in to comment.