Skip to content

Commit f15de91

Browse files
committed
fix two word name search
1 parent 19b3c50 commit f15de91

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
@@ -11,9 +11,9 @@ def get_contacts(search_text):
1111

1212
names = search_text.split(" ")
1313
if len(names) == 2:
14-
query = text("select * from pdp_contacts where archived_date is null AND\
15-
where lower(first_name) like lower(:name1) and lower(last_name) like lower(:name2) \
16-
OR lower(first_name) like lower(:name2) and lower(last_name) like lower(:name1)")
14+
query = text("select * from pdp_contacts WHERE archived_date is null AND \
15+
(lower(first_name) like lower(:name1) AND lower(last_name) like lower(:name2) \
16+
OR lower(first_name) like lower(:name2) AND lower(last_name) like lower(:name1))")
1717
query_result = connection.execute(query, name1='{}%'.format(names[0]), name2='{}%'.format(names[1]))
1818
elif len(names) == 1:
1919
query = text("select * from pdp_contacts \

0 commit comments

Comments
 (0)