@aaronrubinstein
Posted
Nice work Eileen! I was playing with your live app and noticed the filters aren't quite working as intended. According to the the readme: For each filter added, only listings containing all selected filters should be returned.
When I was clicking multiple filters it looked like it was returning listings that included any of the filter terms rather than all of them.
Here's a snippet from my code (jobListings
is the source data and userFilters
is an array of the selected filters). I'm doing something very similar to you except using the every()
method instead of some()
. So probably an easy fix!
let filteredJobListings = [];
jobListings.forEach(job => {
let listingFilterTerms = [job.role, job.level, ...job.languages, ...job.tools];
if (userFilters.every(term => listingFilterTerms.includes(term))) {
filteredJobListings.push(job);
}
});
return filteredJobListings;
Hope that's helpful!
Aaron
Marked as helpful
@Eileenpk
Posted
Aaron thank you for catching that, I'm making that change now!