Chaces to the Deleted Status, to reflekt the real active bookings in the menu

This commit is contained in:
2026-08-02 15:14:46 +02:00
parent df5a3265a1
commit 756ff55b4c
+12 -4
View File
@@ -9796,7 +9796,8 @@ def get_period_times(booking_date, period_num):
@app.route('/my_borrowed_items') @app.route('/my_borrowed_items')
def 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: if 'username' not in session:
flash('Bitte melden Sie sich an, um Ihre ausgeliehenen Objekte anzuzeigen', 'error') 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) query_id = ObjectId(item_id)
else: else:
query_id = item_id 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: except Exception:
item_obj = None item_obj = None
@@ -9862,7 +9867,11 @@ def my_borrowed_items():
elif status == 'planned': elif status == 'planned':
planned_items.append(item_obj) 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: for item in all_borrowed_items:
raw_item_user = item.get('User', '') raw_item_user = item.get('User', '')
try: try:
@@ -9879,7 +9888,6 @@ def my_borrowed_items():
client.close() client.close()
# DEBUG Logging
app.logger.info( app.logger.info(
f"Passing {len(active_items)} active items and {len(planned_items)} planned items to template for user {username}") f"Passing {len(active_items)} active items and {len(planned_items)} planned items to template for user {username}")