diff --git a/apps/api/v1/rest/grades/src/lib.ts b/apps/api/v1/rest/grades/src/lib.ts index 76a7ed50..727bdbae 100644 --- a/apps/api/v1/rest/grades/src/lib.ts +++ b/apps/api/v1/rest/grades/src/lib.ts @@ -92,7 +92,7 @@ export function aggregateGrades(grades: GradesRaw): GradesAggregate { ).map((key) => [key, grades.reduce((a, { [key]: b }) => a + b, 0)]), ) as Omit), 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, }, }; }