Skip to content

Commit

Permalink
Filtering fix (#236)
Browse files Browse the repository at this point in the history
* correct the precedence of filters applied

* remove import

* run.    the.    linter.
  • Loading branch information
Connor Bechthold authored Feb 7, 2024
1 parent cca13a2 commit 6ddbf35
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions backend/app/services/implementations/log_records_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,23 @@ def filter_log_records(self, filters=None):
for filter in filters:
if filters.get(filter):
if is_first_filter:
sql = sql + "\nWHERE " + options[filter](filters.get(filter))
sql = (
sql
+ "\nWHERE "
+ "("
+ options[filter](filters.get(filter))
+ ")"
)
is_first_filter = False
else:
if filters.get(filter):
sql = sql + "\nAND " + options[filter](filters.get(filter))
sql = (
sql
+ "\nAND "
+ "("
+ options[filter](filters.get(filter))
+ ")"
)
return sql

def join_resident_attributes(self):
Expand Down

0 comments on commit 6ddbf35

Please sign in to comment.