Skip to content

Commit

Permalink
there is probably a better way to do this but making it work for now
Browse files Browse the repository at this point in the history
  • Loading branch information
shariq1989 committed Oct 5, 2020
1 parent 80808d9 commit bd75cb8
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ Template.currentProsecutors.helpers({
attorneys() {
const selectedRoleFilters = Template.instance().state.get("selectedRoleFilters")
const selectedRaceFilters = Template.instance().state.get("selectedRaceFilters")
return selectedRoleFilters.length > 0
? Attorneys.find({"role": {$in: selectedRoleFilters}}).fetch()
: Attorneys.find().fetch()
if (selectedRoleFilters.length > 0 && selectedRaceFilters.length > 0) {
Attorneys.find({"role": {$in: selectedRoleFilters}, "race": {$in: selectedRaceFilters}}).fetch()
} else if (selectedRoleFilters.length > 0 && selectedRaceFilters.length === 0) {
Attorneys.find({"role": {$in: selectedRoleFilters}}).fetch()
} else if (selectedRoleFilters.length === 0 && selectedRaceFilters.length > 0) {
Attorneys.find({"race": {$in: selectedRaceFilters}}).fetch()
} else {
Attorneys.find().fetch()
}
},
});

Expand Down

0 comments on commit bd75cb8

Please sign in to comment.