diff --git a/db/SQLiteClient.py b/db/SQLiteClient.py index 2b6bc09..a52d109 100644 --- a/db/SQLiteClient.py +++ b/db/SQLiteClient.py @@ -63,8 +63,8 @@ def get_habit(id: int): return habits -def get_habits(): - query = f"SELECT * FROM habits;" +def get_habits(user_id: int): + query = f"SELECT * FROM habits WHERE user_id = {user_id};" conn = con3() cursor = conn.cursor() cursor.execute(query) diff --git a/models/Habit.py b/models/Habit.py index 82a30a8..5c3d6fb 100644 --- a/models/Habit.py +++ b/models/Habit.py @@ -27,8 +27,8 @@ class Habit: return Habit(habit[0], habit[1], habit[2], habit[3], habit[4], habit[5]) if habit else None @staticmethod - def get_all(): - raw_habits = get_habits() + def get_all(user_id): + raw_habits = get_habits(user_id) habits = [] for habit in raw_habits: habit = Habit(habit[0], habit[1], habit[2], habit[3], habit[4], habit[5])