This commit is contained in:
Nick Leeman 2022-10-09 17:20:09 +02:00
parent 048eea106e
commit 1f61f877fe

View File

@ -6,23 +6,13 @@ class Search:
@staticmethod
def search_members(query):
cur = Database.connection.cursor()
# cur.execute("""
# SELECT * FROM users WHERE
# id LIKE ? OR
# username LIKE ? OR
# firstname LIKE ? OR
# lastname LIKE ? OR
# email LIKE ? OR
# phone LIKE ?
# """, (f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%"))
cur.execute("""SELECT * FROM users""")
rows = cur.fetchall()
payload = []
for row in rows:
user = User(Database.connection)._set_row_values(row)
if str(user.id) == user.id:
if str(user.id) == query:
payload.append(user)
continue
@ -35,15 +25,7 @@ class Search:
@staticmethod
def search_advisors(query):
cur = Database.connection.cursor()
cur.execute("""
SELECT * FROM users WHERE
id LIKE ? OR
username LIKE ? OR
firstname LIKE ? OR
lastname LIKE ? OR
email LIKE ? OR
phone LIKE ?
""", (f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%"))
cur.execute("""SELECT * FROM users""", (f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%"))
rows = cur.fetchall()
payload = []
@ -62,15 +44,7 @@ class Search:
@staticmethod
def search_admins(query):
cur = Database.connection.cursor()
cur.execute("""
SELECT * FROM users WHERE
id LIKE ? OR
username LIKE ? OR
firstname LIKE ? OR
lastname LIKE ? OR
email LIKE ? OR
phone LIKE ?
""", (f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%"))
cur.execute("""SELECT * FROM users""", (f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%", f"%{query}%"))
rows = cur.fetchall()
payload = []