Skip to content

Commit

Permalink
Fix issue #31: Resolve empty enrollment history entries
Browse files Browse the repository at this point in the history
  • Loading branch information
waterkimchi authored and andrew-wang0 committed Jan 9, 2025
1 parent 194b959 commit 018c221
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion apps/api/src/services/enrollment-history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,20 @@ export class EnrollmentHistoryService {
section.statusHistory.push(row.status ?? "");
}
}
return transformedSectionRows
const filteredSections = Array.from(transformedSectionRows.values()).filter((section) => {
return (
section.finalExam.length > 0 ||
section.maxCapacityHistory.length > 0 ||
section.totalEnrolledHistory.length > 0 ||
section.waitlistHistory.length > 0 ||
section.waitlistCapHistory.length > 0 ||
section.requestedHistory.length > 0 ||
section.newOnlyReservedHistory.length > 0 ||
section.statusHistory.length > 0
);
});

return filteredSections
.values()
.map(({ instructors, meetings, ...rest }) => ({
instructors: Array.from(instructors),
Expand Down

0 comments on commit 018c221

Please sign in to comment.