Skip to content

Commit

Permalink
Change FEMA filter logic to be inclusive
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarchena committed Apr 2, 2024
1 parent af21ed6 commit cd35325
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions server/src/crm/crm.utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,20 @@ export function mapInLookup(arrayOfStrings, lookupHash) {
}

export function all(...statements): string {
return statements
.filter(Boolean)
.join(' and ');
const femaFloodZoneFilters = statements.filter(statement => {
if (statement.includes('femafloodzone')) return statement
})

if (femaFloodZoneFilters.length > 0) {
const femaFilterString = femaFloodZoneFilters.join(' or ');
const filterString = statements.filter(Boolean).join(' and ');

const allStatements = filterString.concat(' and ', `((${femaFilterString}))`);
console.log('filterQuery', allStatements);
return allStatements;
}

return statements.filter(Boolean).join(' and ')
}

export function any(...statements): string {
Expand Down

0 comments on commit cd35325

Please sign in to comment.