decryption of the parsed fields
Release Inventarsystem / release-docker (push) Successful in 2m15s

This commit is contained in:
2026-08-16 13:08:34 +02:00
parent 514065f4af
commit ea48d5c28a
+5 -13
View File
@@ -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()
)