From 1299140823efcfda819c57d55f4f89e66e8014f7 Mon Sep 17 00:00:00 2001 From: Aiirondev Date: Sun, 16 Aug 2026 13:17:20 +0200 Subject: [PATCH] Fix of the encryption processing with the Student class --- Web/app.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Web/app.py b/Web/app.py index 17894f0..017e624 100755 --- a/Web/app.py +++ b/Web/app.py @@ -4431,10 +4431,19 @@ def student_card_class_barcode_download(): db = client[cfg.MONGODB_DB] student_cards = db['student_cards'] - class_cards = list(student_cards.find({'Klasse': class_name}).sort('AusweisId', 1)) - class_cards = [_decrypt_student_card_doc(card) for card in class_cards] + # 1. Alle Ausweise laden + all_cards = list(student_cards.find().sort('AusweisId', 1)) client.close() + # 2. Alle entschlüsseln + decrypted_cards = [_decrypt_student_card_doc(card) for card in all_cards] + + # 3. Im Speicher nach der Klartext-Klasse filtern + class_cards = [ + card for card in decrypted_cards + if card.get('Klasse', '').strip() == class_name + ] + if not class_cards: flash(f'Keine Ausweise für die Klasse "{class_name}" gefunden.', 'error') return redirect(url_for('student_cards_admin'))