Add WIP of exercise live search, just testing speed in prod site
This commit is contained in:
9
features/exercises.py
Normal file
9
features/exercises.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class Exercises:
|
||||
def __init__(self, db_connection_method):
|
||||
self.execute = db_connection_method
|
||||
|
||||
def get(self, query):
|
||||
# Add wildcards to the query
|
||||
search_query = f"%{query}%"
|
||||
exercises = self.execute("SELECT exercise_id, name FROM exercise WHERE LOWER(name) LIKE LOWER(%s) ORDER BY name ASC;", [search_query])
|
||||
return exercises
|
||||
Reference in New Issue
Block a user