Skip to content

Commit

Permalink
correct the precedence of filters applied
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor Bechthold committed Feb 7, 2024
1 parent cca13a2 commit 68b7e76
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/app/services/implementations/log_records_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from datetime import datetime
from pytz import timezone, utc
from sqlalchemy import text
from flask import current_app


class LogRecordsService(ILogRecordsService):
Expand Down Expand Up @@ -173,11 +174,11 @@ 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 68b7e76

Please sign in to comment.