From ea48d5c28a24fe371a494482fb986eaa6a028e26 Mon Sep 17 00:00:00 2001 From: Aiirondev Date: Sun, 16 Aug 2026 13:08:34 +0200 Subject: [PATCH] decryption of the parsed fields --- Web/app.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Web/app.py b/Web/app.py index 6cd4932..17894f0 100755 --- a/Web/app.py +++ b/Web/app.py @@ -4108,28 +4108,20 @@ def student_cards_admin(): app.logger.error(f"Error adding student card: {e}") flash('Fehler beim Hinzufügen des Ausweises.', 'error') - # Get all student cards + # Get all student cards and decrypt them all_cards = list(student_cards.find().sort('AusweisId', 1)) all_cards = [_decrypt_student_card_doc(card) for card in all_cards] client.close() - # Alle eindeutigen Klassen für das Dropdown ermitteln - client = MongoClient(cfg.MONGODB_HOST, cfg.MONGODB_PORT) - db = client[cfg.MONGODB_DB] - student_cards_collection = db['student_cards'] - - # Extrahiere alle vorhandenen Klassen, entferne leere/None Werte und sortiere sie - raw_classes = student_cards_collection.distinct('Klasse') - available_classes = sorted([c for c in raw_classes if c]) - - client.close() + raw_classes = set(card.get('Klasse', '').strip() for card in all_cards if card.get('Klasse')) + available_classes = sorted(list(raw_classes)) return render_template( 'student_cards_admin.html', - student_cards=all_cards, + student_cards=all_cards, # Hier all_cards übergeben edit_mode=edit_mode, form_data=form_data, - available_classes=available_classes, + available_classes=available_classes, # Enthält nun die lesbaren Klassen config=cfg.get_school_info() )