Skip to content

Commit

Permalink
fix: correct filter
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Apr 24, 2024
1 parent c2677f9 commit e4a07b5
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions lib/utils/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,18 @@ export function filterData(
(filterValues.format[0] && filterValues.format[1]) ||
(result.async && filterValues.format[0]) ||
(!result.async && filterValues.format[1]);

const instantEnrollment = filterValues.enrollment[0]
? result.instantEnrollment
: true;
const hasOpenSeats = filterValues.available[0]
? result.hasOpenSeats
: true;
const teachingInstitution =
result.sendingInstitution == filterValues.institution ||
filterValues.institution == "Any Institution";
const withinUnits =
result.units >= filterValues.min &&
result.units <= filterValues.max;
const withinTime =
startsAfter(filterValues.start, result) &&
endsBefore(filterValues.end, result);

return (
onlineFormat &&
instantEnrollment &&
hasOpenSeats &&
teachingInstitution &&
withinUnits &&
withinTime
onlineFormat && hasOpenSeats && teachingInstitution && withinTime
);
});

Expand Down

0 comments on commit e4a07b5

Please sign in to comment.