Fix of the encryption processing with the Student class
Release Inventarsystem / release-docker (push) Successful in 2m14s
Release Inventarsystem / release-docker (push) Successful in 2m14s
This commit is contained in:
+11
-2
@@ -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'))
|
||||
|
||||
Reference in New Issue
Block a user