Skip to content

Commit d6bf1ed

Browse files
committed
fix contacts api returning archived contacts
1 parent b7397d4 commit d6bf1ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/server/api/common_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def get_contacts(search_text):
1515

1616
names = search_text.split(" ")
1717
if len(names) == 2:
18-
query = text("select * from pdp_contacts where archived_date is null AND\
19-
lower(first_name) like lower(:name1) and lower(last_name) like lower(:name2) \
20-
OR lower(first_name) like lower(:name2) and lower(last_name) like lower(:name1)")
18+
query = text("select * from pdp_contacts where archived_date is null AND ( \
19+
(lower(first_name) like lower(:name1) and lower(last_name) like lower(:name2)) \
20+
OR (lower(first_name) like lower(:name2) and lower(last_name) like lower(:name1)) )")
2121
query_result = connection.execute(query, name1='{}%'.format(names[0]), name2='{}%'.format(names[1]))
2222
elif len(names) == 1:
2323
query = text("select * from pdp_contacts \

0 commit comments

Comments
 (0)