From 756ff55b4cf84bb5750607f786591be1ae862fd3 Mon Sep 17 00:00:00 2001 From: AIIrondev Date: Sun, 2 Aug 2026 15:14:46 +0200 Subject: [PATCH] Chaces to the Deleted Status, to reflekt the real active bookings in the menu --- Web/app.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Web/app.py b/Web/app.py index 24581f8..2179708 100755 --- a/Web/app.py +++ b/Web/app.py @@ -9796,7 +9796,8 @@ def get_period_times(booking_date, period_num): @app.route('/my_borrowed_items') def my_borrowed_items(): """ - Zeigt alle vom aktuellen Benutzer ausgeliehenen und geplanten Objekte an. + Zeigt alle vom aktuellen Benutzer ausgeliehenen und geplanten Objekte an, + schließt jedoch soft-gelöschte Objekte (Deleted: True) aus. """ if 'username' not in session: flash('Bitte melden Sie sich an, um Ihre ausgeliehenen Objekte anzuzeigen', 'error') @@ -9837,7 +9838,11 @@ def my_borrowed_items(): query_id = ObjectId(item_id) else: query_id = item_id - item_obj = items_collection.find_one({'_id': query_id}) + + item_obj = items_collection.find_one({ + '_id': query_id, + 'Deleted': {'$ne': True} + }) except Exception: item_obj = None @@ -9862,7 +9867,11 @@ def my_borrowed_items(): elif status == 'planned': planned_items.append(item_obj) - all_borrowed_items = list(items_collection.find({'Verfuegbar': False})) + all_borrowed_items = list(items_collection.find({ + 'Verfuegbar': False, + 'Deleted': {'$ne': True} + })) + for item in all_borrowed_items: raw_item_user = item.get('User', '') try: @@ -9879,7 +9888,6 @@ def my_borrowed_items(): client.close() - # DEBUG Logging app.logger.info( f"Passing {len(active_items)} active items and {len(planned_items)} planned items to template for user {username}")