This commit is contained in:
Yapollon 2024-03-25 12:41:12 +01:00
commit 5251a80d02
3 changed files with 3 additions and 10 deletions

8
app.py
View File

@ -645,13 +645,7 @@ def delete_user_from_list():
id = int(habit_user_id)
habit_list.delete(id)
return render_template(
'users-edit.html',
title='Teilnehmer bearbeiten',
habit_list=habit_list,
users=users,
errors={},
)
return redirect(url_for('index', habit_list=habit_list.id))
@app.route('/users-leave')
@login_required

View File

@ -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()

View File

@ -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