From fce1593e32c3ee6acaa295b9363cb5a69beac040 Mon Sep 17 00:00:00 2001 From: Verox Date: Thu, 14 Mar 2024 19:50:50 +0100 Subject: [PATCH] Fixed user ownership check if habit_lists --- db/SQLiteClient.py | 2 +- models/User.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/db/SQLiteClient.py b/db/SQLiteClient.py index 7fe4070..7b8c7e2 100644 --- a/db/SQLiteClient.py +++ b/db/SQLiteClient.py @@ -324,7 +324,7 @@ def habitList_update_slot(id: int, slot: int): def get_habitLists(user_id: int): - query = (f"SELECT habit_lists.*, habit_users.user_id, habit_users.accepted FROM habit_lists JOIN habit_users ON habit_lists.id = habit_users.list_id " + query = (f"SELECT habit_lists.*, habit_users.accepted FROM habit_lists JOIN habit_users ON habit_lists.id = habit_users.list_id " f"WHERE habit_users.user_id = {user_id};") conn = con3() cursor = conn.cursor() diff --git a/models/User.py b/models/User.py index cb7530c..980043b 100644 --- a/models/User.py +++ b/models/User.py @@ -54,10 +54,9 @@ class User(UserMixin): raw_habitLists = get_habitLists(self.id) habitLists = [] for habitList in raw_habitLists: - user_id = habitList[5] accepted = habitList[6] habitList = HabitList(habitList[0], habitList[1], habitList[2], habitList[3]) - if accepted == 1 or habitList.get_users()[0].id == user_id: + if accepted == 1: habitLists.append(habitList) return habitLists